var initExtent = new esri.geometry.Extent({ "xmin" : -9025716.63, "ymin" :4428892.14, "xmax" : -8888129.98, "ymax" : 4520616.57, "spatialReference" : { "wkid" : 102100 } }); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
var point = { lng : -80.430123, lat : 37.2447239 };
{"x":-5991744.271143372,"y":2592441.1643744702}
Well-known ID Name 4326 GCS_WGS_1984 GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Well-known ID Name 102100 WGS_1984_Web_Mercator_Auxiliary_Sphere 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["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]
CoordTransform.ellipse and CoordTransform.datumTransform
function toWebMercator(xlon, ylat) { if ((Math.abs(mercatorX_lon) > 180 || Math.abs(mercatorY_lat) > 90)) return null; var num = xlon * 0.017453292519943295; var x = 6378137.0 * num; var a = ylat * 0.017453292519943295; var y = 3189068.5 * Math.Log((1.0 + Math.Sin(a)) / (1.0 - Math.Sin(a))); return { x: x, y: y } }
function (lat,lon) { //code completely borrowed from Dr Bill Hazelton's HP-33S calculator // http://homepage.mac.com/nwjh/HP-33S/ 10-Feb-10 var num = lon * 0.017453292519943295; var x = 6378137.0 * num; var a = lat * 0.017453292519943295; var mercatorX = x; var mercatorY = 3189068.5*Math.log((1.0 + Math.sin(a))/(1.0 - Math.sin(a))); return [mercatorX,mercatorY]; }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.