Instagram Api: getting all media in a range of coordinates

568 Views Asked by At

Is it possible to get all the media for a square of coordinates?

1

There are 1 best solutions below

2
On

You can retrieve media from Intagram's API in a given radius of a coordinate pair by performing a GET request on the /media/search endpoint.

Break up your given area into 4 quadrants, and feed the lat/long of the center of those quadrants into this API.

Then the area covered in your four GET requests would cover your given topology as follows:

enter image description here

The reasoning behind having more compact circles being placed within your quadrilateral area is because, when your points don't perfectly form a shape which have perpendicular lines, but rather a convex area, such as a trapezoid. A single simple shape in the center of your area won't cover as much area as you would like. This is evident from the image below:

enter image description here

However, if you were to have an arrangement of non-overlapping circles within your containing space, you could cover as large a proportion of the space as possible:

enter image description here

Please let me know if you have any questions!