Sign inSign up

cosme/osm-static-maps

By cosme

Updated over 7 years ago

Image
0

275

cosme/osm-static-maps repository overview

osm-static-maps

This pretends to be inspired in Google(c) static map service. But made using open source technologies.

You can find osm-static-maps running in heroku

Here you have a demo

And a dynamic version of the demo, for testing purposes.

As a first approach, the service can render a geoJSON in a map, returning a PNG and you can determine also an optional height and width in pixels.

Parameters that can be used (some can be passed to the app server as GET query params)

ParameterDescription
geojsongeojson object to be rendered in the map
heightheight in pixels of the returned img
widthheight in pixels of the returned img
tileserverUrlurl of a tileserver (default is official osm: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')
more thingsto be added soon!

How to use

  1. This library is published in npm you can use it as an npm module
-shell-
npm install osm-static-maps

-index.js-
osmsm = require('osm-static-maps');
osmsm({geojson: geojson})
  .then(function(imageStream) { ... })
  .catch(function(error) { ... })
  1. alternatively you can download the code, run the sample server and use it standalone (see How to run)

  2. lastly you can use the heroku-hosted alternative directly here

How to run

nodejs is a prerequisite, please install it before this from here https://nodejs.org/

git clone [email protected]:jperelli/osm-static-maps.git
cd osm-static-maps
npm install
npm start

Note that you can use yarn if you like it more than npm

To develop use

npm run dev  # or just 'yarn dev'

Credits

Credits go to the outstanding, everlasting, fascinating opensource. Specially to

  • OpenStreetMap
  • Leaflet
  • node-webshot
  • ExpressJS
  • Handlebars

Tag summary

Content type

Image

Digest

Size

388.1 MB

Last updated

over 7 years ago

docker pull cosme/osm-static-maps