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

Cannot create an item with epsg code set to "null" #308

Closed
mmiller8878 opened this issue Apr 19, 2021 · 1 comment · Fixed by #309
Closed

Cannot create an item with epsg code set to "null" #308

mmiller8878 opened this issue Apr 19, 2021 · 1 comment · Fixed by #309

Comments

@mmiller8878
Copy link

Ive got a geotiff in a custom CRS that does not have and epsg code. According to the docs on the projection extension, I should be able to set proj:epsg to null if I supply a wkt instead (which is what I'm doing) However, I'm getting an error when callingpystac.Catalog.validate_all().

I think the correct way to do this should be to set pystac.Item.ext.projection.epsg to None, however this does not actually set it to None, it unsets the property completely because it calls this function:

def _set_property(self, key, value, asset):

So that obviously fails the validator because proj:epsg is required.

I've also tried setting it directly to the json representation of a null value ("null"), but then the validator fails because apparently 'null' ...is not 'null':

jsonschema.exceptions.ValidationError: 'null' is not of type 'integer', 'null'


Failed validating 'type' in schema['allOf'][1]['properties']['properties']['properties']['proj:epsg']:
    {'title': 'EPSG code', 'type': ['integer', 'null']}


On instance['properties']['proj:epsg']:
    'null'

Am I missing something here/is there a better way of doing this? I can for example set the epsg code to 0 but that obviously feels wrong. I'm new to STAC so apologies if I've missed something!

@lossyrob
Copy link
Member

You haven't missed anything - it's a good catch, and exactly to spec. This is a bug, unfortunately - I believe it was introduced in PySTAC 0.5.5, so if you downgrade to 0.5.4 it might work?

This should be fixed in the next version of PySTAC, which will be an update to use STAC 1.0.0-RC3 or 4, whichever RC is out when we're ready. I can close this issue when it's fixed. Let me know if the downgrade doesn't work, or if using the next PySTAC for an RC version of the spec would be a problem. Thanks!

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 a pull request may close this issue.

2 participants