Opened 7 years ago

Closed 7 months ago

#4673 closed defect (wontfix)

MorphFromESRI() compares SPHEROID names instead of parameter values

Reported by: etourigny Owned by: etourigny
Priority: normal Milestone: closed_because_of_github_migration
Component: OGR_SRS Version: 1.9.0
Severity: normal Keywords: esri, wkt, towgs84, spheroid
Cc:

Description

ESRI WKT .prj files do not include TOWGS84 parameters, and gdal-1.9 does not add TOWGS84 parameters to the generated OSR definition.

An attempt to correct this has been implemented in MorphFromESRI() with an optional capability to add missing TOWGS84 parameters though GDAL_FIX_ESRI_WKT config option (see #4345).

Since gdal-1.9 there have been a number of regressions in software like qgis, in which certain .prj files are are not assigned correct towgs84 parameters, even with GDAL_FIX_ESRI_WKT=TOWGS84 - such as the release-blocking issue at http://hub.qgis.org/issues/5598.

This particular problem is due to the fact that the code looks for matching SPHEROID node names, rather than parameters (semi_major, inv_flattening).

The following file corresponds to EPSG:4131 but TOWGS84 fixing does not work, because of a mis-match in SPHEROID name - "Everest 1830 (1937 Adjustment)" vs. "Everest_Adjustment_1937"

$ cat tmp1.prj
GEOGCS["GCS_Indian_1960",DATUM["D_Indian_1960",SPHEROID["Everest_Adjustment_1937",6377276.345,300.8017]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

$ gdalsrsinfo EPSG:4131

PROJ.4 : '+proj=longlat +a=6377276.345 +b=6356075.41314024 +towgs84=198,881,317,0,0,0,0 +no_defs '

OGC WKT :
GEOGCS["Indian 1960",
    DATUM["Indian_1960",
        SPHEROID["Everest 1830 (1937 Adjustment)",6377276.345,300.8017,
            AUTHORITY["EPSG","7015"]],
        TOWGS84[198,881,317,0,0,0,0],
        AUTHORITY["EPSG","6131"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4131"]]

tourigny@supernova: /data/research/work/qgis/issues/5598 $ GDAL_FIX_ESRI_WKT=TOWGS84 gdalsrsinfo tmp1.prj

PROJ.4 : '+proj=longlat +a=6377276.345 +b=6356075.41314024 +no_defs '

OGC WKT :
GEOGCS["GCS_Indian_1960",
    DATUM["Indian_1960",
        SPHEROID["Everest_Adjustment_1937",6377276.345,300.8017]],
    PRIMEM["Greenwich",0.0],
    UNIT["Degree",0.0174532925199433]]

An easy (but short-sighted) fix is to add the proper mapping in ogr_srs_esri.cpp

static const char *apszSpheroidMapping[] = {
    "WGS_84", "WGS_1984",
    "WGS_72", "WGS_1972",
    "GRS_1967_Modified", "GRS_1967_Truncated",
    "Krassowsky_1940", "Krasovsky_1940",
    +"Everest_1830_1937_Adjustment", "Everest_Adjustment_1937",
    NULL, NULL }; 

A better and permanent fix is to compare SPHEROID nodes based on parameters rather than node names.

This might be worth including in 1.9.1, but it is probably too late.

Attachments (1)

MoEAreas.zip (148.3 KB) - added by etourigny 7 years ago.
shapefile from qgis bug# 5598

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by etourigny

Attachment: MoEAreas.zip added

shapefile from qgis bug# 5598

comment:1 Changed 7 years ago by etourigny

fixed in trunk (r24461) and 1.9 (r24463).

I am tempted to change default GDAL_FIX_ESRI_WKT to TOWGS84, but that might require an RFC???

comment:2 Changed 4 years ago by Even Rouault

Priority: highnormal

All those tickets have more than one year and nobody has acted on it, so the priority is not so high

comment:3 Changed 7 months ago by Even Rouault

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.