admin管理员组

文章数量:1401643

I've been testing bringing a custom DEM into my iOS app, which uses the Mapbox SDK. Anyone have success bringing their own DEM sources into a Mapbox application?

Current approach:

I created my own RGB encoded DEM using the Mapbox formula (height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1) and uploaded it to Mapbox Studio as a raster layer. Then I updated my codebase to use it instead of the Mapbox DEM when 3D is toggled on.

Results:

Terrain is added to the map, but it is wildly exaggerated. Mountains are massive towers, probably hundreds of KM tall. As a hack, I tried reducing terrain exaggeration to .01x. This was only slightly better, as it nearly flattened them. Iterative exaggeration values of 0.1x and 0.05x resulted in more wild spikes, so I thought I'd park that line of exploration and poke around for advice.

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

本文标签: gisCustom DEM for 3D Terrain in Mapbox iOS SDK v11Stack Overflow