@webgeodatavore/express-simplestyle-spec
v0.2.0
Published
This project is intended to provide a map icons API for [simplestyle-spec](https://github.com/mapbox/simplestyle-spec) (a simple styling convention for GeoJSON data)
Downloads
3
Readme
express-simplestyle-spec
This project is intended to provide a map icons API for simplestyle-spec (a simple styling convention for GeoJSON data)
It's only a minimal library to integrate in any Express project or use in a minimal standalone Express project.
The intent is to have a standalone server for map markers. In fact, the simplestyle
spec is open but the server to load icons isn't. You need a Mapbox account to consume these icons like illustrated in this example. To be fair, Mapbox does provide the library makiwich to generate images from parameters matching the spec.
We borrowed 90% of the code from the project @kartotherian/maki intended for use with Karthotherian, the vector tiles server project by Wikimedia Foundation, used within Wikipedia. For markers, their code relies on makizushi, the predecessor of makiwich. We made some adaptation to use makiwich, a more recent Mapbox library that works with latest Maki icons.
If you goal is to support together vector tiles, static maps and markers, you may consider using Kartotherian instead.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
You will need Node.js installed. As some dependencies are related to Mapnik Node bindings, we use nvm to set Node version to latest 6.x series (aka LTS version)
Installing
To try the demo
Install dependencies
npm install
And to run demo
npm start
Then, open your browser to http://localhost:3000/v4/marker/[email protected]
The URL schema is matched to the one used by the mapbox.js.
http://.../v4/marker/[email protected]
http://.../v4/marker/ {base} - {size:s|m|l} [-{letter-or-digit-or-icon-name}] + {color} [@2x] .png
At this point, only "pin" is supported for the base. The color is a 3 digit or 6 digit hex number. Optional scaling can only be 2x. Beyond the pre-defined maki icons, you may give a number (0-99), a single letter (a-z), or nothing.
To use in your own Express project
npm install @webgeodatavore/express-simplestyle-spec
To get the logic, you just have to replace in the demo code the following:
var markers = require('./../index');
with
var markers = require('@webgeodatavore/express-simplestyle-spec');
Contributing
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Thomas Gratier - Integration work
See also the list of contributors who participated in this project.
License
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details
Aknowledgements
- Mapbox for the spec itself and for the
makizushi
library that do most of the job for this library - Wikimedia Foundation and Yuri Astrakhan as the author of the markers server related code from Kartotherian