parses an addressbook (csv-file) to render a small OSM-map (4.5cm x 9.5cm 300dpi) of some contacts
You want awesome table name cards on your next anniversary
- parses a CSV file containing your addresses
- if coordinates are provided they are used as map center
- without coordinates it uses Nominatim for geocoding of address information
- downloads the OpenstreetMap raw data with the Overpass-API
- generates a Maperitive render rule based on Cadastre Style
- the houses of our contacts will be highlited and in the center of each map
- generates a Maperitive script to do the rendering
- converts svg maps with inkscape to pngs
- merges 12 pngs to a big one with ImageMagick montage and converts to Din-A4 sized pdf with ImageMagick convert
everything is dockerized to avoid the dependency hell of this outdated code
Use the template folder as starting point. Replace the addresses.csv with your addresses e.g. by saving a libreoffice calc table with the columns name, street, housenumber, postcode, city, country, optional geo position as csv file. You need to use UTF-8 encoding and a ; as delimiter. If you are familiar with Maperitive you could adjust the template as well to create custom maps.
cd preprocessor && docker build -t preprocessor . && cd ..
cd maperitive && docker build -t maperitive . && cd ..
cd postprocessor && docker build -t postprocessor . && cd ..
WORK_DIR=template
# parses addresses, looks up geo position if not present, downloads osm files for each address and prepares the maperitiv script (used for svg rendering)
# expects a mounted folder at /data containing at least 3 files () optinal it could contain cached downloads
# creates a script for Maperitive at /data/raw_svgs/Contacts.mscript (and referenced osm files)
docker run --user "$(id -u):$(id -g)" --mount type=bind,source=$(pwd)/${WORK_DIR},target=/data preprocessor
# executes the rendered maperative script and places creates svgs depending on the provided maperitive script
docker run -it --user "$(id -u):$(id -g)" --mount type=bind,source=$(pwd)/${WORK_DIR},target=/data -v /tmp/.X11-unix:/tmp/.X11-unix -v /run/user/1000/gdm/Xauthority:/root/.Xauthority -e DISPLAY=:0 --network host --privileged maperitive /data/raw_svgs/Contacts.mscript
# expects /data/
docker run -it --user "$(id -u):$(id -g)" --mount type=bind,source=$(pwd)/${WORK_DIR},target=/data postprocessor