5

I am using Arcgis Javascript api. I have two points comes from Google maps like this

x:-111.67095840000002 y: 32.7558935

I wanna use this points on my Arcgis map. My map spatial reference is using wkt WGS_1984_UTM_Zone.... I mean it is not using wkid.

theX = results[0].geometry.location.lng();
theY = results[0].geometry.location.lat();

console.log("Longitude: " + theX + " Latitude: " + theY);

var pointESRI = new Point(Number(theX), Number(theY), map.spatialReference);
console.log(pointESRI);

var mp = WebMercatorUtils.geographicToWebMercator(pointESRI);
console.log(mp);

pointESRI = new Point({ "x": mp.x, "y": mp.y, "spatialReference": map.spatialReference });

enter image description here

WebMercatorUtils.geographicToWebMercator() methot not converting point as appropriate to WGS84 reference.

  • 1
    When you test this, you cannot use a point in Arizona with UTM zone 36N which has usual longitude limits between +30 and +36 degrees. Esri allows a wider area, but still limited to -12 to +78. – mkennedy Sep 19 '13 at 16:37
  • I have tried this method WebMercatorUtils.geographicToWebMercator() to convert the coordinates from geographic into projected and it worked very well – Shehab May 15 '14 at 8:55
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – PolyGeo May 15 '14 at 9:52
8

You're going to have to use a Geometry Service to project features into anything other than the Web Mercator spatial reference. This sample show how to do a coordinate conversion using the service. The current projection tools within the API only do a geographic to/from Web Mercator projection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.