[feature] List tags namespaces


Guillaume Lostis <g.lostis@...>
 

Hi all,

I would like to be able to list a file's namespaces for tags. I am handling files with several tag "namespaces" (default, IMAGE_STRUCTURE, and RPC for example). I want to create a "copy" of this file by copying its profile and tags, so I need to find a way to get "all" tags from the source file, by listing the namespaces available for that dataset for example.

I didn't find a way in rasterio to list its tag namespaces, but I found that there's a GDAL function that does that since GDAL 1.11.0 (see GDAL RFC43 and GDAL documentation for that function). To use that function you can for example run:
gdalinfo -listmdd file.tiff

I would like to know if someone knows a way to list tag namespaces in rasterio, and if not, if you agree that this would be a nice feature to have with something along the lines of:
with rasterio.open("file.tiff") as f:
    ns = f.get_tags_ns()

    # or ns = f.tags_ns
>> ns = ["default", "IMAGE_STRUCTURE", "RPC"]

I would have liked to propose an implementation of this myself, but my knowledge of GDAL's API and of Cython is close to zero...

Thanks,


Guillaume Lostis


vincent.sarago@...
 

Hi Guillaume,
I'm + 1 with the idea of adding this feature.

I've had the same challenge while working on rio-cogeo, if there is a GDAL API I think it could be useful to add a method in rasterio.


Vincent


vincent.sarago@...
 

I started a PR over https://github.com/mapbox/rasterio/pull/1740


Guillaume Lostis <g.lostis@...>
 

Great, thank you very much Vincent!

Guillaume Lostis