shrug-l: Lat/Long(decimal degrees) to Meters without Geometry service

Janelle Brown Janelle.Brown at
Thu May 26 14:02:17 EDT 2011



Does anyone have a javascript code that can convert decimal degrees
(wkid: 4326) points to meters (wkid: 3857)? I am not able to use the
geometry service for a number of reasons, so I believe the only way to
do this would be to convert the points mathematically. This is what I
have so far and it's kinda working (I'm off about 20-25 miles), but I'm
pretty sure there is some tweaking needed in the equations. If anyone
has any ideas or has already written some javascript code for this, I'd
be very grateful!


       function addPointToMap() {

            var xMin,yMin,xMax,yMax;

            var lon ,lat;

            var DEG_TO_RAD = 0.017453292519943296;                

            var PI = 3.14159267;

            var NUM = 6356752.3142;


            lon = -84.286616;

            lat = 30.437574;


            //Limit to World






var Y = Math.round(NUM * Math.log( Math.tan( ((lat * DEG_TO_RAD) +
(PI/2)) / 2 ) ));

            var X = Math.round(NUM * (lon * DEG_TO_RAD));



Thank you in advance!


Janelle Brown

GIS Analyst, Corporate Analytics

Citizens Property Insurance Corporation


ofc. 850.521.8373   |   cell 850.879.2374


-------------- next part --------------
An HTML attachment was scrubbed...

More information about the SHRUG-L mailing list