Opened 8 years ago

Closed 8 years ago

Last modified 8 years 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 8 years ago.

Download all attachments as: .zip

Change History (13)

by cricruh, 8 years ago

Attachment: bug.zip added

comment:1 by cricruh, 8 years ago

Description: modified (diff)

comment:2 by Even Rouault, 8 years ago

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 by cricruh, 8 years ago

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

comment:4 by Even Rouault, 8 years ago

Resolution: invalid
Status: newclosed

comment:5 by Bishop, 8 years ago

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 by Bishop, 8 years ago

Component: defaultOGR_SRS
Version: unspecifiedsvn-trunk

comment:7 by Even Rouault, 8 years ago

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

comment:8 by Even Rouault, 8 years ago

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 by Even Rouault, 8 years ago

In 34495:

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

comment:10 by Even Rouault, 8 years ago

In 34496:

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

comment:11 by Even Rouault, 8 years ago

Note: fix in 2.0 branch *post* 2.0.3RC1

comment:12 by Even Rouault, 8 years ago

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.