staticmapmaker

Create static map images with markers, geodesic lines, ...


Keywords
map staticmap osm markers, geodesic, map, mapping, markers, openstreetmap, static, tilemap, tiles
License
MIT
Install
pip install staticmapmaker==0.1.2

Documentation

Build Status

StaticMapMaker

  • Markers
  • Geodesic lines
  • Automatic guessing of the maps center and zoom (based on added objects)
  • Full anti-aliasing of drawn objects (via cairo)
  • Caching of tile images

Installation

StaticMapMaker is available as a Python package, which can be installed via pip:

pip install staticmapmaker

All the rendering is done with pycairo which depends on the cairo libraries (Ubuntu package: libcairo2-dev).

Usage

import staticmapmaker as sm

ctx = sm.Context()
ctx.add_object(sm.Marker(sm.latlng(12, 34)))
ctx.add_object(sm.Line([sm.latlng(12, 34), sm.latlng(12.5, 34.5)]))
image = ctx.render(800, 600)
image.write_to_png('my-map.png')

See the examples directory for more detailed usage examples.

Setting-Up a Development Environment

(Instructions for Ubuntu)

sudo apt-get install libcairo2-dev

git clone https://github.com/flopp/staticmapmaker

cd staticmapmaker

virtualenv -p python3 env
source env/bin/activate

pip install -r requirements.txt -r requirements-dev.txt

# run linter (flake8)
make lint

# run unit-tests (pytest)
make test

# run example scripts
PYTHONPATH=. examples/zrh_swiss_destinations.py
PYTHONPATH=. cli/main.py --help

License

Copyright 2017 Florian Pigorsch & Contributors. All rights reserved.

Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.