geojson-mapnikify
Transform GeoJSON objects into Mapnik
XML stylesheets with embedded GeoJSON data and simplestyle-spec-derived
styles.
install
As a dependency:
npm install --save geojson-mapnikify
As a binary:
npm install -g geojson-mapnikify
api
Assumptions:
- GeoJSON is valid, and in EPSG:4326
- Styles, if any, are expressed in simplestyle-spec
- Mapnik 2.x is the rendering engine
binary
If you install -g
, you can use geojson-mapnikify
as a binary that takes
a single GeoJSON file as an argument and writes a Mapnik XML stylesheet
to stdout.
$ geojson-mapnikify test/data/point-retina.geojson > stylesheet.xml
$ geojson-mapnikify test/data/point-retina.geojson retina > stylesheet-retina.xml
mapnikify(geojson, TMP, retina) -> { xml: stylesheet, resources: [] }
Transform GeoJSON into Mapnik XML.
Input
geojson
is a GeoJSON object.TMP
is a tmp directory path for marker resourcesretina
is true or false for whether the style should be optimized for 2x rendering.
Output
xml
is the stylesheetresources
is a list of paths of marker icons that are expected to be downloaded
by another process