BästaJävlaKartan
BästaJävlaKartan | |
---|---|
Author: | Jan Dalheimer and contributors |
License: | MIT License |
Platform: | Web |
Status: | Active |
Language: | Swedish |
Website: | osm-bjk.jandal.se |
Source code: | 02JanDal/osm-bjk GitHub |
List deviations and suggested fixes, calculated based on open data sources in Sweden |
BästaJävlaKartan (or BJK, or OSM-BJK, for short, Swedish for best fucking map) is a tool that compares OpenStreetMap data against various open data sources from Sweden, and reports and deviations it finds.
Usage
Though it would likely make a good framework for automatic updates, BJK is currently only intended to be used as an indication for manual updates, and the full responsibility for these updates lay on the mapper. Most data sources are reasonable trustworthy and tag suggestions are attempted to be as correct as possible, but everything should still be checked against imagery etc.
While not implemented yet, the intention is to integrate with MapRoulette to provide a complete tasking environment.
Matching and tag suggestions
Deviation calculation essential works in three steps:
- Matching OSM objects to objects in from the upstream data sources (following the One feature, one OSM element where possible)
- Calculating suggested tags based on attributes from the upstream data source
- Filter out any matching pair where all suggested tags are already set as suggested
The exact matching criteria vary, you will find them listed under each data source below. There you will also find which tags are suggested for each deviation, though sometimes only a subset of those tags will be suggested, depending on which attributes are available.
When calculating suggested tags some consideration will be given to the existing tags on the object. For example, an object in OSM that already has contact:phone=* will get contact:email=* suggested, while an object that already has phone=* will get email=* suggested to match. Furthermore, where implemented formatting will be disregarded (so a deviation would not suggest to change a phone number from one without spaces to one with).
Architecture and code
BJK consist of four main components:
- A database (PostgreSQL with PostGIS)
- An Apache Airflow instance with several DAGs for fetching data and calculating deviations
- Two database-to-API-proxies (one for REST and one for vector tiles)
- A web frontend
The database contains one schema with OSM data, using a relatively "raw" table structure (comparable to that of the OSM main database but without history) which is synced using replication in one of the Airflow DAGs, currently once every 10 minutes. That DAG also calculates PostGIS geometries which are also stored in the database in the same tables.
A second schema in the database contains data from various upstream sources, which are also synced using Airflow DAGs.
A third schema contains the deviations and other metadata that is made available over the API.
A relatively large amount of the business logic is implemented in SQL. For example, deviations are calculated purely using SQL right now, the DAGs to recalculate them just call into SQL.
Data sources
These data sources are currently implemented:
- Gävle kommun (various)
- Uppsala kommun (various)
- Skolverket (schools)
- SCB (preschools)
- Lantmäteriets Topografiska karta 1:50 000 (various)
- Länsstyrelserna (various, currently only wind turbines)
See the page for each data source for information about matching criteria, suggested tags, etc.