Skip to content

kartenkarsten/addresses2maps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

addresses2maps

parses an addressbook (csv-file) to render a small OSM-map (4.5cm x 9.5cm 300dpi) of some contacts This is the rendered map from the example vcard

Usecase

You want awesome table name cards on your next anniversary

Features

  • 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

Dependencies

everything is dockerized to avoid the dependency hell of this outdated code

Usage

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.

build images

cd preprocessor && docker build -t preprocessor . && cd ..
cd maperitive && docker build -t maperitive . && cd ..
cd postprocessor && docker build -t postprocessor . && cd ..

render svg

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

About

parse a vcard to render a small map of each contact

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published