BästaJävlaKartan

From OpenStreetMap Wiki
Jump to navigation Jump to search
BästaJävlaKartan
BastaJavlaKartan first page.png
Author: Jan Dalheimer and contributors
License: MIT License
Platform: Web
Status: Active
Language: Swedish
Website: osm-bjk.jandal.se
Source code: 02JanDal/osm-bjk

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:

  1. Matching OSM objects to objects in from the upstream data sources (following the One feature, one OSM element where possible)
  2. Calculating suggested tags based on attributes from the upstream data source
  3. 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:

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:

See the page for each data source for information about matching criteria, suggested tags, etc.