Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#3642 closed defect (fixed)

EPSG Datum Name massage needs to accept "+" character

Reported by: johncz711 Owned by: warmerdam
Priority: normal Milestone: 1.8.0
Component: OGR_SRS Version: 1.7.2
Severity: normal Keywords:
Cc:

Description

When defining a Swiss coordinate system using the "CH1903+" datum (defining by EPSG code), the "+" in the datum name is massaged into an underscore which, because it is trailing, is then removed. The result is the datum name "CH1903", which already exists as a different datum.

This may be resolved by changing the conditional statement within the first for loop of the OGREPSGDatumNameMassage function (in ogr_fromepsg.cpp) as follows:

if( pszDatum[i] != '+'

&& !(pszDatum[i] >= 'A' && pszDatum[i] <= 'Z') && !(pszDatum[i] >= 'a' && pszDatum[i] <= 'z') && !(pszDatum[i] >= '0' && pszDatum[i] <= '9') )

{

pszDatum[i] = '_';

}

Note that this change makes the conditional statement agree with the one found in the similar function MorphNameToESRI in ogr_srs_esri.cpp.

A suitably modified copy of ogr_fromepsg.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)

MOD_ogr_fromepsg.zip (15.0 KB ) - added by johncz711 14 years ago.

Download all attachments as: .zip

Change History (3)

by johncz711, 14 years ago

Attachment: MOD_ogr_fromepsg.zip added

comment:1 by Even Rouault, 14 years ago

Milestone: 1.8.0
Resolution: fixed
Status: newclosed

r20497 /trunk/gdal/ogr/ogr_fromepsg.cpp: EPSGGetPMInfo() : add correct code in order the shortcut for Greenwich to work (#3644)

comment:2 by Even Rouault, 14 years ago

Forget previous comment. The right commit is :

r20498 OGREPSGDatumNameMassage(): don't massage + character, to be consistant with the changes done in ogr_srs_esri.cpp (r15992) and in GeoTIFF driver (r15993) (#3642)

Note: See TracTickets for help on using tickets.