Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support jsonld for items with null geometry #1423

Merged
merged 3 commits into from
Dec 10, 2023

Conversation

doublebyte1
Copy link
Contributor

@doublebyte1 doublebyte1 commented Dec 7, 2023

Overview

Some items, like records, may have no geometry . This is throwing an error on the jsonld representation, because it always expect a geometry. This fix will avoid geometry operations over items that have a null geometry.

Related Issue / Discussion

#1422

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

Copy link
Member

@webb-ben webb-ben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think the @id needs to be outside of the if block

        # Include multiple geometry encodings
        if data.get('geometry') is not None:
            data['type'] = 'schema:Place'
            jsonldify_geometry(data)

        # Set data id
        data['@id'] = identifier

@doublebyte1
Copy link
Contributor Author

Think the @id needs to be outside of the if block

        # Include multiple geometry encodings
        if data.get('geometry') is not None:
            data['type'] = 'schema:Place'
            jsonldify_geometry(data)

        # Set data id
        data['@id'] = identifier

You are right: this was leaving the id out for geometry null items. Thanks for spotting that: fixed now!

@doublebyte1 doublebyte1 requested a review from webb-ben December 8, 2023 13:47
pygeoapi/linked_data.py Outdated Show resolved Hide resolved
@tomkralidis tomkralidis merged commit e7264e8 into geopython:master Dec 10, 2023
2 checks passed
@doublebyte1 doublebyte1 deleted the records branch December 17, 2023 03:48
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.

3 participants