stac-utils / stac-validator

Validator for the stac-spec
Apache License 2.0
46 stars 27 forks source link

Failure when type == Feature #174

Closed jlaura closed 3 years ago

jlaura commented 3 years ago

Given the following STAC file, validation fails. Looks like the failure is because of a missing schema

``` { "type": "Feature", "stac_version": "1.0.0", "id": "D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W_DEM", "properties": { "title": "Ames Stereo Pipeline Derived 20mpp Content Camera DTM and Ortho Image; Mars; D18_034426_1877_XN_07N196W, D17_033793_1865_XN_06N196W", "description": "This is a digital terrain model (DTM) extracted from Context Camera (CTX) stereo images from the Mars Reconnaissance Orbiter mission. This data product is a DTM from stereo images acquired at approximately 6 meters/pixel resolution, which allows an output DTM resolution of 20 meters/pixel. The DTM was generated using the Ames Stereo Pipeline software (https://github.com/NeoGeographyToolkit/StereoPipeline)and using automated methods. This DTM was generated for general and public use, including scientific and engineering purposes. This DTM also serves as a foundation for ortho-projection.", "mission": "Mars Reconnaissance Orbiter", "instruments": [ "Context Camera (CTX)" ], "gsd": 20, "license": "PDDL-1.0", "proj:epsg": 49900, "proj:wkt2": "\"PROJCS[\\\"unnamed\\\",GEOGCS[\\\"D_MARS\\\",DATUM[\\\"D_MARS\\\",SPHEROID[\\\"MARS\\\",3396000,0]],PRIMEM[\\\"Reference Meridian\\\",0],UNIT[\\\"degree\\\",0.0174532925199433,AUTHORITY[\\\"EPSG\\\",\\\"9122\\\"]]],PROJECTION[\\\"Orthographic\\\"],PARAMETER[\\\"latitude_of_origin\\\",7.61971],PARAMETER[\\\"central_meridian\\\",163.679],PARAMETER[\\\"false_easting\\\",0],PARAMETER[\\\"false_northing\\\",0],UNIT[\\\"metre\\\",1,AUTHORITY[\\\"EPSG\\\",\\\"9001\\\"]],AXIS[\\\"Easting\\\",EAST],AXIS[\\\"Northing\\\",NORTH]]\"", "proj:projjson": { "$schema": "https://proj.org/schemas/v0.2/projjson.schema.json", "type": "ProjectedCRS", "name": "unknown", "base_crs": { "name": "unknown", "datum": { "type": "GeodeticReferenceFrame", "name": "unknown", "ellipsoid": { "name": "unknown", "radius": 3396000 }, "prime_meridian": { "name": "Reference meridian", "longitude": 0 } }, "coordinate_system": { "subtype": "ellipsoidal", "axis": [{ "name": "Longitude", "abbreviation": "lon", "direction": "east", "unit": "degree" }, { "name": "Latitude", "abbreviation": "lat", "direction": "north", "unit": "degree" } ] } }, "conversion": { "name": "unknown", "method": { "name": "Orthographic", "id": { "authority": "EPSG", "code": 9840 } }, "parameters": [{ "name": "Latitude of natural origin", "value": 7.61971, "unit": "degree", "id": { "authority": "EPSG", "code": 8801 } }, { "name": "Longitude of natural origin", "value": 163.679, "unit": "degree", "id": { "authority": "EPSG", "code": 8802 } }, { "name": "False easting", "value": 0, "unit": "metre", "id": { "authority": "EPSG", "code": 8806 } }, { "name": "False northing", "value": 0, "unit": "metre", "id": { "authority": "EPSG", "code": 8807 } } ] }, "coordinate_system": { "subtype": "Cartesian", "axis": [{ "name": "Easting", "abbreviation": "E", "direction": "east", "unit": "metre" }, { "name": "Northing", "abbreviation": "N", "direction": "north", "unit": "metre" } ] } }, "proj:bbox": [ 163.412121713001, 7.31411901028742, 163.94688769192, 7.92600146373682 ], "proj:centroid": { "lat": 7.62006023701212, "lon": 163.67950470246052 }, "proj:shape": [ 1801, 1561 ], "proj:transform": [ -15570, 20, 0, 18070, 0, -20 ], "cube:dimensions": { "x": { "type": "spatial", "axis": "x", "extent": [ 163.412121713001, 163.94688769192 ] }, "y": { "type": "spatial", "axis": "y", "extent": [ 7.31411901028742, 7.92600146373682 ] } }, "ssys:targets": [ "Mars" ], "datetime": "2021-01-01T00:00:00Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 163.412121713001, 7.31411901028742 ], [ 163.412121713001, 7.92600146373682 ], [ 163.94688769192, 7.92600146373682 ], [ 163.94688769192, 7.31411901028742 ], [ 163.412121713001, 7.31411901028742 ] ] ] }, "links": [{ "rel": "self", "href": "https://asc-mars.s3-us-west-2.amazonaws.com/ctx_dtms/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W_DEM.json", "type": "application/json" }, { "rel": "parent", "href": "https://asc-mars.s3.us-west-2.amazonaws.com/ctx_dtms/collection.json", "type": "application/json" }, { "rel": "root", "href": "https://asc-mars.s3.us-west-2.amazonaws.com/catalog.json", "type": "application/json" }, { "rel": "collection", "href": "https://asc-mars.s3.us-west-2.amazonaws.com/ctx_dtms/collection.json", "type": "application/json" } ], "assets": { "thumbnail": { "href": "https://asc-mars.s3-us-west-2.amazonaws.com/ctx_dtms/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W_DEM.jpg", "type": "image/jpeg", "title": "DEM Thumbnail", "key": "thumbnail", "roles": [ "thumbnail" ] }, "dem": { "href": "https://asc-mars.s3-us-west-2.amazonaws.com/ctx_dtms/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W_DEM.tif", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "title": "DEM", "key": "dem", "roles": [ "data" ] }, "hillshade": { "href": "https://asc-mars.s3-us-west-2.amazonaws.com/ctx_dtms/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W_HILLSHADE.tif", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "title": "Hillshade", "key": "hillshade", "roles": [ "data" ] }, "ortho image": { "href": "https://asc-mars.s3-us-west-2.amazonaws.com/ctx_dtms/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W_ORTHO.tif", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "title": "Orthoimage", "key": "ortho image", "roles": [ "data" ] }, "fgdc_metadata": { "href": "https://asc-mars.s3-us-west-2.amazonaws.com/ctx_dtms/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W_DEM.xml", "type": "application/xml", "title": "FGDC Metadata", "key": "fgdc_metadata", "roles": [ "metadata" ] }, "qa_metric": { "href": "https://asc-mars.s3-us-west-2.amazonaws.com/ctx_dtms/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W/qa_metrics.txt", "type": "text/plain", "title": "Quality Assurance Metrics", "key": "qa_metric", "roles": [ "metadata" ] }, "intersection_err": { "href": "https://asc-mars.s3-us-west-2.amazonaws.com/ctx_dtms/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W_IntersectionErr.tif", "type": "image/tiff; application=geotiff", "title": "ASP generated intersection error raster", "key": "intersection_err", "roles": [ "metadata", "data-mask" ] }, "provenance": { "href": "https://asc-mars.s3-us-west-2.amazonaws.com/ctx_dtms/D18_034426_1877_XN_07N196W__D17_033793_1865_XN_06N196W/provenance.txt", "type": "text/plain", "title": "Processing steps in ISIS and ASP used to generate the data product", "key": "provenance", "roles": [ "metadata" ] } }, "bbox": [ 163.412121713001, 7.31411901028742, 163.94688769192, 7.92600146373682 ], "stac_extensions": [ "https://stac-extensions.github.io/projection/v1.0.0/schema.json", "https://stac-extensions.github.io/datacube/v1.0.0/schema.json" ], "collection": "ctx_dtms" } ```

