Mapbox Terrain v2: how do I modify contour elevation range?

459 views Asked by At

I'm using Mapbox Terrain vector tileset to show elevation contours on my map. But my region of interest is quite flat, so there aren't any visible contours in that area. (basically, I see contours all around my region, but not in the actual region I need the contours for.)

How do I modify the ele field of the contour layer to change the contour density? Thank you!

Mapbox Terrain-v2, #contour, ele field

1

There are 1 answers

2
jscastro On

Based on the documentation, you have to use the exaggeration param, that will exaggerates the elevation of the terrain by multiplying the data from the DEM with this value

map.setTerrain({ 
  'source': 'mapbox-dem', 
  'exaggeration': 1.5 // x1.5 multiplier to exaggerate DEM data
});