Search code examples
apiinstagraminstagram-apibounding-box

How to extract images inside the bounding box using Instagram API?


I'm trying to collect all images from a specific location, for example Tokyo. I manages to create a bounding box which gave me the following results

(50.607041876988994, -1.3187316344406208, 52.40735812301099, 1.5737316344406207)

Main problem is, what do I do next? What do each of these figure represent and how would I plot these if I were to use them for coding?

All I want is to use this bounding box and within it collect all images from Instagram. I was wondering if anyone can write a short pseudo code, or any language code.


Solution

  • Using this stackoverflow answer you can calculate the center of bounding box: Calculate the center point of multiple latitude/longitude coordinate pairs

    • which is 51.51608899635712, 0.09891956707558282

    You can then calculate distance between the center and corner of bounding box: Function to calculate distance between two coordinates shows wrong

    • which comes to about 141km

    using gramfeed, you can search instagram by location with a lat,lng and a radius, here are the resulting posts that are within the bounding box, it may have some extra posts outside the bounding box since instagram api searches within a circular area, if you want you can further filter the posts one by one for accuracy.

    Here are the instagram posts within the bounding box: http://www.gramfeed.com/instagram/map#/51.5165,0.0999/200/-