Static map images
Static maps images (have the potential to) offer an easy way to embed maps on a webpage.
The idea is for web site developers to simply use an <img />
tag (in pure HTML or via a CMS). Its src attribute specifies the location of the map, the size of the image, the zoom level, the type of map, etc. When the webpage is displayed, the browser requests the image from the static map service and the map is displayed with no dynamic features, the same way as any other image.
Most of the options are open source, meaning you could host the service within your own webspace.
Approaches
- Of course you can also grab a static map image by simply taking a screenshot; instructions for this vary between operating systems.
- OSM's own Share panel's Image option also allows generating an image, but not as a permalinkable URL (for one-offs, and not for scripted use)
- API services:
- Mapbox Static API and classic Static API - sign up for API key
- Geoapify Static Maps API - sign up for API key
- Maptoolkit Static Maps API - sign up for API key
- Maptoolkit Printmaps API - static map images in 600 dpi
- Web-based services:
- Printmaps Static Map Generator (free for normal resolution, premium for high-res - PNG, PSD & SVG)
- Map w/o JavaScript - create HTML code to embed a map using OpenStreetMap tiles
- Software libraries:
- osm-static-maps - nodejs library + self hosted option, with demo on heroku
- staticmap from komoot
- staticmapservice - a configurable web service based on staticmap
- py-staticmaps - Python library for creating PNG+SVG maps with pin-style+image markers, geodesic polylines, polygons, circles.
- go-staticmaps - Go library and command line tool to render static map images using OpenStreetMap tiles.
- php-osm-static-api - PHP library to render static images using OpenStreetMap tiles.
- A local shell script (uses firefox screenshotting)
- Plugins:
- A few services used to exist, but were taken offline. These along with other "tile stitching" options can still be run and used locally or re-hosted somewhere:
- StaticMap
- StaticMapLite staticMapLite + staticMapWizzard
- Bigmap
- MapQuest/Open Static Maps API
- Static Maps API
- Tyler (github) - available as a "demo".
- Not a service, but it seems that you can find the (old) python script by searching the web for some keyword combination: http://modestmaps.com/examples-python-ws/ ws-compose and ws-pinwin
Comparison Matrix
Functionality | Tyler [1] | osm-static-maps | Geoapify Static Maps API | |||
---|---|---|---|---|---|---|
Status/Reliability | Demo (inherently unreliable) |
Healthy maintained 2013-2020+ |
Healthy | |||
URL | http://tyler-demo.herokuapp.com | heroku hosted demo | Demo | |||
Map types |
|
|
||||
Image types | png | jpeg, png (lossless optimized) | jpeg, png | |||
Supported URL Parameters | ||||||
Google API | lat/lon/zoom | yes | lat/lon/zoom/format/markers | |||
OSM Permalink | yes | yes | yes | |||
Support of Markers | ||||||
Markers | no | Through geojson | yes | |||
Multiple Markers | no | Through geojson | yes | |||
Custom Markers | no | URL based | Generated by Geoapify Marker Icon API | |||
GUI | no | no | Playground | |||
Support of Path / Vectors / Polygons / Overlays | ||||||
Paths | no | Through geojson | no | |||
Polygons | no | Through geojson | no | |||
Scale Bar | no | yes | no |
Comparison of request parameters
Besides varying in supported features each implementation has its own request parameter syntax. If you are planning to use one of those, read the documentation that comes with it. Eventually some projects will adapt or implement compatibility modes.
OSM Scheme
|
Google Static Maps API
|
WMS Client getMap Request |