I am using ArcGIS Javascript SDK 3.17 to display some points on a map, and when the user selects the point it takes them to Google Maps driving directions. The points are displaying in the correct location but when I click the graphic it sends some weird coordinates to Google Maps such as -8622416.7705,4523370.1646

Here is my code for the click event:

map.on("click", function (evt) {
   var lat = evt.mapPoint.x.toString();
   var lng = evt.mapPoint.y.toString();
   window.location = "comgooglemaps://?daddr=" + lat + "," + lng + "&directionsmode=driving";

Why is this not working?

  • Because the map is in 3857, web Mercator. You'll need to convert them to lat lon.
    – mkennedy
    Commented Sep 29, 2017 at 13:59

1 Answer 1


Like @mkennedy said in her comment, you need to convert to a GCS, particularly WGS 1984 if you want lat/long. You can accomplish this using the webMercatorUtils:

// need to import 'esri/geometry/webMercatorUtils' and 'esri/SpatialRefeference'
var wgs84 = new SpatialReference({wkid: 4326});

// convert map coordinates to WGS 84
map.on("click", function (evt) {
  if (webMercatorUtils.canProject(evt.mapPoint, wgs84){
    var wgsPt = webMercatorUtils.project(evt.mapPoint, wgs84);
    window.location = "comgooglemaps://?daddr=" + wgsPt.y + "," + wgsPt.x + "&directionsmode=driving";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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