Function Repository Resource:

INaturalistImport

Source Notebook

Import iNaturalist data

Contributed by: Jofre Espigule-Pons

ResourceFunction["INaturalistImport"][fname]

imports the CSV file fname into a dataset using semantics for iNaturalist data specifications.

ResourceFunction["INaturalistImport"][fname,properties]

includes the specified properties in the dataset.

Details and Options

The value of properties can be a single property name, a list of property names or All.
The fname is assumed to be a CSV file downloaded from iNaturalist.org. With an iNaturalist account, such CSV files can be downloaded from the exporter.
ResourceFunction["INaturalistImport"] has the same options as Dataset.
In ResourceFunction["INaturalistImport"][fname,properties], the following properties can be retrieved if available:
"ObservationID"the ID of the observation (default)
"ObservationDateString"the date of the observation as a string
"ObservationDate"the date of the observation
"TimeObservedAt"the time of the observation
"TimeZone"the time zone
"OutOfRange"out of range
"UserID"the user ID
"UserLogin"the user login
"CreatedAt"date when the observation was created
"UpdatedAt"date when the observation was last updated
"QualityGrade"the quality grade of the observation (default)
"License"the license of the observation data
"ObservationURL"the URL of the observation
"ImageURL"the URL of the main image (default)
"SoundURL"the URL of the recorded sound
"TagList"the list of tags associated to the observation
"Description"the description of the observation added by the user
"IDPlease"indicates whether the observation needs identification
"IdentificationAgreements"the number of identification agreements
"IdentificationDisagreements"the number of identification disagreements
"CaptiveCultivated"indicates wheter the animal or plant of the observation was captive or cultivated
"OauthApplicationId"the OAuth application ID
"PlaceGuess"the place guess
"GeoPosition"the GeoPosition of the observation
"Latitude"the latitude coordinate
"Longitude"the longitude coordinate
"PositionalAccuracy"the positional accuracy
"PrivatePlaceGuess"the private place guess name
"CoordinatesObscured"indicates wheter the observation has coordinates obscured
"Geoprivacy"the geoprivacy of the location of the observation
"TaxonGeoprivacy"the taxon geoprivacy
"PrivateLatitude"the private latitude
"PrivateLongitude"the private longitude
"PrivatePositionalAccuracy"the private positional accuracy
"PositioningMethod"the positioning method
"PositioningDevice"the positioning device
"Town"the place town name
"County"the county name
"Country"the country name
"PlaceAdmin1"the administrative place 1
"PlaceAdmin2"the administrative place 2
"SpeciesGuess"the species guess
"ScientificName"the scientific name
"CommonName"the common name
"IconicTaxonName"the iconic taxon name
"IconicTaxonEntity"the iconic taxon entity
"TaxonID"the taxon ID
"TaxonKingdom"the taxon kingdom name
"TaxonPhylum"the taxon phylum name
"TaxonSubphylum"the taxon subphylum name
"TaxonSuperclass"the taxon superclass name
"TaxonClass"the taxon class name
"TaxonSubclass"the taxon subclass name
"TaxonSuperorder"the taxon superorder name
"TaxonOrder"the taxon order name
"TaxonSuborder"the taxon suborder name
"TaxonSuperfamily"the taxon superfamily name
"TaxonFamily"the taxon family name
"TaxonSubfamily"the taxon subfamily name
"TaxonSupertribe"the taxon supertribe name
"TaxonTribe"the taxon tribe name
"TaxonSubtribe"the taxon subtribe name
"TaxonGenus"the taxon genus name
"TaxonGenushybrid"the taxon genushybrid name
"TaxonSpecies"the taxon species name
"TaxonHybrid"the taxon hybrid name
"TaxonSubspecies"the taxon subspecies name
"TaxonVariety"the taxon variety name

Examples

Basic Examples (3) 

Create a local file from iNaturalist data:

In[1]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/14d2c0d2-45d1-4a5f-bee7-913905d0b816"]
Out[1]=

Import the data, adding semantics:

In[2]:=
ResourceFunction["INaturalistImport"][file]
Out[2]=

Import from a public URL and retrieve specific properties:

In[3]:=
ResourceFunction[
 "INaturalistImport"]["https://www.wolframcloud.com/obj/jofree/iNaturalist/my_observations.csv", {"ObservationDate", "Country", "IconicTaxonEntity", "QualityGrade"}]
Out[3]=

Get a dataset with all available properties:

In[4]:=
ResourceFunction[
 "INaturalistImport"]["https://www.wolframcloud.com/obj/jofree/iNaturalist/my_observations.csv", All]
Out[4]=

Neat Examples (2) 

Geographic tick distribution (1) 

Make a distribution map of the most observed tick species in the United States:

In[5]:=
ticksData = ResourceFunction["INaturalistImport"][
   "https://www.wolframcloud.com/obj/jofree/iNaturalist/US_Ticks_iNat_observations.csv"];
In[6]:=
mainTickSpecies = {"Dermacentor variabilis", "Dermacentor occidentalis", "Ixodes scapularis", "Ixodes pacificus", "Amblyomma americanum", "Amblyomma maculatum"};
In[7]:=
colors = Table[ColorData[3, "ColorList"][[i]], {i, 2, 7}];
In[8]:=
positionsSpecies[species_String] := DeleteMissing[
  Normal@ticksData[
    Select[#["ScientificName"] == species && #["QualityGrade"] == "research" &], "GeoPosition"]]
In[9]:=
Labeled[GeoGraphics[
  Join[{{EdgeForm[{LightGray, Thin, Opacity[0.8]}], White, Polygon[EntityList[
       EntityClass["AdministrativeDivision", "AllUSStatesPlusDC"]]]}},
    MapThread[{#1, PointSize[0.006], Opacity[0.6], Point@positionsSpecies[#2]} &, {colors, mainTickSpecies}]],
  GeoBackground -> GeoStyling["Satellite", Opacity[0.8]],
  GeoRangePadding -> {None, Full},
  GeoRange -> Entity["Country", "UnitedStates"],
  ImageSize -> 750], {SwatchLegend[colors, mainTickSpecies], Style["Distribution of main US Tick Species", FontFamily -> "Helvetica", FontSize -> 26]}, {Right, Top}]
Out[9]=

Explore tick seasonality in the US with DateHistogram (1) 

Use DateReduction to see in which months the presence of ticks are higher:

In[10]:=
observationDates = DeleteMissing@
   Flatten@Values@
     Normal@ResourceFunction["INaturalistImport"][
       "https://www.wolframcloud.com/obj/jofree/iNaturalist/US_Ticks_iNat_observations.csv", "ObservationDate"];
In[11]:=
DateHistogram[observationDates, "Month", DateReduction -> "Year", ColorFunction -> "AvocadoColors", ImageSize -> Large]
Out[11]=

Publisher

Jofre Espigule-Pons

Version History

  • 1.0.0 – 02 July 2020

Related Resources

License Information