Latlong is null on mouse click

08-25-2020 09:24 PM
New Contributor

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 })



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

0 Kudos
1 Reply
MVP Legendary Contributor


   The view on click event already ha s a mapPoint property which is a Point geometry. So you code should look like this:

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



0 Kudos