Google recently announced a new version of its Google Maps API, called the Static Maps API. Its Web site is at http://code.google.com/apis/maps/documentation/staticmaps/index.html . Unlike the regular Google Maps API, the Static Maps API doesn’t require JavaScript, and its parameters are passed through a URL. You WILL need an API key for it to work.
There are several parameters you specify with the URL, including basic stuff like the size of the map, where it should be centered (longitude and latitude), and how close it should be zoomed. You can also add little markers to it. I’m including a sample map below of the New Bedford Whaling Museum.
The URL looks like this:
http://maps.google.com/staticmap?center=41.637497,-70.923529&zoom=12&size=512×256
&maptype=roadmap&markers=41.637497,-70.923529,bluem&key={my key goes here)
From left to right, the parameters are where the maps centers, how close it’s zoomed, the size, what kind of map it is, where the one marker is placed, along with what color and what letter, and the API key.
Then all you have to do is take that URL and put it into an img src:
This API makes it really, really, really simple to create maps for your Web site for just off the cuff. Of course, it doesn’t have the flexibility or the functionality of a map created by the JavaScript API, but it’s very quick. I am morosely remembering little projects I did that took ages with the regular API that I would have knocked off very quickly with this one….
Categories: News