Select to view content in your preferred language

Refine location

646
3
11-10-2017 09:59 AM
AneeqaAbrar1
Occasional Contributor

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

0 Kudos
3 Replies
KaushikMysorekar
Regular Contributor
Hi,
mapview.locationDisplay.mapLocation should give you a geographic point. That'll be the current position of your location display.

Kaushik

0 Kudos
AneeqaAbrar1
Occasional Contributor

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?

0 Kudos
KaushikMysorekar
Regular Contributor

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

0 Kudos