Select to view content in your preferred language

How to get center location of Map when end scrolling in ArcGIS Map iOS Swift ?

1240
1
Jump to solution
10-22-2019 01:33 AM
KishanSuthar
New Contributor

private var scaleKvoToken:NSKeyValueObservation?

  scaleKvoToken = agsMapView.observe(\.visibleArea) { mapViewThatChanged, _ in

            print("Map Location changed to \(mapViewThatChanged.visibleArea?.extent.center.toCLLocationCoordinate2D())")

        }

In the above code, I can get center location of the map continuously without any map scrolling so there is any possible reason to solve this problem...??

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

You can observe isNavigating and when that is set to false, get the new viewpoint. For example:

navigatingObserver = mapView.observe(\.isNavigating, options: [.new]) { (changedMapView, change) in
    guard change.newValue == false else { return }

    // e.g. read changedMapView.currentViewpoint(with: .centerAndScale)
}‍‍‍‍‍

View solution in original post

1 Reply
Nicholas-Furness
Esri Regular Contributor

You can observe isNavigating and when that is set to false, get the new viewpoint. For example:

navigatingObserver = mapView.observe(\.isNavigating, options: [.new]) { (changedMapView, change) in
    guard change.newValue == false else { return }

    // e.g. read changedMapView.currentViewpoint(with: .centerAndScale)
}‍‍‍‍‍