-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: SubdatasetInfo #8155
API: SubdatasetInfo #8155
Conversation
@rouault I'd like a general review of the API before I get through all the formats, for now the only implemented one is GPKG. I will also probably need a list of the drivers that support subdatasets. |
@rouault I agree there is a little confusion in the terminology, here is my proposal to clarify and avoid ambiguity: The complete file name (e.g. The parsed components will be named:
So, the methods will become: GetFileName() -> returns the original complete file name e.g. Or, the shorter versions without |
or maybe GetSuffix() ? |
I don't follow: isn't subdataset more appropriate to describe it? Suffix is really generic and if we have variables it might not even be the last component in the descriptor. |
ok, let's keep GetSubdataset(). "There are only two hard things in Computer Science: cache invalidation and naming things. " :-) |
e57c11c
to
df1227d
Compare
|
||
// GDALSubdatasetInfo interface | ||
private: | ||
void parseFileName() override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about the opportunity of using this in the GTiffDataset::OpenDir() method to avoid duplication of parsing ? (this could apply to other drivers as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a look, I prefer a method that does not have to open the file though, ideally this API should just manipulate strings without I/O overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer a method that does not have to open the file though, ideally this API should just manipulate strings without I/O overhead.
yes, totally agreed. I mean to update the existing Open() methods to use the new parseFileName()
{ | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a more esoteric supported variant: GTIFF_DIR:off:<dir_offset>:filename
If we reused this class for GTiffDataset::OpenDir(), we'd have to support it
I don't know where the colon separator comes from, but I totally agree that it's a poor choice, the QGIS counterpart QgsDatasourceUri is a little bit better engineered, for most datasources it uses URL encoding for the KVP and it allows to encode the opening options. |
@sgillies Before my involvement with the project. I can see that this syntax was already used in the initial version of the HDF4 driver back in 2002: 7c56e20797c17d2bcb3f173d652ec1fdf590d558 @elpaso I believe to keep this PR manageable we should target the most popular file-based drivers that use subsdataset (others might follow in subsequent PR): netCDF, HDF4, HDF5, GPKG . Anything else ? |
Yeah.
I have actually already implemented WMS and PostGIS raster because I wanted to test the API with a DB and a webservice. I will proceed according to your priority list. |
acab4ab
to
2481e97
Compare
@rouault here is another iteration. I have removed the double quotes from the logic by storing both the original unmodified path (used only internally to modify the path) and I am storing isQuoted to determine if the new path should be quoted (if it is already quoted it is not quoted twice). When returning the path it is always unquoted and unescaped. I have added a few new test cases. |
@sgillies Do you think we can merge this PR or do you want the RFC you mention in https://lists.osgeo.org/pipermail/gdal-dev/2023-September/057641.html to be a pre-condition for it ? |
@elpaso Can you rebase on top of latest master and fix conflict in autotest/gdrivers/netcdf.py? |
Co-authored-by: Even Rouault <even.rouault@spatialys.com>
Co-authored-by: Even Rouault <even.rouault@spatialys.com>
Co-authored-by: Even Rouault <even.rouault@spatialys.com>
Co-authored-by: Even Rouault <even.rouault@spatialys.com>
2cd9a69
to
1f63b55
Compare
done |
Fix #7261
Initial GDALSubdatasetInfo API.