How to use iNaturalist's Search URLs - wiki - part 2 of 2

Thanks all. If you’re wondering why I asked, I made a pretty complex ID URL for this post and then thought to myself, actually, if I were to use this URL for identifying I would prefer to see the reverse result.

1 Like

I agree this would be very useful for clearing out ‘state of matter: life’ observations; there is absolutely no way I can help with any of the 100s of pages of microscope images of things where people who know about that stuff have disagreed about the kingdom. I can also imagine other kinds of applications, like filtering for just 1 of 2 common mis-IDs about a species, for example if the mis-IDs occur at different life stages and therefore requires a different mental frame for deciding.

Hi there!

I’m trying to get all my observations except those annotated as dead (field 17, value 19). Here’s what I tried:

https://www.inaturalist.org/observations?place_id=any&user_id=jocateme&without_term_id=17&without_term_value_id=19

However, this excludes not only observations annotated as dead (field 17, value 19), but all observations with any annotation in field 17, including alive (value 18). In practice, it returns the same observations as if I omit without_term_value_id:

https://www.inaturalist.org/observations?place_id=any&user_id=jocateme&without_term_id=17

Based on this example:

I also tried this:

https://www.inaturalist.org/observations?place_id=any&user_id=jocateme&term_id=17&without_term_value_id=19

But it returns all observations that have any annotation in field 17, regardless of value (i.e., without_term_value_id makes no difference again).

(By the way, the same is true for the quoted example. The link does not exclude observations with plant phenology annotation “flowering”, but rather returns all observations with any plant phenology annotation.)

Any idea on how I can get all my observations except those annotated as dead?

Thank you!

EDIT:

Omitting without_term_id and keeping without_term_value_id doesn’t work either:

https://www.inaturalist.org/observations?place_id=any&user_id=jocateme&without_term_value_id=19

It returns all observations.

i don’t think it’s possible in the Explore page…

you could export all your observations and then manually exclude the ones with a dead annotation.

another thing i can think of is to leverage the API. since you don’t have that many observations of dead things, you could get a list of those observation ids:
https://api.inaturalist.org/v1/observations?user_id=jocateme&term_id=17&term_value_id=19&per_page=100&only_id=true
or
https://jumear.github.io/stirfry/iNatAPIv1_observations.html?user_id=jocateme&term_id=17&term_value_id=19&per_page=100

then get all your observations, excluding that list of ids:
https://jumear.github.io/stirfry/iNatAPIv1_observations.html?user_id=jocateme&not_id=98442834,95707204,92519136,92015178,89354266,89353761,66390103,66390061,63139581,63136752,58643588,53646998,38301162,38257121,37136241,27170243,22426045,20069154,19490756,19402355,18777631,18760245,18317383,17419615,17419614,17419611,17419608,17195527,17187438,16908269,15641815,15218148,15218129,15209450,15187654,15133903,14997370,14977924,14953358,14953347,14953325,14953319,14951468,14951467,14899037,14891020,14889329,14888927,14751763,14734603,14734600,14734590,14734586,14734584,14656871,14656869,14656867,14656863,14656862,14643009,14558962,14558959,14558958,14558954,14558949,14505916,14505906,14481455,14406114,14359961,14359955,14078107,14078100,13134784,12928707,12928110,12928103,12928099,12836770,12834348,12831717,12759538,12759523,12759493,12759491,12759476,12759425,12729224,12729210,12716412,12709007,12707674,12707663,12707230,12690259,12690257

