4

For a research purpose how can I extract geotagged wiki data (containing page id or titles for articles that refer to particular geolocation) for a city in England.

Orophile
  • 1,751
  • 4
  • 11
  • 30
naw16
  • 41
  • 1

1 Answers1

1

Cities only have point geometry, so how do you define the "boundary"? Taking https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries#Places_within_1_km_of_the_Arc_de_Triomphe_(Q64436) as an example, here are Wikidata entries within 1 km of London:

https://w.wiki/yrX

SELECT ?place ?placeLabel ?page ?location ?dist WHERE
{
  wd:Q84 wdt:P625 ?loc .
  SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?loc .
      bd:serviceParam wikibase:radius "1" .
  }
  optional {?page schema:about ?place; schema:isPartOf <https://en.wikipedia.org/>}
  BIND(geof:distance(?loc, ?location) as ?dist)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} order by ?dist

Note: without OPTIONAL the query times out, not sure why, posted bug: https://phabricator.wikimedia.org/T274519