Ticket #3642 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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

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

Change History

Changed 3 years ago by johncz711

Changed 3 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 1.8.0

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

Changed 3 years ago by rouault

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.