Opened 8 years ago
Closed 5 years ago
#6531 closed enhancement (wontfix)
Switching search order of datum.csv and gdal_datum.csv
Reported by: | Kurt Schwehr | Owned by: | Kurt Schwehr |
---|---|---|---|
Priority: | normal | Milestone: | closed_because_of_github_migration |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description
For setups where GDAL_PREFIX is not defined, having the search for datum.csv before the search for gdal_datum.csv causes the system to look through all the options in cpl_csv.cpp... including /usr/local/share/epsg_csv/ For setups were gdal is only allowed to access white listed dirs/files (or it's killed), this means I'd have to add /usr/local/share/epsg_csv/ to the list even though it doesn't exist (I stash them in a per container location). Rather than remove /usr/local/share/epsg_csv/, switching the order lets the set GDAL_DATA path do the right thing and the process never stats this hard coded directory. I am proposing not to remove this directory at the moment as it's possible that some legacy setups might count on it and I just don't know enough.
Are there any setups where switching the order would break things?
In frmts/gtiff/gt_wkt_srs.cpp:
pszFilename = CSVFilename( "datum.csv" ); if( EQUAL(pszFilename,"datum.csv") ) pszFilename = CSVFilename( "gdal_datum.csv" );
to
pszFilename = CSVFilename( "gdal_datum.csv" ); if( EQUAL(pszFilename,"gdal_datum.csv") ) pszFilename = CSVFilename( "datum.csv" );
Change History (4)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Fixed in r34309.
r18584 doesn't give much explanation for what is going on. datum.csv is only referred to in gt_wkt_srs.cpp within gdal. It's also in libgeotiff/geo_normalize.c
Example diff with egm96 and tweaks to make the header line closer. Caps and quotes for datum.csv from libgeotiff.
-
.csv
old new 1 "DATUM_CODE","DATUM_NAME","DATUM_TYPE","ORIGIN_DESCRIPTION","REALIZATION_EPOCH","ELLIPSOID_CODE","PRIME_MERIDIAN_CODE","AREA_OF_USE_CODE","DATUM_SCOPE","REMARKS","INFORMATION_SOURCE","DATA_SOURCE","REVISION_DATE","CHANGE_ID","DEPRECATED" 2 5171,EGM96 geoid,vertical,WGS 84 ellipsoid.,1996,,,1262,Geodesy.,, NASA http://cddis.gsfc.nasa.gov/926/egm96/egm96.html,OGP,2004/04/27,,01 "DATUM_CODE","DATUM_NAME","DATUM_TYPE","ORIGIN_DESCRIPTION","REALIZATION_EPOCH","ELLIPSOID_CODE","PRIME_MERIDIAN_CODE","AREA_OF_USE_CODE","DATUM_SCOPE","REMARKS","INFORMATION_SOURCE","DATA_SOURCE","REVISION_DATE","CHANGE_ID","DEPRECATED","ESRI_DATUM_NAME" 2 5171,EGM96 geoid,vertical,WGS 84 ellipsoid.,1996,,,1262,Geodesy.,,"NASA http://cddis.gsfc.nasa.gov/926/egm96/egm96.html",OGP,"2004/04/27",,0,
What was the use case for keeping the search for datum.csv in gdal?
comment:3 by , 8 years ago
Related, this patch gives an option to restrict where libgeotiff/cpl_csv.c will look. Related to r34653 adding GDAL_NO_HARDCODED_FIND
-
cpl_csv.c
diff --ignore-space-change -u a/cpl_csv.c b/cpl_csv.c
old new 870 870 sprintf( szPath, "%s/%s", CSV_DATA_DIR, pszBasename ); 871 871 } 872 872 #else 873 #ifdef GEOTIFF_NO_HARDCODED_FIND 874 else 875 { 876 sprintf( szPath, "%s", pszBasename ); 877 } 878 #else 873 879 else if( (fp = fopen( "/usr/local/share/epsg/csv/pcs.csv", "rt" )) != NULL ) 874 880 { 875 881 sprintf( szPath, "/usr/local/share/epsg/csv/%s", pszBasename ); … … 890 896 { 891 897 sprintf( szPath, "/usr/local/share/epsg_csv/%s", pszBasename ); 892 898 } 893 #endif 899 #endif /* GEOTIFF_NO_HARDCODED_FIND */ 900 #endif /* CSV_DATA_DIR */ 894 901 895 902 if( fp != NULL ) 896 903 fclose( fp );
comment:4 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.
It appears that datum.csv is a file in the CSV files distributed with libgeotiff. It has a structure very close to gdal_datum.csv, but without the final ESRI_DATUM_NAME column. I'm not sure of the use case of searching datum.csv in GDAL. Perhaps if the GDAL CSV files cannot be found but the libgeotiff ones are found ? Anyway it seems safe to me to switch the order of search between both files. And adding my comment in the code so we don't have to dig into this next time