Last week I had the chance to learn how Wikidata can be queried. Wikidata is the open database that feeds all Wikipedia pages. The language that is used to get data from this database is called SPARQL. It is like SQL but instead of relations, the main focus is on joins. This is a query example to obtain a list of all disputed territories and their coordinates:

SELECT DISTINCT ?disputedLabel ?lat ?long 
  ?disputed wdt:P31 wd:Q15239622 .
  ?disputed p:P625 ?location .
  ?location psv:P625 ?coordinates .
  ?coordinates wikibase:geoLatitude ?lat .
  ?coordinates wikibase:geoLongitude ?long .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .

There are many good places to start learning SPARQL. This great blog post from Nikolai Janakiev is a nice starting point, and you can then learn more about the language in this Youtube video. But basically you need to structure your query in triples following a semantic order, kind of a sentence. You can try yourself. On the one hand, you can copy and paste this API call url on your browser. And, on the other, you can use the Wikidata query editor.

The second part of the challenge was developing a basic app to visualize the results on both a map and a table. For this project, I decided not to use React and MUI combo and coded everything in vanilla JS. I added a couple of bottoms with deeplinks to go to two Planet’s apps to check archive imagery or task a satellite to get new captures. Of course, this last option is only available for Planet tasking customers.

This could be a great PoC for something more elaborated to be used by my colleagues at marketing or collection planning. Besides all design improvements that are needed, a file export and another option to POST an order to the Tasking API.