I am trying to get the map location point of my current location. I do,
mapView.locationDisplay.start {
[weak self] (error:Error?) -> Void in
if let error = error {
// show error
} else {
// get the map location
let currentLocation : AGSPoint = mapView.mapLocation;
}
}
current location point always gives me 0.0 for x and y values, do we have to consider anything here !!
using swift 4, ArcGIS iOS SDK v100.2.1
The start callback merely provides info on whether the iOS location API started successfully, or if not, what the reason was.
You should also implement the locationChangedHandler to get location updates:
mapView.locationDisplay.locationChangedHandler = { newLocation in
// This is an AGSLocation.
print("New location is \(newLocation)")
if let mapPoint = newLocation.position {
// This is an AGSPoint
print("The point represented by the location: \(mapPoint)")
}
// An AGSPoint represents a geographic position in a spatial reference.
// An AGSLocation will include a point for it's position, but also includes
// information about accuracy, heading, velocity, timestamps, etc.
}