This commit is contained in:
parent
78e1b0187d
commit
54021f5f68
3 changed files with 42 additions and 5 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 s3lph
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
17
README.md
17
README.md
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
Generate a map similar to https://www.ccc.de/regional from Wikidata and the doku.ccc.de Semantic MediaWiki data.
|
Generate a map similar to https://www.ccc.de/regional from Wikidata and the doku.ccc.de Semantic MediaWiki data.
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
./generate_map.py --update-erfalist
|
||||||
|
```
|
||||||
|
|
||||||
![Map as generated by this tool](map.readme.png)
|
![Map as generated by this tool](map.readme.png)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
@ -45,6 +52,14 @@ A run without cache takes some time as it fetches all data from their sources:
|
||||||
|
|
||||||
**Use the cache at least for the country and state borders. Otherwise, Wikidata will start rate limiting pretty quickly.**
|
**Use the cache at least for the country and state borders. Otherwise, Wikidata will start rate limiting pretty quickly.**
|
||||||
|
|
||||||
## Fonts
|
## License
|
||||||
|
|
||||||
|
Unless otherwise noted, the contents of this repository are licensed under the MIT License (See LICENSE).
|
||||||
|
|
||||||
|
### Fonts
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
### Geoshape Data
|
||||||
|
|
||||||
|
The geoshape data contained in `cache.example` is in the public domain.
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# https://git.kabelsalat.ch/s3lph/erfamap
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
@ -34,10 +36,6 @@ class CachePaths:
|
||||||
self.chaostreff_info = os.path.join(path, 'chaostreff-info.json')
|
self.chaostreff_info = os.path.join(path, 'chaostreff-info.json')
|
||||||
|
|
||||||
|
|
||||||
#BOUNDING_BOX = [(4.27775, 46.7482713), (19.2403594, 54.9833021)]
|
|
||||||
# --bbox 4.27775 46.7482713 19.2403594 54.9833021
|
|
||||||
|
|
||||||
|
|
||||||
ERFA_URL = 'https://doku.ccc.de/Spezial:Semantische_Suche/format%3Djson/limit%3D50/link%3Dall/headers%3Dshow/searchlabel%3DJSON/class%3Dsortable-20wikitable-20smwtable/sort%3D/order%3Dasc/offset%3D0/-5B-5BKategorie:Erfa-2DKreise-5D-5D-20-5B-5BChaostreff-2DActive::wahr-5D-5D/-3FChaostreff-2DCity/-3FChaostreff-2DPhysical-2DAddress/-3FChaostreff-2DPhysical-2DHousenumber/-3FChaostreff-2DPhysical-2DPostcode/-3FChaostreff-2DPhysical-2DCity/-3FChaostreff-2DCountry/mainlabel%3D/prettyprint%3Dtrue/unescape%3Dtrue'
|
ERFA_URL = 'https://doku.ccc.de/Spezial:Semantische_Suche/format%3Djson/limit%3D50/link%3Dall/headers%3Dshow/searchlabel%3DJSON/class%3Dsortable-20wikitable-20smwtable/sort%3D/order%3Dasc/offset%3D0/-5B-5BKategorie:Erfa-2DKreise-5D-5D-20-5B-5BChaostreff-2DActive::wahr-5D-5D/-3FChaostreff-2DCity/-3FChaostreff-2DPhysical-2DAddress/-3FChaostreff-2DPhysical-2DHousenumber/-3FChaostreff-2DPhysical-2DPostcode/-3FChaostreff-2DPhysical-2DCity/-3FChaostreff-2DCountry/mainlabel%3D/prettyprint%3Dtrue/unescape%3Dtrue'
|
||||||
|
|
||||||
CHAOSTREFF_URL = 'https://doku.ccc.de/Spezial:Semantische_Suche/format%3Djson/limit%3D50/link%3Dall/headers%3Dshow/searchlabel%3DJSON/class%3Dsortable-20wikitable-20smwtable/sort%3D/order%3Dasc/offset%3D0/-5B-5BKategorie:Chaostreffs-5D-5D-20-5B-5BChaostreff-2DActive::wahr-5D-5D/-3FChaostreff-2DCity/-3FChaostreff-2DPhysical-2DAddress/-3FChaostreff-2DPhysical-2DHousenumber/-3FChaostreff-2DPhysical-2DPostcode/-3FChaostreff-2DPhysical-2DCity/-3FChaostreff-2DCountry/mainlabel%3D/prettyprint%3Dtrue/unescape%3Dtrue'
|
CHAOSTREFF_URL = 'https://doku.ccc.de/Spezial:Semantische_Suche/format%3Djson/limit%3D50/link%3Dall/headers%3Dshow/searchlabel%3DJSON/class%3Dsortable-20wikitable-20smwtable/sort%3D/order%3Dasc/offset%3D0/-5B-5BKategorie:Chaostreffs-5D-5D-20-5B-5BChaostreff-2DActive::wahr-5D-5D/-3FChaostreff-2DCity/-3FChaostreff-2DPhysical-2DAddress/-3FChaostreff-2DPhysical-2DHousenumber/-3FChaostreff-2DPhysical-2DPostcode/-3FChaostreff-2DPhysical-2DCity/-3FChaostreff-2DCountry/mainlabel%3D/prettyprint%3Dtrue/unescape%3Dtrue'
|
||||||
|
@ -74,6 +72,9 @@ def fetch_geoshapes(target, shape_urls):
|
||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(url) as resp:
|
with urllib.request.urlopen(url) as resp:
|
||||||
shape = json.load(resp)
|
shape = json.load(resp)
|
||||||
|
if not shape.get('license', 'proprietary').startswith('CC0-'):
|
||||||
|
# Only include public domain data
|
||||||
|
continue
|
||||||
candidates.setdefault(item, []).append(shape)
|
candidates.setdefault(item, []).append(shape)
|
||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
Loading…
Reference in a new issue