AnsweredAssumed Answered

Latlong is null on mouse click

Question asked by gayazhan on Aug 25, 2020
Latest reply on Aug 26, 2020 by rscheitlin

The basemap of my application is created from tiled service which is published in our own server, like below

 

const mapBaseLayer = new TileLayer({
   url: `${MAP_SVC_URL}/MapServer`
})

 

const baseMap = new Basemap({
   baseLayers: [this.mapBaseLayer],
   title: "Test",
   id: "test",
})

 

const map = new ArcGISMap({
   basemap: baseMap,
   layers : [this.SatLayer, this.FeaturesLayer]
})

 

let view = new MapView({
   container: 'map-base',
   map: map,
   center: [103.85, 1.29],
   zoom: 13,
   constraints: {
      lods: TileInfo.create().lods
   }
})

 

I'm having an issue when getting lat long on mouse click. It's always null. I don't have an idea how to resolve this.

 

view.on("click", evt=> {

   let point = view.toMap({ x: evt.x, y: evt.y })

   console.log(point.latitude)

   console.log(point.longitude)
})

 

Can somebody help me with this issue ? I have been trying fro 2 days. No luck so far. 

Outcomes