Maps/Linking wikipedia to OSM/Overpass with Mediawiki API

From Bjoern Hassler's website
Jump to: navigation, search

I basically wanted to fix some stuff in both OSM and Wikipedia, creating links between the two, and fixing issues. So I needed a tool that could display both, and I couldn't find out. I looked at leaflet, and various plugins, and started to build the first version like this. However, because I wanted to query OSM data and display complex OSM data, the best solution seemed to be to actually start from overpass turbo seemed (as it already does overpass api queries). So I added the wikipedia plugin to overpass (rather than starting from scratch with leaflet).

1 'mwapi' moustache ag[edit]

The overpass turbo commands are extended by a moustache tag called 'mwapi', which currently allows a geosearch

{{mwapi: 
 de;geosearch
}}

which runs this API query (using the bounds of the overpass view) [1]

Alternative a category search can be done:

{{mwapi:
 de;category;Kategorie:Archäologischer_Fundplatz_auf_Menorca
}}

which takes points from this api query: [2]

The idea is that these can be combined, e.g. as

{{mwapi: 
en;geosearch
de;geosearch
de;category;Kategorie:Archäologischer_Fundplatz_auf_Menorca
}}

e.g. enabling quick switching.

2 Code[edit]

I've pushed my code to here: https://github.com/bjohas/overpass-ide/tree/mastermwapi. However, overpass-turbo changed the way libraries work since I downloaded the code, so at the moment the code in the repo isn't functional.

The code uses

NOTE: The code doesn't work. I unfortunately downloaded the previous version that all all the includes in index.html, rather than index.js, so it wasn't trivial for me to get it going again. Instead, I've just cloned the new master branch, and then added my files. This means you can see them, and I can see how to integrate them. I've included files with "original" in the name, to show which versions I worked from. This is so that you can diff them, and see the approach. This is clear VERY ROUGH AND READY, and not production code.

Also see https://github.com/tyrasd/overpass-turbo/issues/286.

3 MW API vs. SPARQL[edit]

Also see discussion here: https://www.wikidata.org/wiki/User:Bjohas/Request_a_query

4 Screenshot[edit]

Overpass with Mediawiki API 01.png

The overlay at the bottom (over the map) shows some stats, and also allows switching between different wikipedias, which is useful, as an integrated search is more difficult (i.e. not possible with a single query.