Saturday, November 27, 2010

Geocode help

Geocode help: "

I’ve whipped up a bike route application using MapQuest’s bicycle routing API. MapQuest uses their directions routing algorithm and applies it to street and bike facility data available from the Open Street Map database. The generated route is available to web application developers through MapQuest’s Open Platform Web Services.


MapQuest’s Open Directions web service takes numeric latitude and longitude map coordinates as input for the start and destination of a trip. Most of us know our geographic locations as place names — something like “123 Main Street, Anytown, USA” or “Main Street and 2nd Avenue.” The process of converting these place names to numeric coordinates is called “geocoding.”

For this proof-of-concept, I’m using MapQuest’s Nominatim Search Service. Nominatim uses Open Street Map to convert place names to lat/lon combinations, but it doesn’t work for street addresses or zip codes. Only vague place names work with Nominatim, and even state names confound the search. I can get directions for Longmont to Niwot for example, but if I put “Colorado” in either place name, the place name search fails.

Two good Geocoding alternatives I know about are MapQuest Geocoding Web Service and Google Geocoding API. I’m not an experienced map application developer (this bike routing app that I wrote up over this Thanksgiving holiday is my very first one ever), so I’m interested in knowing from those with a little more experience what works well.

Here are pros and cons I see with Google’s geocode API:

  • It’s super simple to use and works well, but…
  • There’s no JSONP support. This means I’m required jump out of Javascript and write some server side PHP code to handle the geocoding response.
  • Google TOS says I must use this in conjunction with Google map images. Right now my default is showing OSM map images. That’s kind of okay with me to show Google’s map, except Google doesn’t have bicycle facility layers outside of the United States and a few Canadian cities, and even in the USA Google’s bike facility data is limited.
  • Google has a limit of 2,500 geolocation queries per day; since each route lookup involves two lookups, that’s effectively under 1300 route queries per day. This seems low to me.

MapQuest’s Geocoding service pros and cons:

  • MapQuest is migrating toward using OSM tiles for their maps, and there’s no restriction on the map tiles I’m allowed to show. I think MapQuest’s TOS is the least restrictive I’ve seen in a long time.
  • For addresses outside the United States, it appears I need to explicitly set a country code in the geocode request. This means some kind of web user geolocation, which I’d rather not get into right now.
  • MapQuest implements access control for cross domain scripting; I’ve never done this before so it’s something else I have to learn to make to make it work. (at least, I think that’s the problem I’m having, though I could be wrong).

I haven’t looked in detail at Yahoo’s PlaceFinder,but it seems to have a similar “You must use your map images” that Google has. Yahoo has a generous 50,000 queries per day limit, which is nice.

If you’re a somewhat experienced map web developer, what geocoding service do you recommend?

(Hat tip to Trailsnet and Recumbent Blog for letting me know about the MapQuest bicycle API. I see now that Commute By Bike also reported on this with some detail.

Related posts:

  1. Bike directions Toronto, Ontario

  2. Google Maps "Bike There" directions

  3. Google Maps bicycle directions pro tips


No comments:

Post a Comment