Open michaelpirrello opened 4 years ago
Given an optional place to find them within (though except for the largest places, it's probably a good idea to include one), and a place type to enumerate, we can efficiently retrieve all matching places with this API call, e.g. to get all counties in Pennsylvania:
https://www.inaturalist.org/places.json?per_page=200&ancestor_id=42&place_type=county
We don't need to create Place objects for the results, but just want the ids from each record.
Here's where it gets tricky and makes me wonder if we can do the feature at all right now. With the current API we can't actually do a single API call that retrieves a place breakdown, and iterating over all places, doing one API call per place would take a significant amount of time for even modest sized data sets, being rate-limited at one API call per second per place. Even if broken into smaller sized pages it will still be several seconds to produce each page. I don't think this will be a wonderful user experience.
Since it seems we need some iNat dev help for this, unless I've overlooked some API call that already does this, I have asked about it on the forums here: https://forum.inaturalist.org/t/observation-species-counts-per-place-type-within-a-place/15775
Per original discussion in #trips-and-meetups, and subsequent discussion in #coding, implement use of ...per in order to achieve something like ,tab obs by me per where place is of a place type maintained by iNaturalist.org (continent, country, state, county).