Skip to content

Freika/docker-staticmaps

 
 

Repository files navigation

Docker Static Maps API

Build & Publish

A containerized web version for staticmaps with express.

Usage

To get a static map from the endpoint /staticmaps several prameters have to be provided.

  • center - Center coordinates of the map in the format lon, lat
  • zoom - Set the zoom level for the map.
  • width - default 300 - Width in pixels of the final image
  • height - default 300 - Height in pixels of the final image
  • format - default png (e.g. png, jpg or webp)

For different basemaps docker-staticmaps is using exisiting tile-services from various providers. Be sure to check their Terms of Use for your use case or use a custom tileserver with the tileUrl parameter!

Deployment

with Docker

docker run -d  --name='static-maps-api' -p '3003:3000/tcp' 'mxdcodes/docker-staticmaps:latest'

with Node.js

git clone https://github.com/dietrichmax/docker-staticmaps
npm i
npm run start

Example requests

  • http://localhost:3000/staticmaps?width=300&height=300&center=-119.49280,37.81084&zoom=9&format=png

example request 1

  • http://localhost:3000/staticmaps?width=500&height=500&center=-73.99515,40.76761&zoom=10&format=webp&basemap=carto-voyager

example request 2

  • http://localhost:3000/staticmaps?width=500&height=500&center=-73.99515,40.76761&zoom=10&format=png&tileUrl=https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}

example request with custom tileUrl

About

A containerized web version for https://www.npmjs.com/package/staticmaps with https://github.com/expressjs/express

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.5%
  • Dockerfile 2.9%
  • HTML 0.6%