Sign inSign up

gihan9a/staticmaps-service

By gihan9a

•Updated over 5 years ago

Generate static map images as a service

Image
0

7.2K

gihan9a/staticmaps-service repository overview

⁠Static Map Images as a Service

Logo

Generate static map images/thumbnails as a web service. It can be used as a microservice in your project.

License FOSSA Status Codacy Badge Codacy Badge

⁠Motivation

Building out of the box product for generating static map images as a web service as an alternative to the Google Static Map API.

⁠Build status

Node.js CI

⁠Code style

This project follows Airbnb javascript style guide and enforced by "Eslint". Run npm run lint to validate style adhearance.

js-standard-style

⁠Screenshots

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.

Screenshot

⁠Tech/framework used

⁠Features

Following features can be draw on a map using this API service.

  • Markers
  • Paths
  • Polygons
  • Texts

⁠Installation

You can install this API as a docker image or as a bare Node.js web service

  1. Node.js API service
    1. Clone this project
    2. Install npm dependencies using npm install or npm ci
    3. Create configuration file by renaming .env.sample to .env
    4. Configure variables in .env file
    5. Start the web server using npm start
  2. Docker image
    1. Pull the docker image from Docker Hub⁠

    2. Run the docker container
      Eg.

      docker container run -d \
         -p 8080:8080 \
         --volume /path/to/my/cache/folder:/cache \
         gihan9a/staticmaps-service
      
  3. As a serverless solution @TODO
⁠Environment variables
VariableDescriptionDefault
PORTApplication port inside container8080
IMAGE_FORMAT_DEFAULTDefault output image formatjpg
IMAGE_HEIGHT_MAXMaximum output image height1999
IMAGE_HEIGHT_MINMinium output image height1
IMAGE_WIDTH_MAXMaximum output image width1999
IMAGE_WIDTH_MINMinimum output image width1
MARKER_COLOR_DEFAULTDefault marker colororange
PATH_COLOR_DEFAULTDefault path color#000000BB
POLYGON_FILL_COLOR_DEFAULTDefault polygon fill color#00000088
TEXT_COLORDefault text (stroke) color#000000BB
TEXT_FILL_COLORDefault text fill color#000000BB
TEXT_FONTDefault font familyArial
TEXT_SIZEDefault text size12
TEXT_WIDTHDefault text stoke width1
ZOOM_MAXMaximum zoom avaialble20
ZOOM_MINMinimum zoom avaialble1
⁠Volumes

/cache directory can be mounted as a volume to persist image caches

⁠Tests

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.

⁠How to use?

Please refer the Wiki⁠ page for detailed use of the API.

⁠Contribute

Contributor Covenant

Contributions are welcome to the project. Please kindly go through the contributing guidelines⁠

⁠Credits

Awesome StaticMaps⁠ npm module by Stephan Georg⁠
Map images and data provide by Openstreetmap.org⁠
Pittsburgh Map icon⁠ by Icons8⁠

⁠License

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

FOSSA Status

Tag summary

Content type

Image

Digest

Size

67.7 MB

Last updated

over 5 years ago

docker pull gihan9a/staticmaps-service