Skip to content

Fix crash on json-ld generation regarding collection's CRS#1558

Closed
IvanSanchez wants to merge 1 commit into
geopython:masterfrom
IvanSanchez:patch-1
Closed

Fix crash on json-ld generation regarding collection's CRS#1558
IvanSanchez wants to merge 1 commit into
geopython:masterfrom
IvanSanchez:patch-1

Conversation

@IvanSanchez
Copy link
Copy Markdown

Overview

Found during the OGC/OSGeo/ASF codesprint in Évora. Briefly discussed in person with @tomkralidis.

While generating a json-ld document in my test instance (running master as of 2024-02-28, f4c2ff9), there's an error like

  File "..../pygeoapi/linked_data.py", line 138 in jsonldify_collection
    hascrs84 = crs.endswith('CRS84')
               ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'endswith'

During runtime, the collection dict received by jsonldify looks like:

{
        (snip)
  "extent": {
    "spatial": {
      "bbox": [343500.0, 4401700.0, 519700.0, 4572100.0],
      "grid": [
        { "cellsCount": 881, "resolution": 200.0 },
        { "cellsCount": 852, "resolution": 200.0 },
      ],
    },
    "temporal": { "interval": [[None, None]] },
  },
  "crs": ["http://www.opengis.net/def/crs/OGC/1.3/25830"],
};

So, by changing crs = spatial_extent.get('crs') into crs = collection.get('crs')[0] makes the problem go away.

Since I'm not a pygeoapi expert, I'm not 100% sure that the collection dict is supposed to look like this.

Related issue / discussion

Additional information

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

@IvanSanchez
Copy link
Copy Markdown
Author

Superseded by #1561

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant