[gdal-dev] ogrtindex, gdaltindex feature request

Even Rouault even.rouault at spatialys.com
Fri Nov 1 13:54:42 PDT 2024


Not directly addressing your suggestion, but as an alternative, there's 
https://github.com/stac-utils/stac-geoparquet and the GTI driver in 
3.10.0 can use them directly: 
https://gdal.org/en/latest/drivers/raster/gti.html#stac-geoparquet-support

$ ogrinfo 
/vsicurl/https://github.com/stac-utils/stac-geoparquet/raw/main/tests/data/naip.parquet 
-al -q

Layer name: naip
OGRFeature(naip):0
   type (String) = Feature
   stac_version (String) = 1.0.0
   stac_extensions (StringList) = 
(2:https://stac-extensions.github.io/eo/v1.0.0/schema.json,https://stac-extensions.github.io/projection/v1.0.0/schema.json)
   id (String) = ok_m_3409901_nw_14_1_20100425
   bbox (RealList) = (4:-100.004084,34.934259,-99.933454,35.00323)
   links (String(JSON)) = 
[{"href":"https:\/\/planetarycomputer.microsoft.com\/api\/stac\/v1\/collections\/naip","rel":"collection","title":null,"type":"application\/json"},{"href":"https:\/\/planetarycomputer.microsoft.com\/api\/stac\/v1\/collections\/naip","rel":"parent","title":null,"type":"application\/json"},{"href":"https:\/\/planetarycomputer.microsoft.com\/api\/stac\/v1\/","rel":"root","title":null,"type":"application\/json"},{"href":"https:\/\/planetarycomputer.microsoft.com\/api\/stac\/v1\/collections\/naip\/items\/ok_m_3409901_nw_14_1_20100425","rel":"self","title":null,"type":"application\/geo+json"},{"href":"https:\/\/planetarycomputer.microsoft.com\/api\/data\/v1\/item\/map?collection=naip&item=ok_m_3409901_nw_14_1_20100425","rel":"preview","title":"Map 
of item","type":"text\/html"}]
   assets.image.eo:bands (String(JSON)) = 
[{"common_name":"red","description":null,"name":"Red"},{"common_name":"green","description":null,"name":"Green"},{"common_name":"blue","description":null,"name":"Blue"},{"common_name":"nir","description":"near-infrared","name":"NIR"}]
   assets.image.href (String) = 
https://naipeuwest.blob.core.windows.net/naip/v002/ok/2010/ok_100cm_2010/34099/m_3409901_nw_14_1_20100425.tif
   assets.image.roles (StringList) = (1:data)
   assets.image.title (String) = RGBIR COG tile
   assets.image.type (String) = image/tiff; application=geotiff; 
profile=cloud-optimized
   assets.rendered_preview.href (String) = 
https://planetarycomputer.microsoft.com/api/data/v1/item/preview.png?collection=naip&item=ok_m_3409901_nw_14_1_20100425&assets=image&asset_bidx=image%7C1%2C2%2C3
   assets.rendered_preview.rel (String) = preview
   assets.rendered_preview.roles (StringList) = (1:overview)
   assets.rendered_preview.title (String) = Rendered preview
   assets.rendered_preview.type (String) = image/png
   assets.thumbnail.href (String) = 
https://naipeuwest.blob.core.windows.net/naip/v002/ok/2010/ok_100cm_2010/34099/m_3409901_nw_14_1_20100425.200.jpg
   assets.thumbnail.roles (StringList) = (1:thumbnail)
   assets.thumbnail.title (String) = Thumbnail
   assets.thumbnail.type (String) = image/jpeg
   assets.tilejson.href (String) = 
https://planetarycomputer.microsoft.com/api/data/v1/item/tilejson.json?collection=naip&item=ok_m_3409901_nw_14_1_20100425&assets=image&asset_bidx=image%7C1%2C2%2C3
   assets.tilejson.roles (StringList) = (1:tiles)
   assets.tilejson.title (String) = TileJSON with default rendering
   assets.tilejson.type (String) = application/json
   collection (String) = naip
   gsd (Real) = 1
   datetime (DateTime) = 2010/04/25 00:00:00+00
   naip:year (String) = 2010
   proj:bbox (RealList) = (4:408377,3866212,414752,3873800)
   proj:epsg (Integer64) = 26914
   naip:state (String) = ok
   proj:shape (Integer64List) = (2:7588,6375)
   proj:transform (RealList) = (9:1,0,408377,0,-1,3873800,0,0,1)
   POLYGON ((-99.933454 34.934815,-99.93423 35.00323,-100.004084 
35.002673,-100.00325 34.934259,-99.933454 34.934815))

etc.


Le 01/11/2024 à 21:44, Scott via gdal-dev a écrit :
> The whole, new GTI format got by me until Michael Sumner mentioned it 
> on slack, which I visit extremely rarely. (Thanks Michael). I've been 
> doing it in an entirely different way. The feature request is based on 
> that.
>
> The feature request is this:
>
>    gdaltindex -co GDALINFO=mymeta catalog.fgb *.tif
> or
>    ogrtindex -co OGRINFO=mymeta catalog.fgb *.shp
>
> This says, create an attribute in the .fgb file called 'mymeta' and 
> populate it with the equivalent of 'ogrinfo -json' or 'gdalinfo 
> -json'. Or perhaps:
>
>    gdaltindex -co GDALSTATS=mymeta catalog.fgb *.tif
>
> Which is equivalent to 'gdalinfo -json -stats -hist'
>
> I've been doing this as a 2 step process, but it would be really cool 
> to have it all integrated. I have many raster/vector files of 
> different formats in a single catalog.gpkg and catalog.fgb. I can 
> easily filter any by bbox, type or stats.
>
> Why?
>
> If you're grabbing your data from an .fgb file on S3/web server 
> without an intermediate server or service, using a bbox, it's painless 
> to get exactly the data you need. Further, you have access to all the 
> attributes, stats, min, max, stddev for filtering *before* you request 
> the actual data.
>
> If you don't like cloud native or .fgb and want to access your data 
> via an API, create your catalog as a .gpkg. Create custom attributes 
> for filtering and indexes on those attributes, json meta data, etc, 
> and throw it behind an API.
>
> With a catalog.gpkg you can have all your rasters/vectors in the same 
> catalog.gpkg and ogr2ogr to an .fgb. Anytime you update/upsert your 
> .gpkg, recreate the .fgb.
>
> As awesome as STAC is, it's becoming increasingly complex and very 
> slow with large data sets. Compare that to an -sql query on a single 
> catalog.gpkg (particularly with spatialite).
>
> If you've made it this far, thanks for listening!
>
> Scott
>
-- 
http://www.spatialys.com
My software is free, but my time generally not.
Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.



More information about the gdal-dev mailing list