Mapnik Docker container with Node and Python bindings
❗ Ensure your Docker build environment, be it a VM (if you use Docker for Mac or Windows) or bare metal, has at least 4 gigabytes of memory. Any less and you'll have to enjoy hella swapping.
- Do
docker build -t mapnik .. It will take a long while, so best get another coffee.
- Ubuntu 16.04 LTS
- Mapnik 3.0.10 (at the time of writing)
- Node.js 6.x
/opt/node-mapnikcontains the Node bindings.- They are
npm linked, so any apps requiring them should be able to justnpm link mapnik.
/opt/python-mapnikcontains the Python bindings.- The bindings are built for both Python 2.x and 3.x, and installed system-wide.
- If your app requires a virtualenv,
pip install -e /opt/python-mapnikis likely your best bet. - Otherwise, just
--system-site-packagesyour virtualenv or don't use a virtualenv at all.
-
The basic Python world-rendering script is installed in
/opt/demos/world.py.- Use
cd /opt/demos; python2 world.pyto try that Python 2.x works. - Use
cd /opt/demos; python3 world.pyto try that Python 3.x works. - The script outputs a
world.png. You can usedocker cpto look at it.
- Use
-
The Node.js "render a map from a stylesheet" demo is installed in
/opt/demos/world.js.- Use
cd /opt/demos; npm i mapnik; node world.jsto try it. You'll get a crapload of deprecation warnings (see the related bug) since we're running Node 6, but the script does output amap.pnganyway. You can usedocker cpto look at it.
- Use