diff --git a/pygeoapi/provider/postgresql.py b/pygeoapi/provider/postgresql.py index 44842cdfc..9657df817 100644 --- a/pygeoapi/provider/postgresql.py +++ b/pygeoapi/provider/postgresql.py @@ -108,6 +108,14 @@ def __init__(self, provider_def): LOGGER.debug(f'ID field: {self.id_field}') LOGGER.debug(f'Geometry field: {self.geom}') + # conforming to the docs: + # https://docs.pygeoapi.io/en/latest/data-publishing/ogcapi-features.html#connection-examples # noqa + self.storage_crs = provider_def.get( + 'storage_crs', + 'https://www.opengis.net/def/crs/OGC/0/CRS84' + ) + LOGGER.debug(f'Configured Storage CRS: {self.storage_crs}') + # Read table information from database options = None if provider_def.get('options'): @@ -416,7 +424,7 @@ def _feature_to_sqlalchemy(self, json_data, identifier=None): # NOTE: for some reason, postgis in the github action requires # explicit crs information. i think it's valid to assume 4326: # https://portal.ogc.org/files/108198#feature-crs - srid=4326 + srid=pyproj.CRS.from_user_input(self.storage_crs).to_epsg() ) attributes[self.id_field] = identifier