I am trying to get long lat from the map when the user changes the map position. When the map starts, the first position gets using the mapView.locationDisplay.start()
But now I want that if the user wants to 'refine' the position. I have seen the code of quick but it's too complicated. Can someone please guide me on how to get the coordinates from my new extent. Thanks
Hi,
mapview.locationDisplay.mapLocation should give you a geographic point. That'll be the current position of your location display.
Kaushik
Thanks Kashik, but its not working for me. Gives me undefined.
// start the location display
onLoadStatusChanged: {
if (loadStatus === Enums.LoadStatusLoaded) {
mapView.locationDisplay.start()
mapView.locationDisplay.autoPanMode = Enums.LocationDisplayAutoPanModeRecenter
var coord = mapView.locationDisplay.mapLocation
console.log(coord)
}
}//onLoadStatusChanged
But if I use positionSource.position.coordinate I at least get my current coordinates.
Also, how do I change the extent and get the coordinates?
Hi Aneeqa,
mapPoint is a point geometry; you should write out/console log x and y
refer - Point QML Type | ArcGIS for Developers
yes, this will work only IF you location display is active and functional.
Not sure what your workflow is but in general extent of the map could be changed by zooming in, out, changing scale etc.
Once your extent is changed, you could use this signal - ArcGISItem QML Type | ArcGIS for Developers to do add desired behaviour after extent change is complete.
Hope this helps.
Kaushik