AnsweredAssumed Answered

Mapping Web Mercator coordinate as LatLng

Question asked by fayaz_esri on Feb 28, 2018
Latest reply on Mar 4, 2018 by rscheitlin

Hello,

 

I want to take user coordinates as Web Mercator and place it as late long as point on map and zoom it but no success:

 

Following is my attempt:

 

app.addUserPnt = function (pointXY) {
console.info(pointXY);

map.graphics.remove();

var myPoint = {

"geometry": {
"x": pointXY[0], "y": pointXY[1],
"spatialReference": 32638,
}, "attributes": {
"XCoord": pointXY[0],
"YCoord": pointXY[1],
}, "symbol": {
"color": [255, 0, 0, 128],
"size": 12, "angle": 0, "xoffset": 0, "yoffset": 0, "type": "esriSMS",
"style": "esriSMSCircle", "outline": {
"color": [0, 0, 0, 255], "width": 1,
"type": "esriSLS", "style": "esriSLSSolid"
}
},
}
var outSR = new SpatialReference(4326);
var params1 = new ProjectParameters();
params1.geometries = [myPoint];
params1.outSR = outSR;

gsvc.project(params1, function(projectedPoints) {
myPoint = projectedPoints[0];
});

var gra = new Graphic(myPoint);

map.graphics.add(gra);
map.centerAndZoom(gra.geometry, 17)

};

Outcomes