2

I have a geographical coordinate, and I want to know what Commons images are the closest.

For instance, for 40.7576,-73.9857 I would get like 10 pictures taken in Times Square.

Is there an API that gives this?

Rather than me having to decide a rectangle and not knowing the number of results in advance, I prefer to receive like the 10 closest pictures from the given point.

The API needs to be free, and the faster the better.

  • I don't know how WikiMiniAtlas works, but the source code is here: github.com/dschwen/wikiminiatlas – Ainali Oct 21 '15 at 6:02
  • @Ainali: Thanks! Thinking about it again, I removed mentions of it because it uses the "rectangle with unknown number of results" search rather than "N pictures closest from coordinates" search. Rectangle search would be better than nothing, though. – Nicolas Raoul Oct 21 '15 at 6:33
1

The closest thing that I know is the Wikidata Query, with around and filtered for images. But it is not a perfect fit for your usecase since you need to limit by radius rather than by number of images.

Example: http://wdq.wmflabs.org/api?q=claim[18]%20AND%20around[625,40.7576,-73.9857,0.5]&props=18

The claim[18] is what specifies that you only want items with images. The &props=18 also returns the file names on Wikimedia Commons. But as you can see this query get over 50 results. Of course, you could try to reduce the radius from 0.5 km to something smaller to get fewer results, but it is not a very convenient method.

  • 1
    There is a much bigger problem: This request only returns images of places that happen to have a Wikidata item. So that's only a very tiny proportion of all available images. That means the request will be suboptimal, especially in areas with nothing very notable. Try for instance wdq.wmflabs.org/… : Zero result even though this tramway station picture is within range: en.wikipedia.org/wiki/File:Topora%C5%9Fi.jpg – Nicolas Raoul Oct 22 '15 at 8:43
  • Yes, that is perfectly right. Unfortunately, the existing coordinate data on Wikimedia Commons is not yet structured, so until then I do not know what else to do. However, that is being worked upon, so soon it might be possible to answer your query easily. – Ainali Oct 22 '15 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.