[georss] geopress_wp bug/patch: multiple locations match

David Turner novalis at novalis.org
Fri May 16 14:25:07 EDT 2008


Go to Yahoo maps.  Enter the address 155 E 3rd St, New York, NY.
It will tell you that there are two addresses which match.  If you look
at the map, you'll see that one is on E. 3rd St in Manhattan (which is
the one the US Post Office would deliver to if you put that address) and
the other is on E. 3rd St in Brooklyn, which is a completely different
street[1].  Google does not get confused; it apparently goes by the USPS
definition that New York, NY refers to Manhattan, rather than by the
political designation that all five boroughs constitute "New York".

The disambiguator is fine for humans, but it sure confuses Geopress.  If
you go into the Location tab of the Geopress menu in your wordpress
admin and enter that address for some place and click Save Locations,
you'll get a very confused map.  Take a look in the database, and you'll
see all sorts of XML gunk in the coords field.  I tracked the problem
down to a regular expression which was greedy when it should have been
non-greedy, and I have attached a patch.  

This patches things in the stupidest way possible: like the current
code, it makes no provision for disambiguation, and simply chooses the
first set of coordinates.  It's also suboptimal because it's still
parsing XML with regular expressions.  I would strongly recommend using
a real XML parser.  Still, it's significantly better than the status
quo.

[1] There's also a plain 3rd st, a West 3rd, a North 3rd, and a South
3rd; they are all distinct unconnected streets, unlike E and W 3rd in
Manhattan, which just tell you which side of the two block stretch
between Broadway and Bowery you're on (and in the middle, it's called
Great Jones St).  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nongreedy-geocoder.patch
Type: text/x-patch
Size: 477 bytes
Desc: not available
Url : http://lists.eogeo.org/pipermail/georss/attachments/20080516/91ceb33e/attachment.bin 


More information about the georss mailing list