FW: [gdal-dev] converting epsg:4326 coordinates to spherical mercator (google maps) epsg:900913

Randy George rkgeorge at cadmaps.com
Sat May 30 18:28:26 EDT 2009


I think EPSG changed their minds last Feb

This appears to be the new one: 
http://www.epsg-registry.org/export.htm?gml=urn:ogc:def:crs:EPSG::3857 

EPSG:3785 shows isdeprecated true since Feb
http://www.epsg-registry.org/export.htm?gml=urn:ogc:def:crs:EPSG::3785 

Of course subject to further notice from EPSG? I don't know how many
projects reflect the change though.

This is pretty close:
        private Point Mercator(double lon, double lat)
        {
            /* spherical mercator for Google, VE, Yahoo etc
             * epsg:900913 R= 6378137 
             * x = longitude
             * y= R*ln(tan(pi/4 + latitude/2)
             */
            double x = 6378137.0 * Math.PI / 180 * lon;
            double y = 6378137.0 *
Math.Log(Math.Tan(Math.PI/180*(45+lat/2.0)));
            return new Point(x,y);
        }

randy

-----Original Message-----
From: gdal-dev-bounces at lists.osgeo.org
[mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Jean-Claude REPETTO
Sent: Saturday, May 30, 2009 11:33 AM
To: gdal-dev at lists.osgeo.org
Cc: John Mitchell
Subject: Re: [gdal-dev] converting epsg:4326 coordinates to spherical
mercator (google maps) epsg:900913

John Mitchell a écrit :
> Hi,
> 
> If I have a lon,lat decimal degree epsg:4326 coordinate how do I convert 
> it to spherical mercator (google maps) epsg:900913?

epsg:900913 is obsolete. The correct EPSG code is 3785.

You can use cs2cs from the PROJ4 project to do the conversion.

HTH,
Jean-Claude
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list