Code Snippet: ESRI JS API 4.11 get Latittude Longitude on mouse hover

ESRI JS API 4.11 get Latittude Longitude on mouse hover


//print point on mouse hover on map






mapView.on("pointer-move", function(event){
let mapPoint = mapView.toMap({x: event.x, y: event.y});
console.log(mapPoint);
});




//print point on mouse click on map

mapView.on("click", function(event){
let mapPoint = event.mapPoint;
console.log(mapPoint)
});

Both console statement will return the identical object as below which has latitude and longitude

  1. {__accessor__: b}
    1. cache: (...)
    2. extent: (...)
    3. hasM: (...)
    4. hasZ: (...)
    5. latitude: (...)
    6. longitude: (...)
    7. m: (...)
    8. spatialReference: (...)
    9. type: (...)
    10. x: (...)
    11. y: (...)
    12. z: (...)
    13. constructed: (...)
    14. destroyed: (...)
    15. initialized: (...)

Comments

Popular posts from this blog

Extract Raster Values from Points

Instruct GIT not to track a specific file

Update WPF Interaction Triggers in from .Net Framework 4.8 to .Net 5