Opened 19 years ago

Closed 9 years ago

Last modified 9 years ago

#956 closed defect (fixed)

Failure to store/load a big number of WKT-defined projections to/from GeoTiff using GDAL

Reported by: varaev@… Owned by: warmerdam
Priority: high Milestone: 2.0.0
Component: default Version: unspecified
Severity: critical Keywords:
Cc:

Description (last modified by Jukka Rahkonen)

Hello Frank,
We are encountering quoite a few situations when we provide the WKT string to 
GDal's pDataset->SetProjection() upon saving a GeoTIFF file, and when we are 
trying to load the stored file, pDataset->GetProjectionRef() returns us an WKT 
definition with insufficient paramters. We are not sure whether the loss 
always occurs on loading or the saving also has some deficiencies, but 
definitely something is going out of whack in the course of WKT -> GDal -> WKT 
transformation.

Example projections (there are really MANY others!):

#1 British National Grid:

The string we provide upón Save:
PROJCS["British National Grid",GEOGCS["ORD SURV GB Coordinate System",DATUM
["Ord. Surv. of Gr. Br. 1936",SPHEROID["Airy 
1830",6377563.396,299.3249646],TOWGS84[446.448,-
125.157,542.06,4.16666666666667e-005,6.86111111111111e-
005,0.000233888888888889,-20.489]],PRIMEM["Greenwich",0],UNIT
["degree",0.0174532925199433],AUTHORITY["EPSG","4277"]],PROJECTION
["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER
["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER
["false_easting",400000],PARAMETER["false_northing",-100000],UNIT["Meter 
(m)",1],AUTHORITY["EPSG","27700"]]

The string that we receive on loading:
PROJCS["unnamed",GEOGCS["ORD SURV GB Coordinate System",DATUM
["unknown",SPHEROID["unretrievable - using 
WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT
["degree",0.0174532925199433]],UNIT["metre",1,AUTHORITY
["EPSG","9001"]],AUTHORITY["EPSG","27700"]]

which clearly contains less information than it was provided.

#2 American Samoa:

Saved:
OJCS["American Samoa 1962 / American Samoa Lambert",GEOGCS["AMER. SAMOA 
Coordinate System",DATUM["American Samoa Islands - 1962",SPHEROID["Clarke 
1866",6378206.4,294.9786982],TOWGS84[-115,118,426,0,0,0,0]],PRIMEM
["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY
["EPSG","4169"]],PROJECTION["Lambert_Conformal_Conic_1SP"],PARAMETER
["latitude_of_origin",-14.2666666666667],PARAMETER["central_meridian",-
170],PARAMETER["scale_factor",1],PARAMETER
["false_easting",499999.9999949199],PARAMETER
["false_northing",312234.649996828],UNIT["US Survey Feet 
(usft)",0.304800609604316],AUTHORITY["EPSG","3102"]]

Loaded:
PROJCS["unnamed",GEOGCS["AMER. SAMOA Coordinate System",DATUM
["unknown",SPHEROID["unretrievable - using 
WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT
["degree",0.0174532925199433]],UNIT["unknown",1],AUTHORITY["EPSG","3102"]]

#3 East Alabama, NAD83
Saved:
PROJCS["Alabama Eastern Zone ",GEOGCS["NAD83 Coordinate System",DATUM["North 
American Datum 1983",SPHEROID["GRS 1980",6378137,298.257222101],TOWGS84[-
0.9738,1.9453,0.5486,7.652997269562411e-006,2.79145037787737e-
006,3.15527857778544e-006,0]],PRIMEM["Greenwich",0],UNIT
["degree",0.0174532925199433],AUTHORITY["EPSG","4269"]],PROJECTION
["Transverse_Mercator"],PARAMETER["latitude_of_origin",30.5],PARAMETER
["central_meridian",-85.8333333333],PARAMETER["scale_factor",0.99996],PARAMETER
["false_easting",200000],PARAMETER["false_northing",0],UNIT["Meter 
(m)",1],AUTHORITY["EPSG","26929"]]

Loaded:
PROJCS["unnamed",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID
["GRS 1980",6378137,298.2572221010002,AUTHORITY["EPSG","7019"]],AUTHORITY
["EPSG","6269"]],PRIMEM["Greenwich",0],UNIT
["degree",0.0174532925199433],AUTHORITY["EPSG","4269"]],UNIT
["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","26929"]]

#4 New Brunswick
After it's specified (and SetProjection() didn't report any failures), this 
projection fails to load at all and GDal simply reports that the TIFF doesn't 
have any projection (pDataset->GetProjectionRef() returns 0)

PROJCS["New Brunswick",GEOGCS["NAD27 Coordinate System",DATUM["NAD 1927 
(NADCON CONUS)",SPHEROID["Clarke 1866",6378206.4,294.9786982],TOWGS84[-
2,0,4,0,0,0,0]],PRIMEM["Greenwich",0],UNIT
["degree",0.0174532925199433],AUTHORITY["EPSG","4267"]],PROJECTION
["DoubleStereographic"],PARAMETER["latitude_of_origin",46.5],PARAMETER
["central_meridian",-66.5],PARAMETER["scale_factor",0.999912],PARAMETER
["false_easting",300000],PARAMETER["false_northing",800000],UNIT["Meter 
(m)",1]]

If you need more examples, we've a plenty of them :)
Thanks in advance!

Change History (4)

comment:1 by varaev@…, 18 years ago

Ok, here is the reason for the problem - the library was failing to locate the 
required cvs tables and didn't report it, rather silently failing to read the 
projection. It took quite some time for us, as the end users, to debug the 
code and see what's going wrong. It _is_ a problem.
The other issue is that a function static void GTiffOneTimeInit() there is a 
line SetCSVFilenameHook( GDALDefaultCSVFilename ); GTiffOneTimeInit() is 
called automatically on the first use and if I have my own version of a 
function that is used to find CVS files, calling SetCSVFilenameHook( 
GDALDefaultCSVFilename ) _before_ doesn't help too much as it is replaced 
during the Init by the default hook, while calling it after may be a bit too 
late.

comment:2 by Jukka Rahkonen, 9 years ago

Description: modified (diff)

The acute problem was solved but varaev made two concrete suggestions:

  • An error should be thrown is CVS tables are not shown
  • Another one that I do not understand but is related to SetCSVFilenameHook.

Are these still valid wishes or perhaps fixed during these 9 years?

comment:3 by Even Rouault, 9 years ago

Milestone: 2.0
Resolution: fixed
Status: newclosed

libgeotiff http://trac.osgeo.org/geotiff/changeset/2592 "GTIFGetDefn(): issue a CE_Warning if .csv files cannot be found (GDAL #956)"

trunk r28233 "GTiff/internal libgeotiff: issue a CE_Warning if .csv files cannot be found (#956)"

comment:4 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.