var g = { geometryType:"esriGeometryPoint", geometries:[wgsPt.toJson()] }; var params = { f:"json", geometries:dojo.toJson(g), inSR:4326, outSR:wkidMap, transformation:atransformation, transformForward:atransformForward }; var requestHandle = esri.request({ url:"http://servicesbeta4.esri.com/arcgis/rest/services/Geometry/GeometryServer/Project", content:params, callbackParamName:"callback", load:dojo.hitch(dojo.mixins(this, "OnSuccessProject")) }, {useProxy:false});
// Use the hosted 10.1 Beta ArcGIS Server Geometry Service gsvc = new esri.tasks.GeometryService("http://servicesbeta4.esri.com/arcgis/rest/services/Geometry/GeometryServer"); // create a new point from the geolocation location var point = new esri.geometry.Point( location.coords.longitude, location.coords.latitude, new esri.SpatialReference({ wkid: 4326 }) ); // set the output spatial reference for the project method var outSR = new esri.SpatialReference({ wkid: 27700 }); // tack on two parameters in the query object - these will be added to the url and will give us a more accurate transformation gsvc._url.query = dojo.mixin(gsvc._url.query, { // set the datum transformation to OSGB_1936_To_WGS_1984_Petroleum (1314) // the options are listed here: http://servicesbeta2.esri.com/arcgis/sdk/rest/dattrans.html transformation: 1314, // we are transforming backwards in this case // FROM WGS84 TO OSGB36 transformForward: false }); // call the geometry service project method as you would normally gsvc.project([point], outSR, function (projectedPoints) { // get the projected point pt = projectedPoints[0]; // add it to the map addGraphic(pt); // zoom the map to the added point map.centerAndZoom(pt, 17); });
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.