I have an array of projected (X,Y) points, which I am trying to convert to array of (lat,long).
I wrote the following method which will take a single (X, Y ) and give me ( Lat, Long). This works.
But I do not know how to use this to process my (X,Y) array. This should be simple, but could not get it.
function getLatLong(X,Y){
return (new Promise(function (resolve, reject) {
require(["esri/tasks/GeometryService",
"esri/geometry/Point",
"esri/tasks/ProjectParameters",
"esri/SpatialReference"],
function (GeometryService, Point, ProjectParameters, SpatialReference) {
var XCoord = parseInt(X, 10);
var YCoord = parseInt(Y, 10);
var inSR = new SpatialReference({wkid: 2274});
var outSR = new SpatialReference({wkid: 4326});
var gsvc = new GeometryService("https://mapviewtest.memphistn.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer");
var inputpoint = new Point(XCoord, YCoord, inSR);
var prjParams = new ProjectParameters();
prjParams.geometries = [inputpoint];
prjParams.outSR = outSR;
gsvc.project(prjParams);
gsvc.on("project-complete",function(outputpoint){
resolve(outputpoint);
});
gsvc.on("error",function(err){
reject(err);
})
});
}));//promise
}Thanks
Muralidhar Moka