Talk:SPARQL examples

From OpenStreetMap Wiki
Jump to: navigation, search

Cross check elevations

For some reason there's some pretty inconsistent data out there: vs.

or: vs. vs.

SELECT ?osmId ?ele ?ele_wikidata ?delta_ele ?loc ?wd ?distance WHERE {
  BIND (0.01 as ?radius)

  ?osmId osmm:type ?osmType .
  ?osmId osmt:ele ?ele .
  ?osmId osmt:natural "peak" .

  ?osmId osmm:loc ?center .

  # find all wikidata items in the close proximity
  SERVICE wikibase:around {
    ?wd wdt:P625 ?loc .
    bd:serviceParam wikibase:center ?center .
    bd:serviceParam wikibase:radius ?radius .
  ?wd wdt:P2044 ?ele_wikidata.

  # Calculate distance between OSM's and WD's
  BIND(geof:distance(?center, ?loc) as ?distance).
  BIND( ABS(xsd:float(?ele) - xsd:float(?ele_wikidata)) AS ?delta_ele).
  FILTER (xsd:integer(?ele) > 0).
  FILTER (?delta_ele > 0).

Run it (edit query)

mmd, the first example seems like a duplicate - first is properly maintained, and the second one only links to sv and ceb wikis - both known as "botopedia" rather than "wikipedia". They need to be merged, keeping the bigger ones. I would ignore the ceb & sv values outright - likely junk pulled from some weird source, but you never know, it is possible in theory that they have better data. The second one is the same thing, and even ceb wiki has the right elevation - 2240, but for some reason the wikidata for it was incorrect. Also - need to merge with the italian one, making the italian default. --Yurik (talk) 09:35, 1 October 2017 (UTC)