iNat API - how to get info from polygon

My Goal: I want to get info from polygon. I mean I want to draw a lot of points (locations: latitude and longitude) and I want to make a polygon with these points (locations: latitude and longitude)and I want to get all information from iNat API about this polygon (locations: latitude and longitude)

For example, I can do this thing: https://api.inaturalist.org/v1/observations?nelat=59.84557713015031&nelng=30.21625827924274&place_id=any&subview=map&swlat=59.84409500096111&swlng=30.208108655633826 and I will have information from rectangle (4 coordinates with latitude and longitude). But I’d like to get info from any polygon (I mean I don’t want to have this information from only rectangle with 4 coordinates)

For example, I have 10 location points (I don’t want to use rectangle with 4 coordinates), and I want to make the polygon from this points and get all information with iNat API.

Problem: I know how to solve task but I don’t like my idea.

My solution: . I do the polygon, for example, with 10 locations (latitude and longitude). Then I do a rectangle and size my rectangle is bigger than my polygon (I mean polygon is inside this rectangle on iNat Map). After that I get all information from rectangle with iNat API and check every point (observation with latitude and longitude) inside rectangle if this point (observation with latitude and longitude) inside the polygon. I save all points (observations with latitude and longitude) inside polygon and I ignore all points (observations with latitude and longitude) that are outside the polygon but inside the rectangle.

It will work, but I don’t like this path. It’s too long, it’s not beautiful. Is it possible to do this task faster?

Three general options, none of them perfect. I don’t know if the API allows more complex polygons, but the below approaches will work regardless.

  1. If your polygon corresponds to a place, make that a place in iNat (respecting the usual rules/process), and download using that place.

  2. Create your polygon in GIS program of your choice. Download from the larger bounding box, import into GIS, and select those points in the polygon.

  3. Create your polygon in R. Download from the larger bounding box, import into R, and select those points in the polygon.

1 Like

it does not. you have the same options for filtering as with the Explore page – an iNat place, a box, or a circle. there’s been at least one request to add functionality to filter by a custom ad hoc area, but i haven’t heard of any movement to implement such a thing,

it may be worth explicitly mentioning that the rules include a requirement to have 50 verifiable observations before you can make a place.

there’s a fourth option, if you assume that the observations that you’re interested in will have been exported to GBIF. (for those who don’t know, iNaturalist periodically sends research grade observations which have been appropriately licensed over to GBIF.) GBIF allows filtering by a custom GeoJSON. so you could define a custom JSON and filter as needed over at GBIF. here’s a previous discussion that discusses something similar: https://forum.inaturalist.org/t/downloading-from-a-specific-inat-place-from-gbif/24259/3.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.