[gdal-dev] Ogr2ogr datum shift

Frank Warmerdam warmerdam at pobox.com
Thu Sep 15 10:27:36 EDT 2011


Stacey,

You should not need to use cs2cs - pretty much the same capabilities
are available from the ogr2ogr command line.  What command are you
using now?  And what version of GDAL/OGR?   With modern versions the
following command should work well:

 ogr2ogr -s_srs EPSG:3857 -t_srs EPSG:4326 out.shp in.shp

EPSG:3857 should evaluate to the following PROJ.4 string.

 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0
        +x_0=0.0 +y_0=0 +k=1.0 +units=m
        +nadgrids=@null +wktext  +no_defs

Adding " --debug on " to the commandline may be helpful to
confirm the coordinate system strings being used internally.

Best regards,

On Wed, Sep 14, 2011 at 11:11 PM, Stacy Supak <sksupak at ncsu.edu> wrote:
> Hi community,
>
> Is there a way to add a datum shift parameter to a reprojected shp in an
> ogr2ogr call?
> I am using ogr2ogr to extract a shp from a postgis database and within the
> command I am reprojecting features from google Mercator to EPSG 4326. In the
> process of going from a spherical coordinate system to an elliptical one,
> the latitude of the  shp is shifted north by .18 degrees. I was informed by
> a knowledgable member of the listserve that cs2cs could solve this problem,
> but can this command work on vector data or just coordinates? If it is
> possible to use cs2cs on a shp, do I simply run the command immediately
> after the ogr2ogr command?
> Thanks,
> Stacy

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer


More information about the gdal-dev mailing list