Opened 22 years ago

Last modified 21 years ago

#211 closed defect (fixed)

Save EPSG PCS Codes to GeoTIFF

Reported by: warmerdam Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

Frank,
 
I have added the following few lines to gt_wkt_srs.cpp. It seemed a shame not to
take advantage of the EPSG data if it was present. It would be nice if you could
include them. The idea could be extended to look for a GEOGCS string in the same
file if the PROJCS one failed.
 
 
/*                        GTIFSetFromOGISDefn()                         */
/*                                                                      */
/*      Write GeoTIFF projection tags from an OGC WKT definition.       */
/************************************************************************/
 
int GTIFSetFromOGISDefn( GTIF * psGTIF, const char *pszOGCWKT )
 
{
............
/* -------------------------------------------------------------------- */
/*      Handle the projection transformation.                           */
/* -------------------------------------------------------------------- */
    const char *pszProjection = poSRS->GetAttrValue( "PROJECTION" );
// RFJ
 // Find the EPSG projected cs code from the wkt proj cs name
    if (nPCS = atoi(CSVGetField( CSVFilename("horiz_cs.csv"),
                                  "HORIZCS_EPSG_NAME",
poSRS->GetAttrValue("PROJCS"), CC_ApproxString,
                                  "HORIZCS_CODE")))
 {
  GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1, nPCS );
  GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1, ModelTypeProjected);
 }
 else
// RFJ
    if( pszProjection == NULL )
 
 
 
Roger

Change History (2)

comment:1 by warmerdam, 22 years ago

I would add that we should look for EPSG Authority codes in the WKT 
and utilize them if possible.  However, I think the patch needs to change
a little so that even if a PCS code is written that the full parameters
can also still be written. 

comment:2 by warmerdam, 21 years ago

I did a slightly different form of this based on the authority values within
the WKT.  


Note: See TracTickets for help on using tickets.