gdal icon indicating copy to clipboard operation
gdal copied to clipboard

Add API methods for retrieving alternative names and comments for dataset layers

Open nyalldawson opened this issue 2 years ago • 7 comments

Draft only, for feedback at this stage...

The intention is that these would be the layer-level equivalents of the OGR field alternative name / comment properties.

Eg the geopackage driver could retrieve these from the gpkg_contents table fields identifier and description columns respectively, and the postgres driver could retrieve table comments from which have been set via a COMMENT ON ... query.

nyalldawson avatar Apr 26 '23 06:04 nyalldawson

Nice!

elpaso avatar Apr 26 '23 07:04 elpaso

Why not putting those methods in the OGRLayer class ? (timing wise, I'm not sure this will be able to make it for 3.7)

rouault avatar Apr 29 '23 09:04 rouault

timing wise, I'm not sure this will be able to make it for 3.7

That's no problem -- it's not client funded work, there's no urgency for this one 👍

nyalldawson avatar Apr 29 '23 23:04 nyalldawson

@rouault

Resurrecting this old work :laughing:

Why not putting those methods in the OGRLayer class ?

I'm thinking that raster containers could potentially require this too (eg a raster in a GPKG, or potentially a raster in a filegeodatabase)

nyalldawson avatar Nov 16 '23 23:11 nyalldawson

I'm thinking that raster containers could potentially require this too

maybe, but GDALDataset::GetLayerAlternativeName(layer_index) doesn't look very natural to me. OGRLayer::GetAlternativeName() would feel more natural. One could potentially even imagine that AlternativeName and Comment should be members of OGRFeatureDefn (similarly to OGRFieldDefn), although I'm 50% 50% on doing that compared to having them at the OGRLayer level

rouault avatar Nov 16 '23 23:11 rouault

@rouault could/should we do both? Have the low level method for raster use, and a nicer API for vector?

nyalldawson avatar Nov 16 '23 23:11 nyalldawson

Have the low level method for raster use

what do you think exactly ? Technically a GDALDataset, as a raster, is for a single raster layer, so that would be a GetComment() / GetAlternativeName(). For subdatasets, you need to GDALOpen() each subdataset and call GetComment()/GetAlternativeName() on it.

rouault avatar Nov 16 '23 23:11 rouault

closing that one as staled

rouault avatar Apr 17 '24 16:04 rouault