Opened 14 months ago

Closed 11 months ago

Last modified 11 months ago

#6456 closed defect (fixed)

ogr2ogr: inconsistent reprojection behaviour

Reported by: cricruh Owned by: warmerdam
Priority: normal Milestone: 2.0.3
Component: OGR_SRS Version: svn-trunk
Severity: normal Keywords:
Cc:

Description (last modified by cricruh)

I am not an expert of ogr2ogr, but using it for a long time. Something is weird with version 2.0.2. When projecting to epsg:3395 from epsg4326, the shape is shifted.

ogr2ogr -t_srs EPSG:3395 16E8Cogr2ogr.shp 16E8C.shp

Attachments (1)

bug.zip (2.4 KB) - added by cricruh 14 months ago.

Download all attachments as: .zip

Change History (13)

Changed 14 months ago by cricruh

Attachment: bug.zip added

comment:1 Changed 14 months ago by cricruh

Description: modified (diff)

comment:2 Changed 14 months ago by Even Rouault

Are you sure you really want to use EPSG:3395 which is the Ellipsoidal WGS 84 mercator, and not EPSG:3857 the commonly used Spherical WGS 84 Mercator (aka Google Mercator / Google Maps projection) ?

comment:3 Changed 13 months ago by cricruh

Thanks for pointing this out! I was lost. 2 days of work to get rid of 3395 :-(

comment:4 Changed 13 months ago by Even Rouault

Resolution: invalid
Status: newclosed

comment:5 Changed 11 months ago by Bishop

Resolution: invalid
Status: closedreopened

I also faced with shift in 3395. This is occurs with shape file because strange behavior in morphToESRI (standard_parallel_1 set with value 6.64456744726493).

How to reproduce:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from osgeo import osr
       
srs = osr.SpatialReference()
srs.ImportFromEPSG(3395)
print srs.ExportToWkt()
srs.MorphToESRI()
print srs.ExportToWkt()

The morphed SRS looks like:

PROJCS["WGS_84_World_Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],PARAMETER["standard_parallel_1",6.64456744726493],UNIT["Meter",1]]

and should be (http://spatialreference.org/ref/epsg/3395/esriwkt/):

PROJCS["WGS 84 / World Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]]

comment:6 Changed 11 months ago by Bishop

Component: defaultOGR_SRS
Version: unspecifiedsvn-trunk

comment:7 Changed 11 months ago by Even Rouault

I'm on it. This is due to #4861. The math that was provided for 1SP to 2SP conversion was wrong...

comment:8 Changed 11 months ago by Even Rouault

Resolution: fixed
Status: reopenedclosed

In 34494:

OSR morphToESRI(): correctly compute standard_parallel_1 of Mercator(2SP) projection from scale factor of Mercator(1SP) (fixes #6456, #4861)

comment:9 Changed 11 months ago by Even Rouault

In 34495:

OSR morphToESRI(): correctly compute standard_parallel_1 of Mercator(2SP) projection from scale factor of Mercator(1SP) (fixes #6456, #4861)

comment:10 Changed 11 months ago by Even Rouault

In 34496:

OSR morphToESRI(): correctly compute standard_parallel_1 of Mercator(2SP) projection from scale factor of Mercator(1SP) (fixes #6456, #4861)

comment:11 Changed 11 months ago by Even Rouault

Note: fix in 2.0 branch *post* 2.0.3RC1

comment:12 Changed 11 months ago by Even Rouault

Milestone: 2.0.3

A 2.0.3RC2 has been pushed, so this will be in final 2.0.3

Note: See TracTickets for help on using tickets.