Skip to content

OGR provider doesn't work with usgs waterdata endpoint #230

Description

@C-Loftus

Putting this here just for posterity

      - type: feature
        name: OGR
        data:
          source_type: OAPIF
          source: OAPIF:https://api.waterdata.usgs.gov/ogcapi/v0/
        id_field: id
        layer: monitoring-locations
[2025-12-15T14:39:47Z] {/Users/cloftus/github/WWDH/.venv/lib/python3.12/site-packages/pygeoapi/provider/ogr.py:379} ERROR - 'NoneType' object has no attribute 'AssignSpatialReference'
[2025-12-15T14:39:47Z] {/Users/cloftus/github/WWDH/.venv/lib/python3.12/site-packages/pygeoapi/api/__init__.py:590} ERROR - generic error (check logs)
Traceback (most recent call last):
  File "/Users/cloftus/github/WWDH/.venv/lib/python3.12/site-packages/pygeoapi/provider/ogr.py", line 363, in query
    result = self._response_feature_collection(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cloftus/github/WWDH/.venv/lib/python3.12/site-packages/pygeoapi/provider/ogr.py", line 577, in _response_feature_collection
    json_feature = self._ogr_feature_to_json(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cloftus/github/WWDH/.venv/lib/python3.12/site-packages/pygeoapi/provider/ogr.py", line 526, in _ogr_feature_to_json
    geom.AssignSpatialReference(None)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'AssignSpatialReference'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/cloftus/github/WWDH/.venv/lib/python3.12/site-packages/pygeoapi/api/itemtypes.py", line 546, in get_collection_items
    content = p.query(offset=offset, limit=limit,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cloftus/github/WWDH/.venv/lib/python3.12/site-packages/pygeoapi/provider/ogr.py", line 380, in query
    raise ProviderGenericError(err)
pygeoapi.provider.base.ProviderGenericError: 'NoneType' object has no attribute 'AssignSpatialReference'
INFO:     127.0.0.1:57016 - "GET /collections/usgs-monitoring-locations/items?f=jsonld HTTP/1.1" 500 Internal Server Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions