Generate static map images as a service
7.2K

Generate static map images/thumbnails as a web service. It can be used as a microservice in your project.
Building out of the box product for generating static map images as a web service as an alternative to the Google Static Map API.
This project follows Airbnb javascript style guide and enforced by "Eslint". Run npm run lint to validate style adhearance.
Images can be generated using URL parameters as follows.
<your baseurl>?markers=40.714728,-73.998672|63.259591,-144.667969&size=200x200
The above url will generate blow image.

Following features can be draw on a map using this API service.
You can install this API as a docker image or as a bare Node.js web service
npm dependencies using npm install or npm ci.env.sample to .env.env filenpm startPull the docker image from Docker Hub
Run the docker container
Eg.
docker container run -d \
-p 8080:8080 \
--volume /path/to/my/cache/folder:/cache \
gihan9a/staticmaps-service
| Variable | Description | Default |
|---|---|---|
| PORT | Application port inside container | 8080 |
| IMAGE_FORMAT_DEFAULT | Default output image format | jpg |
| IMAGE_HEIGHT_MAX | Maximum output image height | 1999 |
| IMAGE_HEIGHT_MIN | Minium output image height | 1 |
| IMAGE_WIDTH_MAX | Maximum output image width | 1999 |
| IMAGE_WIDTH_MIN | Minimum output image width | 1 |
| MARKER_COLOR_DEFAULT | Default marker color | orange |
| PATH_COLOR_DEFAULT | Default path color | #000000BB |
| POLYGON_FILL_COLOR_DEFAULT | Default polygon fill color | #00000088 |
| TEXT_COLOR | Default text (stroke) color | #000000BB |
| TEXT_FILL_COLOR | Default text fill color | #000000BB |
| TEXT_FONT | Default font family | Arial |
| TEXT_SIZE | Default text size | 12 |
| TEXT_WIDTH | Default text stoke width | 1 |
| ZOOM_MAX | Maximum zoom avaialble | 20 |
| ZOOM_MIN | Minimum zoom avaialble | 1 |
/cache directory can be mounted as a volume to persist image caches
Tests can be found in /test directory. Tests can be run using npm test. Please make sure you have working internet connection when running integration tests.
Please refer the Wiki page for detailed use of the API.
Contributions are welcome to the project. Please kindly go through the contributing guidelines
Awesome StaticMaps npm module by Stephan Georg
Map images and data provide by Openstreetmap.org
Pittsburgh Map icon by Icons8
This work is licensed under the terms of the MIT license.
For a copy, see https://opensource.org/licenses/MIT.
Map images are provided by © OpenStreetMap contributors
Content type
Image
Digest
Size
67.7 MB
Last updated
over 5 years ago
docker pull gihan9a/staticmaps-service