Friday, June 23rd, 2006

Geocoding with Google’s Maps API

Category: JavaScript, Programming has a new article/tutorial today about a feature that Google (apparently) quietly slipped into their Maps API a little while back – a geocoding service.

Yet one of the glaring omissions from the API has been the ability to map locations without the use of third-party solutions for converting mailing addresses to their corresponding coordinates.

This longstanding feature request was satisfied on June 11 when Google quietly added geocoding capabilities to the API. What’s more, this feature isn’t limited to the U.S.; street-level geocoding is also offered for Canada, France, Germany, Italy, Japan, and Spain! While limited to 50,000 daily requests, it’s fair to say such constraints won’t affect most users, particularly if caching is implemented. This tutorial shows you how to use this new feature, further streamlining your use of this wonderful API.

To follow along with this part of the tutorial series, you’ll need to get things setup correctly and be somewhat familiar with using the API. From there, it’s a simple matter of calling an instance in your Javascript of the GClientGeocoder class and the getLatLong() function with a street address. There’s also the getLocations() call that returns a “pretty” version of the address.

They give an example response from the getLocations() call and include a sample script to illustrate how it can be used to translate a street address all the way to a point on a Google map. They also include an example of using a Placemark object to grab the data and pass it into an openInfoWindowHTML() method to make the formatting of the detail information a bit easier on the eyes.

Posted by Chris Cornutt at 7:54 am

3.6 rating from 47 votes


Comments feed TrackBack URI

Make certain not to forget the truly awesome GoogleMaps JSP Taglibrary.

Comment by Andrew Collins — June 23, 2006

[…] Ajaxian » Geocoding with Google’s Maps API This is excellent. Lack of Geocoding always made using the Google Maps harder than it needed to be. (tags: geocoding googlemaps google web2.0 javascript) […]

Pingback by Inspirational Technology » Blog Archive » links for 2006-06-24 — June 23, 2006

Google wasn’t exactly quiet about this. They posted it on their Maps API blog.

Comment by Scott Johnson — June 24, 2006

[…] Ajaxian » Geocoding with Google’s Maps API (tags: google maps ajax tutorial) […]

Pingback by Like Your Work » Blog Archive » links for 2006-06-28 — June 27, 2006

sweet! no more having to go to yahoo to geocoding information for my google maps!

Comment by Josh Giese — June 28, 2006

Excellent Info!
This is catching on big time… with lots and lots more users wisihing to have it included in their sites. Thanks for the info and tips…. learned loads! Off to try all this now ;)

Comment by Web Design Spain — December 18, 2006

can’t wait to try this out, thanks!

Comment by enlarge — September 2, 2007

yay for google

Comment by freedate — September 2, 2007

Google has almost everything. He just does not have reverse geocoding, I mean if I want to get informations about administrative divisions for given GPS position. But in combination with API I just found it does :) See

Comment by rozsypal — November 10, 2008

I have used google and ebay apis to plot location of Ebay UK Car Auctions on the map. Trying to achieve this live as people request is near impossible due to the delays in both these APIs. Effectively there are around 2000 combinations for car makes and model to get data for, this app uses 3 cron jobs to retrieve most watched data, retrieve query data, and process geocode locations. Try it out here:, some data still being gathered so some queries maybe slightly slow for a while until caching is complete

Comment by 3formed — April 13, 2009

Leave a comment

You must be logged in to post a comment.