Google Releases Static Maps API

John Musser
Feb. 25 2008, 02:11AM EST

If you want a dead-simple way to create custom maps without needing to worry about JavaScript or programming then the just announced Google Static Maps API may be your answer. Google's new API allows you to generate the maps using a regular URL (ala REST) along with parameters specifying location, size, etc and it returns a unique GIF image with that map. We have created a Static Maps API profile with the details. Here are some notes from their announcement:

The Google Static Maps API returns a GIF-format image in response to a HTTP request via a URL. For each request, you can specify the location of the map, the size of the image, the zoom level, the type of map, and the placement of optional markers at locations on the map. You can additionally label your markers using alpha characters, so that you can refer to them in a "key."

You embed a Static Maps API image within a webpage inside an img tag's src attribute. When the webpage is displayed, the browser requests the image from the the Static Maps API and it renders within the image location.


googlesamplemap

A few other details of note:

  • Usage: A Google Static Maps API query request looks like the following and takes parameters like size (width and height in pixels), zoom-level, type (roadmap or mobile), and any marker placements:
  • http://maps.google.com/staticmap?parameters

  • Usage limits: There's a query limit of 1000 unique image requests per user per day. For developers that may expect to hit this limit the best strategy is to use a caching mechanism to store generated images on their own servers.
  • API key: The only requirement to use the API is to sign-up for an API key, which works for both this as well as the standard Google Maps API.
  • Google offers a wizard to help walk you through the process of creating a Static Maps map.
John Musser

Comments

Comments(5)

There's been some confusion about the limit (we need to improve our docs on it). There is a per-user-IP limit of 1000 images. A user that goes over the limit will currently get an HTTP 400 for the image, so they will likely see a broken image in most browsers.

The per-IP limit is designed to prevent people from writing scripts to programmatically retrieve thousands of images (a script is sent from a server and thus comes from one IP). We've guessed that a user (with their own IP) just browsing web pages won't happen upon more than 1000 static map images each day. We may raise the limit later if that turns out not to be the case.

The important thing is that a developer shouldn't need to worry about just hosting a static map image on a webpage, even if it gets a lot of traffic.

We are attempting to integrate static maps into a report that we have created in SQL Server Reporting Services and have now been blocked from getting images. I do not believe that we exceeded the 1000 image per day limit but have been blocked because we might be pulling down up to 50 static maps in a single report.

Can you give us any guidance on how we can pull images these images with out getting blocked. Once we are in production I can't see us pulling more than a couple of hundreds maps down per day.

Thanks