I think the first solution will work great. I am using these search terms via API as part of a shiny app (https://jocateme.shinyapps.io/manaca/), so I think it will be pretty straightforward to identify and delete observations with a dead annotation.

The second solution might not work that well because anyone can use the shinyapp, so I have no control over how many observations of dead organisms the user has (might be too many to fit in the URL).

That’s very helpful. Thanks, @pisum!

EDIT

Actually, on a second thought I think I’m more inclined to give the second solution a try, because it would be easier to integrate the shiny app with the iNaturalist species view. Do you by any chance know if there’s a limit to how many observations I can exclude using the “not_id=” term? Is there maybe a character limit for the URL?

just based on a cursory search for not_id in the iNat repo in Github, it looks like maybe 750 obs. i did a quick test to exclude 600 obs via not_id, and it worked as expected.

if you’re doing things at a user level, i think that would cover 99.9% of users, since i wouldn’t expect most people to have more than 750 observations of dead stuff.

maybe by the time there are people who have accumulated that many observations, the API will have been updated so that the exclusion filters parameters for annotations work better.

1 Like

I think you’re absolutely right! This should definitely do the trick for now. I’ve already updated the codes in the shiny app and it’s working like a charm. Thank you!

1 Like

In the ID-modul, filtering for an umbrella project, is it possible to exclude observations from a certain project?
E.g.: global/national CNC-results, but w/o one specific CNC-region? (it is working when using not_in_place, but some CNC-regions consist of several iNat-places, which makes it more difficult)

yes, you can use not_in_project, e.g. this is observations in the CNC 2021 project, excluding the CNC 2021 Cape Town project: https://www.inaturalist.org/observations/identify?project_id=82727&not_in_project=92187

1 Like

Thanks Jane,
I had used without_project_id and not_project_id to no avail, so I thought it was not possible. Just tested and it works as it should :+1:t3:

1 Like

It would have been much better for us if staff had thought to go with a consistent format for search by exclusion URL terms. For example the opposite of place_id= should unquestionably be without_place_id= rather than &not_in_place=.

I often find myself doing what you did, trying and failing to guess what the correct term might be, and then having to come back here to look it up on the tutorial.

3 Likes

The plurals are also a problem. It’s super silly taxon_id= becomes taxon_ids= if you want to list more than one, but user_id= and place_id= remain unchanged.

4 Likes

Is there a way to find the taxa that iNaturalist automatically marks as “captive”? I notice a lot of people who post non-captive observations of those species don’t realize it’s been made casual, and it’d be nice to have an easy way to look through them without having to go through all the user-marked captive things.

not that I know of, but there’s a feature request: https://forum.inaturalist.org/t/find-observations-the-system-voted-as-not-wild/5070/

3 Likes

Another search question! So I made a very nice, detailed search URL and I’d like to download the results as a CSV, but the download ends up not being filtered to just the things that come up in my search. Am I doing something wrong here?

https://www.inaturalist.org/observations?iconic_taxa=Plantae&place_id=2764&rank=species&subview=map&taxon_id=211194&unobserved_by_user_id=graysquirrel&view=species&geoprivacy=open&taxon_geoprivacy=open&without_taxon_id=158615,802543,47162,168025

It should have 2938 observations of 719 species, but when I try to download it it has 120,215 observations that don’t appear to be filtered at all.

Export doesn’t handle all the parameters that Explore does. In this case, it looks like it’s throwing out unobserved_by_user_id and three of your four without_taxon_ids.

When I use &not_user_id= with my username it only excludes my observations after I changed the name, if I use id number, it excludes everything, I don’t know if it’s a bug or feature?

I see URL search strings as having an important and useful utility. Unfortunately, I lack the basic programming knowledge to use that utility. Writing project note, I wanted to highlight a number of observations with a subset of observation field values. The search URL “https://www.inaturalist.org/observations?place_id=any&taxon_id=68632&verifiable=any&field:Elevation%20(ft)=” was written with the intent to specify observations at the highest elevations. The field is a numeric value field and should be governed by numeric rules. The command “&field:Elevation%20(ft)=” returns all observations with that field. I was unable to modify the command to return observations that exceeded a certain value. Can any one suggest a syntax that modifies the command?

True, but that’s not exactly how the iNat search queries work, at least not the ones available to us. It’s looking for exact matches, not doing comparisons or evaluations. Depending on how the database is architected those types of numerical comparisons could potentially use significantly more processing power. It would be nice to be able to do it someday.

Hello, I have been playing with the search for annotations feature to look for life stages. It works really well on the observations side of iNat. When I try to go to the species tab, however, it does not show me photos of the life stage grouped by species, it just shows the main picture for the species. I am looking for this feature because I think it would be easy to just get the grid to show the different species I am looking into at the life stage of my choosing.
Let me know if there is a way do to this :) Thanks!

On observations tab - notice the repeated Asian Lady Beetle observations:

The species tab - just shows the species by main photo regardless of the URL: