Skip to content

vislupus/csv-to-geojson-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Converting CSV to GeoJSON

MIT license Python Version

Overview

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.

Features

  • 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

Built With

  • Flesk
  • Jinja2
  • Vanilla JavaScript
  • Bootstrap
  • Leaflet

Usage

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.

About

Flask application for converting csv file to GeoJSON.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published