pyinaturalist.response_format module¶
Helper functions for formatting API responses
- pyinaturalist.response_format.as_geojson_feature(result: Dict[str, Any], properties: Optional[List[str]] = None) → Dict[str, Any][source]¶
” Convert an individual response item to a geojson Feature object, optionally with specific response properties included.
- Parameters
result – A single response item
properties – Whitelist of specific properties to include
- pyinaturalist.response_format.as_geojson_feature_collection(results: Iterable[Dict[str, Any]], properties: Optional[List[str]] = None) → Dict[str, Any][source]¶
” Convert results from an API response into a geojson FeatureCollection object. This is currently only used for observations, but could be used for any other responses with geospatial info.
- Parameters
results – List of results from API response
properties – Whitelist of specific properties to include
- pyinaturalist.response_format.flatten_nested_params(observation: Dict[str, Any]) → Dict[str, Any][source]¶
- Extract some nested observation properties to include at the top level;
this makes it easier to specify these as properties for
as_as_geojson_feature_collection()
.
- Parameters
observation – A single observation result