[gdal-dev] WKT for Reprojecting to ESRI Web Mercator (EPSG:3857) using gdalwarp/ogr2ogr

Jason Greenlaw jason.greenlaw at noaa.gov
Fri Nov 9 11:02:09 PST 2012


I've recently run into some issues when trying to reproject rasters and
shapefiles using GDAL to the ESRI Web Mercator (auxiliary sphere)
projection (EPSG:3857), but have come up with a workaround that I wanted to
share.

After specifying "EPSG:3857" as the target projection to gdalwarp or
ogr2ogr, the resulting dataset does not overlay nicely in ArcMap/ArcGIS
Server with ESRI-projected datasets or ArcGIS Online basemaps.  If you
instead use the code "EPSG:102113", it results in the data overlaying
correctly, but requires an on-the-fly datum transformation when drawing in
EPSG:3857.  I've tried specifying an ESRI prj file along with the "ESRI::"
prefix to gdalwarp, but that too failed to reproject properly.

To avoid a datum transformation, I've merged the information from an ESRI
3857 .prj file with the EPSG:102113 definition found in
$GDAL_DATA/esri_extra.wkt (specifically modifying the PROJ4 extension
definition to use a semiminor axis of 6356752.314245179, which is what ESRI
expects), and created a .prf file, which I've been able to use successfully
with gdalwarp and ogr2ogr.

The WKT of the .prf file is as follows:

---------------------------------------------------------------------------
PROJCS['WGS_1984_Web_Mercator_Auxiliary_Sphere',
    GEOGCS['GCS_WGS_1984',
        DATUM['D_WGS_1984',
            SPHEROID['WGS_1984',6378137.0,298.257223563]
        ],
        PRIMEM['Greenwich',0.0],
        UNIT['Degree',0.0174532925199433]
    ],
    PROJECTION['Mercator_Auxiliary_Sphere'],
    PARAMETER['False_Easting',0.0],
    PARAMETER['False_Northing',0.0],
    PARAMETER['Central_Meridian',0.0],
    PARAMETER['latitude_of_origin',0.0],
    PARAMETER['Standard_Parallel_1',0.0],
    PARAMETER['Auxiliary_Sphere_Type',0.0],
    UNIT['Meter',1.0],
    EXTENSION["PROJ4",
        "+proj=merc +a=6378137 +b=6356752.314245179 +lat_ts=0.0 +lon_0=0.0
+x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"
    ],
    AUTHORITY["EPSG","3857"]
]
---------------------------------------------------------------------------

Hope this solution saves someone else some time.
Jason

--
Jason Greenlaw
Contractor, ERT, Inc.
NOAA/NOS/OCS/CSDL
http://nowcoast.noaa.gov
Jason.Greenlaw at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121109/16d65be8/attachment.html>


More information about the gdal-dev mailing list