OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.92k stars 2.56k forks source link

GTI: make the driver work with STAC GeoParquet files that don't have a assets.image.href field #11319

Open rouault opened 1 day ago

rouault commented 1 day ago

Fixes #11317

Note that this fixes the GTI issue only. But https://planetarycomputer.microsoft.com/api/stac/v1/collections/io-lulc-annual-v02/items/60L-2017 references files such as https://ai4edataeuwest.blob.core.windows.net/io-lulc/io-annual-lulc-v02/60L_20170101-20180101.tif that require authentication, and the driver has no clue how to do that

scottyhq commented 1 day ago

references files such as https://ai4edataeuwest.blob.core.windows.net/io-lulc/io-annual-lulc-v02/60L_20170101-20180101.tif that require authentication, and the driver has no clue how to do that

At least for planetary computer data there is already an environment variable for url signing... but not sure at first glance of an existing way to either modify asset hrefs on the fly or apply environment variable settings to the items within a catalog rather than the catalog itself?

GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR \
VSICURL_PC_URL_SIGNING=YES \
gdalinfo /vsicurl/https://ai4edataeuwest.blob.core.windows.net/io-lulc/io-annual-lulc-v02/60L_20170101-20180101.tif
rouault commented 23 hours ago

At least for planetary computer data there is already an environment variable for url signing

Doh, I almost forgot I code that thing... ok, so putting all pieces together:

$ GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR VSICURL_PC_URL_SIGNING=YES AZURE_STORAGE_ACCOUNT=pcstacitems AZURE_STORAGE_SAS_TOKEN=`curl -s https://planetarycomputer.microsoft.com/api/sas/v1/token/pcstacitems/items | jq -r '.token'` gdalinfo GTI:/vsiaz/items/io-lulc-annual-v02.parquet  -oo SRS=EPSG:4326
Driver: GTI/GDAL Raster Tile Index
Files: none associated
Size is 112521, 51274
Coordinate System is:
GEOGCRS["WGS 84",
    ENSEMBLE["World Geodetic System 1984 ensemble",
        MEMBER["World Geodetic System 1984 (Transit)"],
        MEMBER["World Geodetic System 1984 (G730)"],
        MEMBER["World Geodetic System 1984 (G873)"],
        MEMBER["World Geodetic System 1984 (G1150)"],
        MEMBER["World Geodetic System 1984 (G1674)"],
        MEMBER["World Geodetic System 1984 (G1762)"],
        MEMBER["World Geodetic System 1984 (G2139)"],
        MEMBER["World Geodetic System 1984 (G2296)"],
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]],
        ENSEMBLEACCURACY[2.0]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    USAGE[
        SCOPE["Horizontal component of 3D system."],
        AREA["World."],
        BBOX[-90,-180,90,180]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-180.000000000000000,84.032571314409978)
Pixel Size = (0.003199422625477,-0.003199422625477)
Corner Coordinates:
Upper Left  (-180.0000000,  84.0325713) (180d 0' 0.00"W, 84d 1'57.26"N)
Lower Left  (-180.0000000, -80.0146244) (180d 0' 0.00"W, 80d 0'52.65"S)
Upper Right ( 180.0022332,  84.0325713) (180d 0' 8.04"E, 84d 1'57.26"N)
Lower Right ( 180.0022332, -80.0146244) (180d 0' 8.04"E, 80d 0'52.65"S)
Center      (   0.0011166,   2.0089735) (  0d 0' 4.02"E,  2d 0'32.30"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Palette
  NoData Value=0
coveralls commented 20 hours ago

Coverage Status

coverage: 73.708% (+0.007%) from 73.701% when pulling 316c8a4f33e1c4f5b19efb2022c8af41d02be9ae on rouault:fix_11317 into 5a7aac3e76f17c70f8eee1080ee120bb8fc0a6fc on OSGeo:master.