Google just released a Static Maps API. That means no more grabbing screenshots. This is some great timing as I’m currently working on a project which needs to incorporate static Google Maps. It’s really quite cool how it works. No javascript, just an image. Within your html, you simply place an image with the source pointing to a URL which contains parameters such as location, zoom level, map type etc.
Here’s an example using the following url:
http://maps.google.com/staticmap?markers=29.204019,- 81.049919&zoom=12&size=512×512&maptype=roadmap&key =MAPS_API_KEY
In the example URL above I’ve bolded all of the parameters. There are numerous available parameters, of which I used five; markers, zoom, size, maptype, and key.
You’ll see that I used the markers parameter to define where I wanted the marker placed. In this case it’s at Daytona Beach (Bike Week starts this weekend, after all). If you don’t want a marker, and just a clean map of an area you would use the center parameter rather than the markers parameter. Those numbers that come after the markers parameter are the latitude and longitude. How did I come up with these values? I visited google.com/maps and brought up the location I wished to mark. Then I clicked the “link to this page” button at the top right of the map. The url it spit out contained the latitude and longitude I needed.
The next parameter used was zoom. This value can be set anywhere in the range of 0-19 with 0 being a view of the entire earth. The next two parameters I could have left out, as the values I selected for size and maptype are the default values anyway. But, it is nice to have the option to select a size, horizontal pixels by vertical pixels as well as the option to select a mobile map type using the maptype parameter. The last parameter I used was key. This is required as this is where you place your specific API key. You can obtain this key for free.
This is just a very brief example of what you can do with the Google Static Maps API. For more information check out Google’s documentation.





