Convert units
This is a modified version of the Streets template style.
Two new layers were added:
contour
andcontour-label
.The data for these two new layers comes from the
mapbox-terrain-v2
tileset. Both layers can be added using the toggle buttons in the Terrain component.The
contour-label
layer is asymbol
layer that uses a formula to convert elevation from meters to feet.
About this style
- Contour data: The contour data used in this example comes from the
mapbox-terrain-v2
tileset. Thecontour
source layer contains the geometry for each contour line and two properties:index
andele
. Theele
property is the elevation in meters. Read more about the Mapbox Terrain tileset in the vector tile reference documentation. - Layers tab: This example uses custom layers added and styled in the Layers tab.
- Two-layer approach: This example uses two different custom style layers from the same data source: a line layer called
contour
and a symbol layer calledcontour-label
.- The line layer,
contour
, was added by adding a new layer and specifying thecontour
source layer from the Mapbox Terrain tileset as the source and creating aline
layer. Thecontour
layer uses the default styling for line layers. - The symbol layer,
contour-label
, was added by duplicating thecontour
line layer and changing the type of layer fromline
tosymbol
.
- The line layer,
- Using formulas: The Text field for the
contour-label
layer uses a formula to calculate and display elevation in both meters and feet from theele
data property. Open thecontour-label
layer to see how the formula works.
Related resources
Looking for more guidance? Read our tutorials.
Was this example helpful?