Archaeology/Linking OSM and Wikipedia

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

Using various approaches (building on the OSM and WIkipedia APIs) I've looked at correlating entries in OSM and Wikipedia. See e.g. here for a grease/tampermonkey script Maps/Linking wikipedia to OSM, as well as my wikipedia user pages (https://en.wikipedia.org/wiki/User:Bjohas, https://de.wikipedia.org/wiki/Benutzer:Bjohas).

1 Overpass[edit]

The following map shows archaeological objects on OSM. The objects are coloured green if a corresponding wikipedia entry exists, yellow otherwise. (Not the colouring doesn't work perfectly, see [1]).

1.1 Map[edit]

You can use this ready-made map.

Interactive map: [2]

1.2 overpass query[edit]

Or you can run this query on http://overpass-turbo.eu

[out:json][timeout:25];
{{geocodeArea:"Balearic Islands"}}->.a;
// Select everything that has a wikidata tag
(
  node["historic"="archaeological_site"]["wikidata"~".*"](area.a);
  way["historic"="archaeological_site"]["wikidata"~".*"](area.a);
  relation["historic"="archaeological_site"]["wikidata"~".*"](area.a);
);
// recurse up to catch rels/ways containing tagged ways/node
(._; <;);
// recurse down to get full objects
(._; >;)->.wikidata;
(.wikidata;);
out meta qt;
(
  node["historic"="archaeological_site"](area.a);
  way["historic"="archaeological_site"](area.a);
  relation["historic"="archaeological_site"](area.a);
);
(._; <;);
(._; >;)->.all;
(.all; - .wikidata;);
//(.wikidata;);
out meta qt;
// in MapCSS use "text: name;" to add name;
{{style:
  node, way, relation {
  text: ;
  color:blue; fill-color:yellow;
  }
node[wikidata], way[wikidata], relation[wikidata], relation[wikidata] node, relation[wikidata] way, relation[wikidata] relation {
color:green; fill-color:green;
text: ;
}
}}

2 Improved query[edit]

2.1 changes[edit]

Slightly rewritten query to rationalise. This query also shows all "historic" objects. Insert "historic"="..." for specific objects, or use "~" for regexp, e.g. "archaeological|tomb|monument" etc.

The query collects both objects tagged with wikidata and wikipeda , but colours them differently. (Same limitations for colouring apply as above.)

Depending on which line you comment out:

// Display all - wikidata
//(.all; - .wikidata;);
// Display wikidata only
// (.wikidata;);
// Display all
(.all;);

you can either display

  • Data that is not referred to in wikipedia (all - wikidata)
  • Just data referred to in wikipedia (wikidata)
  • Or simply all data (all).

2.2 map[edit]

You can use these ready-made maps.

All historic objects: [3]

Just archaeological sites and tombs: [4]

2.3 query[edit]

Or you can run this query on http://overpass-turbo.eu

[out:json][timeout:25];
{{geocodeArea:"Balearic Islands"}}->.a;
// Get primary data in the area
(
  node["historic"](area.a);
  way["historic"](area.a);
  relation["historic"](area.a);
)->.p;
// Produce full version of primary data
// recurse up to catch rels/ways containing tagged ways/node
(.p; <;);
// recurse down to get full objects
(.p; >;)->.all;
// Select everything that has a wikidata/wikipedia tag
(
  node.p["wikidata"];
  way.p["wikidata"];
  relation.p["wikidata"];
  node.p["wikipedia"];
  way.p["wikipedia"];
  relation.p["wikipedia"];
);
// again: recurse up/down
(._; <;);
(._; >;)->.wikidata;
// Display all - wikidata
//(.all; - .wikidata;);
// Display wikidata only
// (.wikidata;);
// Display all
(.all;);
out meta qt;
// in MapCSS use "text: name;" to add name;
{{style:
node, way, relation {
  text: ;
  color:red; fill-color:yellow;
}
way, relation {
  text: ;
  color:red; fill-color:red;
}
node[wikipedia], way[wikipedia], relation[wikipedia], relation[wikipedia] node, relation[wikipedia] way, relation[wikipedia] relation {
color:green; fill-color:yellow;
text: ;
}
node[wikidata], way[wikidata], relation[wikidata], relation[wikidata] node, relation[wikidata] way, relation[wikidata] relation {
color:green; fill-color:green;
text: ;
}
}}
// Note: Where a way or node is tagged rather than the relationship, the colouring doesn't work.

3 also see[edit]

Maps/Linking wikipedia to OSM