Running: $ stac_validator stac.json I am seeing the following error:

[
    {
        "version": "1.0.0",
        "path": "stac.json",
        "schema": [
            "https://schemas.stacspec.org/v1.0.0/feature-spec/json-schema/feature.json"
        ],
        "valid_stac": false,
        "error_type": "ValueError",
        "error_message": "Expecting value: line 1 column 1 (char 0)"
    }
]

Navigating to https://schemas.stacspec.org/, I do not see the feature-spec anywhere in the file listing.

jonhealy1 commented 3 years ago

@jlaura try pasting your stac in https://staclint.com (it passes there) - staclint is built from stac validator running in a lambda on aws - I will try to figure out why you are getting an error

jonhealy1 commented 3 years ago

This is the response I get with stac-validator - maybe you are using an older version?


[
    {
        "version": "1.0.0",
        "path": "stac.json",
        "schema": [
            "https://stac-extensions.github.io/projection/v1.0.0/schema.json",
            "https://stac-extensions.github.io/datacube/v1.0.0/schema.json",
            "https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json"
        ],
        "valid_stac": true,
        "asset_type": "ITEM",
        "validation_method": "default"
    }
]
jlaura commented 3 years ago

here is my version information:

➜ stac_validator --version
stac_validator, version 2.2.0

I also tried messing with the text file formatting (after validating via jsonlint) with a newline at the end, just a '{' at the head, etc. Very strange that we are seeing different results!

jonhealy1 commented 3 years ago

weird yea - I'm using 2.2.0 too - did you try on https://staclint.com ?

jlaura commented 3 years ago

@jonhealy staclint works wonderfully. Super nice. I am going to try to get stac_validator into my CI pipeline and see if maybe it is this machine that is causing issues. Want me to close the issue since it seems really localized to this env?

Thanks for the quick reply and the support.

jonhealy1 commented 3 years ago

@jlaura ok sounds good thanks