79531880

Date: 2025-03-24 18:40:57
Score: 3
Natty:
Report link

Reviving this thread I've been testing the same in my iOS app which uses the Mapbox SDK. Anyone have success bringing their own DEM sources in Mapbox?

After adding a custom DEM with elevations encoded in RGB according to the Mapbox formula (height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1), I do see elevation changes on my map when 3D is toggled on, but they are widely exaggerated spikes (mountains are something like hundreds of KM tall). As a hack, I tried reducing terrain exaggeration by 100x but it nearly flattened them. Iterative values in between resulted in non-useful spikes, so I think I'm barking up the wrong tree.

Any ideas?

 if !mapView.mapboxMap.sourceExists(withId: "my-custom-dem") {
            var source = RasterDemSource(id: "my-custom-dem")
            source.url = "mapbox://username.my-custom-dem"
            source.encoding = .mapbox // Tells Mapbox how to decode the RGB values
            source.maxzoom = 16.0
            source.minzoom = 0.0 // Allow full zoom range from 0-16
Reasons:
  • Blacklisted phrase (1): Any ideas
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Matt