DeLac
DeLac

Reputation: 1122

Filter Wikipedia geosearch per region

I saw Wikipedia API (called MediaWiki GeoData) to search wiki pages around fixed coordinates. An example call is

https://it.wikipedia.org/w/api.php?action=query&list=geosearch&gsradius=10000&gscoord=37.786971|-122.399677

I saw also that GeoData, in its Extra parameters, has also the concept of region, accepting a ISO 3166-2 region code.

How can I search elements, filtering per this region code? For example, if I am searching around some coordinates near the border between two regions, am I able to filter only the elements of one region?

Upvotes: 0

Views: 337

Answers (1)

Nemo
Nemo

Reputation: 2544

Short answer: you can't.

Longer answer: we currently lack two features which I just filed in the issue tracker for you, i.e.

For now, you'll have to do everything yourself client-side: figure out the coordinates of each region and filter by those; or search the region in Wikidata statements and then fetch corresponding articles in the language desired. As you are a developer you could also help import country data in Wikidata ;-).

(Expanded from MaxSem's answer, hence wiki.)

Upvotes: 1

Related Questions