GPX#

pyinaturalist_convert.gpx

Convert observations to GPX tracks or waypoints.

Extra dependencies: gpxpy

Example:

>>> from pyinaturalist import get_observations
>>> from pyinaturalist_convert import to_gpx

>>> results = get_observations(
...     project_id=36883,         # ID of the 'Sugarloaf Ridge State Park' project
...     created_d1='2020-01-01',  # Get observations from January 2020...
...     created_d2='2020-09-30',  # ...through September 2020
...     geo=True,                 # Only get observations with coordinates
...     geoprivacy='open',        # Only get observations with public coordinates
...     page='all',               # Paginate through all response pages
... )
>>> to_gpx(results, '~/tracks/observations-36883.gpx')
pyinaturalist_convert.gpx.to_gpx(observations, filename=None, waypoints=False)#

Convert a list of observations to a GPX track (default) or a set of GPX waypoints.

Parameters:
Return type:

Optional[GPX]

Returns:

GPX object (if no filename is provided). See gpxpy for more usage details.

pyinaturalist_convert.gpx.to_gpx_point(observation, waypoints=False)#

Convert a single observation to a GPX point

Parameters:
  • observation (Dict[str, Any]) – JSON observation

  • track – Indicates that this point is part of an ordered GXP track; otherwise, assume it is an unordered waypoint

Return type:

Optional[Location]