AnsweredAssumed Answered

Click on the map to get value of longitude/latitude

Question asked by lilpenguin on Jun 17, 2019
Latest reply on Jun 20, 2019 by EPolle_TensingInternational

Hi,

 

Is there anyways to get the value of longitude/latitude when click on the map?

 

I want the value to be display on input textbox. Is it possible to do that?

 

Below is my code:

require([
        "esri/Map",
        "esri/views/MapView",
        "esri/Graphic"
    ], function(Map,
        MapView, Graphic) {

      var map = new Map({
        basemap: "topo-vector"
      });

      var view = new MapView({
        container: "viewDiv",
        map: map,
        center: [110.36402943937549,1.5128959885365645], // longitude, latitude
        zoom: 18
      });
      
      var point = {
        type: "point",
        longitude: 110.36402943937549,
        latitude: 1.5128959885365645
      };

      var simpleMarkerSymbol = {
        type: "simple-marker",
        color: [226, 119, 40],  // orange
        outline: {
          color: [255, 255, 255], // white
          width: 1
        }
      };

      var pointGraphic = new Graphic({
        geometry: point,
        symbol: simpleMarkerSymbol
      });

      view.graphics.add(pointGraphic);

    });

Thank you so much!

 

Regards,

Stacie

Outcomes