← Back to the blog

Geotagged Image Gallery

The original idea was to recreate Google maps' image gallery (see below) and modify it in such a way that images are not filtered by lat/long of screen-bounds, but time of year and topic.

 

The geo-tagged image data is directly queried on topic and time from the Wikidata database. For example, this is a API call going out for year "1222" with variance set to 10 , on topic "people":

http://wdq.wmflabs.org/api?q=BETWEEN[569,1212,1232]%20AND%20claim[18]%20AND%20claim[19]%20&props=31,18,19

Explanation:

BETWEEN[569,1212,1232]:
tagged as date of birth from 1212 to 1232

claim[18]:
data entry must have image attached

claim[19]: 
data entry must have place of birth attached

props=31,18,19:
list the following properties directly in the response: instance of (31) and image (18) and place of birth (19)

 

Using the item identifer (here: 2719051), we query the wikipedia link:

https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q2719051&props=sitelinks&languages=en&format=json

the coordinates we get by querying the location identifier extracted from the original query under props 19 (here: 12225):

http://wdq.wmflabs.org/api?q=ITEMS[12225]&props=625

and for the image URL, we extract the image title from the original query under props 18 (here: "Ibn Sab'in.png") and query:

https://commons.wikimedia.org/w/api.php?action=query&titles=File%3AIbn Sab'in.png&prop=imageinfo&iiurlwidth=260&iiurlheight=400&iiprop=url%7Csize&format=json

 

We iterate through the found item list (up to the set limit of images), query all required fields as seen above and add each new element to the gallery. On mouse over, we add a pointer line from the image to the location where we create a dot marker. On mouse leave event, those two are removed again.

You can display all those pointer lines and dot markers of every visible image by clicking the "show all" button as seen in the image on top of this article.

Be the first to reply