Geonovum / ogc-api-testbed

OGC API Testbed Template - Stable
https://apitestbed.geonovum.nl
GNU General Public License v3.0
4 stars 4 forks source link

Add data and config to pygeoapi for CRS and INSPIRE support #50

Open justb4 opened 1 year ago

justb4 commented 1 year ago

Adding GPKG and remote PDOK WFS and firx from Sandbox instance.

justb4 commented 1 year ago

In the Sandbox the Feature Provider to get SU data from PDOK SU INSPIRE Harmonized WFS was not configured right. The configuration always requires a root WFS URL, not a "GetFeature" request, nor any other output than GML.

In order to fetch from a WFS backend in GeoSON AND to filter "sublayers" like only "gemeenten 2016" one can configure an OGR Driver of type "GeoJSON". This driver accepts both a file or a remote URL. Probably less efficient but one can also apply filtering in the WFS request. The modified config will have like:

    StatisticalUnits_Gemeente_2017_WFS:
        type: collection
        title: StatisticalUnits_Gemeente_2017_WFS
        description: In deze dataset zijn de begrenzingen opgenomen van Nederlandse Gemeenten uit 2017. De gegevens in de dataset zijn conform INSPIRE geharmoniseerd en uit PDOK su-vector WFS.
        keywords:
            - statistiek
            - Gemeenten
        links:
            - type: text/html
              rel: describedby
              title: Metadata as HTML
              href: https://www.nationaalgeoregister.nl/geonetwork/srv/dut/catalog.search#/metadata/10d1153e-778f-4995-9b6c-7c69b196cccb
              hreflang: nl
.
.
.
            - type: application/gml+xml
              rel: enclosure
              title: Download volledige dataset als GML
              href: https://geodata.nationaalgeoregister.nl/su-vector/wfs?request=GetFeature&version=2.0.0&typeNames=su-vector:SU.VectorStatisticalUnit&CQL_FILTER=tessellation_localid=%27gemeente.2017%27
              hreflang: nl
        extents:
            spatial:
                bbox: [3.10, 50.50, 7.60, 53.80]
                crs: http://www.opengis.net/def/crs/OGC/1.3/EPSG:4326
            temporal:
                begin: 2017-01-01T00:00:01Z  # start datetime in RFC3339                                                                                             f
                end: 2017-12-31T23:59:59Z  # end datetime in RFC3339
        providers:
            - type: feature
              name: OGR
              data:
                  source_type: GeoJSON
                  source: https://geodata.nationaalgeoregister.nl/su-vector/wfs?request=GetFeature&version=2.0.0&typeNames=su-vector:SU.VectorStatisticalUnit&CQL_FILTER=tessellation_localid=%27gemeente.2017%27&outputFormat=application/json
                  source_srs: EPSG:4326
                  target_srs: EPSG:4326
              gdal_ogr_options:
                EMPTY_AS_NULL: NO
                GDAL_CACHEMAX: 64
                CPL_DEBUG: NO
              id_field: localid
              title_field: geographicalname
              layer: OGRGeoJSON

Especially the last segment here: using source_type: GeoJSON, as source a filtered WFS request (using CQL here but could also be standard WFS Property Filter), and outputFormat=application/json. For OGR this is now a regular GeoJSON endpoint. The other "trick", as there is no Layer, is to set: layer: OGRGeoJSON. GeoServer will already transsform from EPSG:4258 (ETRS89) to EPSG:4326. But we may apply crs with pygeoapi later.