StaticMap

From OpenStreetMap Wiki
Jump to: navigation, search
Screenshot of staticMap with parameters for markers and a polygon

StaticMap [1] is a static map images generating script, and web interface for choosing/designing your map image. Specify centering and zoom, and StaticMap stitches together tile images to generate the requested larger (or smaller) map image.

Created by User:Ojw and currently running on his dev server account.

Note that his dev server account was moved from "old-dev" (some time late 2009), which would have broken any URLs or sites linking to StaticMap

Image URL parameters

Image URLs are parameterised, so you can reference a particular map image directly. Direct image references would include show=1. For example: http://ojw.dev.openstreetmap.org/StaticMap/?lat=39.096216&lon=-94.55383&z=11&layer=cloudmade_2&mode=Export&show=1

Direct urls can be used in <img> tags in HTML. There is also URL parameter documentation [2].

In fact the whole web interface is built on HTTP GET requests, meaning there is a URL for any particular state as you click around. For example: http://ojw.dev.openstreetmap.org/StaticMap/?lat=39.0962186476&lon=-94.5538330078&z=11&layer=cloudmade_2&mode=Location

Risks of using URLs directly

This builds a direct dependency between your website and this StaticMap script, which is currently hosted as a experimental thing on the development server. Clearly this can have periods of unavailability, or may be switched off at any time (which would mean no image appearing on your site). Like any service on OpenStreetMap servers, it comes with no guarantees of service continuity.

The StaticMap script may not scale well to many websites using it in this way. So far there aren't really any websites doing this. You'll need to discuss usage particularly if you are running a high traffic website. Normally for more service stability / scaleability we would look to host this on a different server, and/or behind a squid proxy (as with MapOf)

Development

Contact User:Ojw to get involved in developing.

Code is in Subversion: at http://trac.openstreetmap.org/browser/sites/other/StaticMap

Other static map options

An earlier OJW creation, MapOf, is still available running the t@h server and powering the Simple Image MediaWiki Plugin

See static map images for a full list of alternative implementations of this idea