NINAnor / nina-catalogue

NINA Catalogue - documentation: https://ninanor.github.io/nina-catalogue/
https://pycsw.nina.no
MIT License
0 stars 0 forks source link

Some datasets have a footprintWKT instead of latitude/longitude #7

Open nicokant opened 10 months ago

nicokant commented 10 months ago

example dataset: https://ipt.nina.no/resource?r=myrdata_historisk

nicokant commented 10 months ago

There are still problems with this dataset and pygeoapi

Pygeoapi provider OGR

{
                "type": "feature",
                "default": true,
                "name": "OGR",
                "editable": false,
                "id_field": "id",
                "layer": "data",
                "data": {
                    "source_type": "VRT",
                    "source": "/vsicurl/http://localhost:8000/datasets/72d7f10f-8c52-4714-95e8-8d66f3ac3e2c/definition.vrt"
                }
            }

definition.vrt

<OGRVRTDataSource>
    <OGRVRTLayer name="data">
      <SrcDataSource><![CDATA[
        <OGRVRTDataSource>
          <OGRVRTLayer name="event">
            <SrcDataSource>CSV:/vsizip/{/vsicurl/https://ipt.nina.no/archive.do?r=myrdata_historisk}/event.txt</SrcDataSource>
            <LayerSRS>WGS84</LayerSRS>
          </OGRVRTLayer>
          <OGRVRTLayer name="measurementorfact">
              <SrcDataSource>CSV:/vsizip/{/vsicurl/https://ipt.nina.no/archive.do?r=myrdata_historisk}/measurementorfact.txt</SrcDataSource>
              <LayerSRS>WGS84</LayerSRS>
            </OGRVRTLayer>
        </OGRVRTDataSource>]]>
      </SrcDataSource>
      <SrcSQL>select * from event join measurementorfact on measurementorfact.id=event.id</SrcSQL>

      <GeometryField encoding="WKT" field="footprintWKT" reportSrcColumn="false">
        <SRS>WGS84</SRS>
      </GeometryField>

      <LayerSRS>WGS84</LayerSRS>
    </OGRVRTLayer>
  </OGRVRTDataSource>

The VRT seems to work fine both with ogrinfo and ogr2ogr, but when using with pygeoapi it returns the following error:

metadata_catalogue-django-dev-1  | ERROR 2023-12-20 13:39:26,082 ogr 145 139993141466880 'NoneType' object has no attribute 'AssignSpatialReference'
metadata_catalogue-django-dev-1  | ERROR 2023-12-20 13:39:26,083 api 145 139993141466880 'NoneType' object has no attribute 'AssignSpatialReference'
metadata_catalogue-django-dev-1  | ERROR 2023-12-20 13:39:26,083 api 145 139993141466880 generic error (check logs)