erfamap/README.md

74 lines
2.9 KiB
Markdown
Raw Normal View History

2022-10-08 21:17:31 +02:00
# erfamap
2022-10-12 02:48:14 +02:00
Generate a map for https://www.ccc.de/regional from Wikidata, Nominatim and the doku.ccc.de Semantic MediaWiki data.
2022-10-08 21:17:31 +02:00
2022-10-09 02:26:47 +02:00
## TL;DR
```
pip3 install -r requirements.txt
2022-10-09 22:55:49 +02:00
export DOKU_CCC_DE_BASICAUTH=username:password
2022-10-27 01:11:13 +02:00
./generate_map.py --rename 'Frankfurt am Main' 'Frankfurt' --update-erfalist
2022-10-12 02:48:14 +02:00
ls -al out/
2022-10-09 02:26:47 +02:00
```
2022-10-08 21:54:41 +02:00
![Map as generated by this tool](map.readme.png)
2022-10-08 21:19:06 +02:00
2022-10-08 21:49:20 +02:00
## Installation
1. Create a Python virtualenv: `python3 -m virtualenv venv`
1. Enable the virtualenv: `. venv/bin/activate`
1. Install the dependencies: `pip install -r requirements.txt`
Instead of following these steps, you could also install the dependencies from your OS' package manager.
2022-10-08 21:17:31 +02:00
## Usage
For a quick test run, point the script at the cache.example directory:
```
./generate_map.py --cache-directory cache.example
```
2022-10-12 02:48:14 +02:00
This creates the following files in `out/`:
- `map.svg` is the map as a SVG image, with clickable links.
- `map.png` is the map as a PNG image.
- `imagemap.html` includes map.png, along with a HTML image map that makes the dots and labels clickable.
- `erfamap.html` includes map.svg, with map.png and an imagemap as fallback.
- `style/` contains the stylesheet and font.
2022-10-08 21:44:19 +02:00
2022-10-08 21:49:20 +02:00
**If the wrong font is used in the PNG, make sure the chosen font is installed on your system.** ([CairoSVG](https://cairosvg.org/) does not support the use of `@font-face` in style sheets.)
2022-10-08 21:44:19 +02:00
Usually you'll want to keep the border cache, but renew the Erfa & Chaostreff list from time to time:
```
./generate_map.py --update-erfalist
```
For this, you need to provide the HTTP Basic Auth credentials to doku.ccc.de via an environment variable:
2022-10-08 21:44:19 +02:00
```
export DOKU_CCC_DE_BASICAUTH=username:password
```
A run without cache takes some time as it fetches all data from their sources:
1. Get a list of countries in Europe and federal states in Germany from [Wikidata](https://wikidata.org).
1. Download all these countries' and states' border shapes from Wikimedia Commons.
1. Get a list of Erfas & Chaostreffs from the doku.ccc.de Semantic Mediawiki API.
1. Resolve all POIs' (Erfas & Chaostreffs) street addresses' to geocoordinates using [Nominatim](https://nominatim.org/), rate limited to 1 request per second as per Nominatims usage policy.
2022-10-08 21:17:31 +02:00
2022-10-27 01:11:13 +02:00
**Use the cache whenevery you don't need to update country borders or hackerspace locations. Otherwise, both Wikidata and Nominatim will start rate limiting pretty quickly.** (And caching is actually required by [Nominatim's acceptable use policy](https://operations.osmfoundation.org/policies/nominatim/)).
2022-10-08 21:49:20 +02:00
2022-10-09 02:26:47 +02:00
## License
Unless otherwise noted, the contents of this repository are licensed under the MIT License (See LICENSE).
### Fonts
2022-10-08 21:17:31 +02:00
2022-10-08 21:44:19 +02:00
The font contained in `style/concertone-regular.ttf` was created by Johan Kallas (johankallas@gmail.com) and is licensed unter the terms of the SIL Open Font License v1.10.
2022-10-09 02:26:47 +02:00
### Geoshape Data
The geoshape data contained in `cache.example` is in the public domain.