Opened 10 years ago

Closed 10 years ago

#3026 closed defect (fixed)

Mercator with scale=1 at non-equatoral latitude handled improperly.

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 1.6.2
Component: OGR_SRS Version: 1.6.1
Severity: normal Keywords: mercator proj
Cc:

Description

The attached geotiff is reported as:

Coordinate System is:
PROJCS["unnamed",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["latitude_of_origin",46.1333331],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-5900000.000000000000000,3500000.000000000000000)
Pixel Size = (10.000000000000000,-10.000000000000000)
...
Corner Coordinates:
Upper Left  (-5900000.000, 3500000.000) ( 53d 0'2.17"W, 30d 8'20.99"N)
Lower Left  (-5900000.000, 3499000.000) ( 53d 0'2.17"W, 30d 7'52.88"N)
Upper Right (-5899000.000, 3500000.000) ( 52d59'29.83"W, 30d 8'20.99"N)
Lower Right (-5899000.000, 3499000.000) ( 52d59'29.83"W, 30d 7'52.88"N)
Center      (-5899500.000, 3499500.000) ( 52d59'46.00"W, 30d 8'6.94"N)

However, the coordinates are wrong, and the reason is that the coordinate system is translated to PROJ.4 as "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m" instead of "+proj=merc +lon_0=0 +lat_ts=6.1333331 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m" as it ought to be. In brief, the proj4 translation is always assuming the scale factor is used at the equator (+k) instead of at the natural origin.

This appears to have been a long standing issue in GDAL, though it was not always this way.

Attachments (1)

merc_lat_ts.tif (10.4 KB) - added by warmerdam 10 years ago.
mercator file demonstrating issue.

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by warmerdam

Attachment: merc_lat_ts.tif added

mercator file demonstrating issue.

comment:1 Changed 10 years ago by warmerdam

Milestone: 1.6.2
Resolution: fixed
Status: newclosed
Version: unspecified1.6.1

It turns out that we normally use Mercator_2SP to represent this case. So one fix might be to translate this configuration to Mercator_2SP in the geotiff driver. However, I have instead taken the approach of converting WKT with non-zero origin of latitude and a scale factor of 1 to the lat_ts form in PROJ.4 format in ogr_srs_proj4.cpp so that other reasonably legitimate WKT in this form will also work.

The change is in trunk (r17236) with tests (r17237) and also in 1.6 branch (r17238). I did not port it into 1.6-esri since ArcGIS does not use PROJ.4 format. The fix should appear in 1.6.2 and 1.7.0.

Note: See TracTickets for help on using tickets.