mapbox-maps-ios
mapbox-maps-ios copied to clipboard
ElevationData getelevationfor**(_:) from outdoors map layers does not work
Environment
Xcode version: Version 15.2 (15C500b) iOS version: iOS17 Devices affected: iPhone15 Maps SDK Version: 11.2.0 (same behavior with 11.1.0)
Observed behavior and steps to reproduce
Pre-condition:
Create a SwiftUI mapview using
let locationProvider = AppleLocationProvider()
var mapStyle: MapStyle = .outdoors
MapReader { proxy in
Map(viewport: $viewport) {
...
}
.onMapLongPressGesture { context in
// Get elevation from map
print("Elevation: \(proxy.map?.elevation(at: locationProvider.getLastObservedLocation()!.coordinate))m, location:\(locationProvider.getLastObservedLocation()!.coordinate)")
}
}
coordinate is a CLLocationCoordinate2D and points to a visible region on the screen.
printed elevation is always "nil' regardless whether mapstyle is set to outdoors, zoom scale and contour lines with contour line elevation (e.g. 300m) are displayed on the map.
printed message is: Elevation: nilm, location:CLLocationCoordinate2D(latitude: 34.88005051423801, longitude: 5.031331175034814)
Expected behavior
https://docs.tilestream.net/ios/maps/api/latest/documentation/mapboxmaps/mapboxmap/elevation(at:) func elevation(at coordinate: CLLocationCoordinate2D) -> Double?
return a value according the visible contour lines or other estimation method of features shown on map.
Notes / preliminary analysis
Additional layers are programmatically added in slot .middle and .top
Additional links and references
protocol ElevationData https://docs.tilestream.net/ios/maps/api/latest/documentation/mapboxmaps/elevationdata/#instance-methods
func getElevationFor(CLLocationCoordinate2D) -> NSNumber?
getelevationfor(_:) works according specification and returns the terrain elevation in m.