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.
Asked
Active
Viewed 86 times
4
-
1Will pages linking to the city page work for you? – Vladimir Alexiev Dec 18 '20 at 18:33
-
Yes, I am looking for all pages that have been geotagged with coordinates that fall within the boundary of the city. Thanks – naw16 Dec 18 '20 at 19:07
-
What magnitude of articles do you expect to work with? – Tgr Dec 19 '20 at 03:49
-
I first need a list of all the articles that fall within the boundary of my study area (based on their geotags). – naw16 Dec 19 '20 at 12:20
1 Answers
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:
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
Vladimir Alexiev
- 286
- 1
- 5