akashmagoon

Getting Coordinates

Discussion created by akashmagoon on Jun 12, 2012
Latest reply on Jun 13, 2012 by hzhu
I have a project where the user click a point on the map and a infowindow displays the coordinates. What function can i add below in place of X so it will GET the coordinates of the infowindow. i want it so that when they click pin here, it get the coordinates and have the displayed on a form ( that i will make). The form will have the coordinates already there, and all the user has to do is enter their information.


  function projectToWebMercator(evt) {
        map.graphics.clear();
       
        var point = evt.mapPoint;
        var symbol = new esri.symbol.SimpleMarkerSymbol().setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND);
        var graphic = new esri.Graphic(point, symbol);
        var outSR = new esri.SpatialReference({ wkid: 4326});
       
        map.graphics.add(graphic);

        gsvc.project([ point ], outSR, function(projectedPoints) {
          pt = projectedPoints[0];
          graphic.setInfoTemplate(new esri.InfoTemplate("Coordinates",
            "<p> X: " + pt.x +
            "<br/> Y: " + pt.y +
            "</p>"  +
            "<input type='button' value='Pin Here' onclick='X();' />" +
            "<div id='latlong'></div>"));
          map.infoWindow
            .setTitle(graphic.getTitle())
            .setContent(graphic.getContent())
            .show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
        });
      }

      function X
        });
      }

Outcomes