A simple application built with Flask and Vanilla JavaScript for converting Wikidata table to GeoJSON code. The code is ready for use in MediaWiki extension Kartographer, which add map capability to the Wikipedia pages.
- Converting CSV table to GeoJSON code
- Showing data on an HTML table preview
- Preview of the coordinates on a Leaflet map
- Beautify and minimize GeoJSON code
- Automatically adding color and icon to the GeoJSON markers
- Flesk
- Jinja2
- Vanilla JavaScript
- Bootstrap
- Leaflet
The first step is to go to Wikidata Query Service and prepare a SPARQL query similar to
SELECT DISTINCT ?item ?itemLabel ?page_title ?image ?coordinate_location WHERE {
?item (wdt:P31/(wdt:P279*)) wd:Q2232001;
wdt:P17 wd:Q219.
?article schema:about ?item;
schema:isPartOf <https://bg.wikipedia.org/>;
schema:name ?page_title .
?item rdfs:label ?LabelBG filter (lang(?LabelBG) = "bg") .
OPTIONAL { ?item wdt:P18 ?image. }
OPTIONAL { ?item wdt:P625 ?coordinate_location. }
MINUS { ?item wdt:P576 _:b1. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "bg". }
}ORDER BY (?itemLabel)
The columns must be named: item | itemLabel | page_title | image | coordinate_location and when the date is ready for use is exported to CSV file.
The second step is to go to this website, upload the file and pick the color and icon for the markers.