Opened 14 years ago
Closed 5 years ago
#3651 closed defect (wontfix)
Datum names not from gdal_datum.csv require name morphing
Reported by: | johncz711 | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | closed_because_of_github_migration |
Component: | OGR_SRS | Version: | 1.7.2 |
Severity: | normal | Keywords: | |
Cc: |
Description
When a DATUM name value is supplied directly (not derived from EPSG code and using gdal_datum.csv), and morphToESRI is called, these names are handled by the section that prepends "D_". However, the name may require further morphing to, for example, change blanks or parenthesis to underbars. Names from gdal_datum.csv tend to already have this morphing, but all DATUM names need the morph.
I resolved this problem by modifying this section of morphToESRI as follows:
/* ------------------------------------------------------------ */
/* Try to insert a D_ in front of the datum */
/* ------------------------------------------------------------ */
OGR_SRSNode *poDatum;
poDatum = GetAttrNode( "DATUM" );
if( poDatum != NULL )
poDatum = poDatum->GetChild(0);
if( poDatum != NULL )
{
const char* pszDatumName = poDatum->GetValue();
if( !EQUALN(pszDatumName, "D_",2) )
{
char *pszNewValue = 0;
pszNewValue = (char *) CPLMalloc(strlen(poDatum->GetValue())+3);
if ( pszNewValue )
{
strcpy( pszNewValue, "D_" );
strcat( pszNewValue, poDatum->GetValue() );
/* If DatumName doesn't have "D_" prefix then it also */
/* may not have underbars in place of spaces elsewhere */
/* within the name - so fix that, too. */
MorphNameToESRI( &pszNewValue );
poDatum->SetValue( pszNewValue );
CPLFree( pszNewValue );
}
}
}
A suitably modified copy of ogr_srs_esri.cpp is in the attached zip.
I have successfully used this suggested fix in a subset of OGR code recently added to my (non-ESRI-based) platform for the sole purpose of creating WKT and writing it as .prj files.
Attachments (1)
Change History (2)
by , 14 years ago
Attachment: | MOD_ogr_srs_esri.zip added |
---|
comment:1 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.