メインコンテンツまでスキップ

Convert units

  • This is a modified version of the Streets template style.

  • Two new layers were added: contour and contour-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 a symbol 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. The contour source layer contains the geometry for each contour line and two properties: index and ele. The ele 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 called contour-label.
    • The line layer, contour, was added by adding a new layer and specifying the contour source layer from the Mapbox Terrain tileset as the source and creating a line layer. The contour layer uses the default styling for line layers.
    • The symbol layer, contour-label, was added by duplicating the contour line layer and changing the type of layer from line to symbol.
  • Using formulas: The Text field for the contour-label layer uses a formula to calculate and display elevation in both meters and feet from the ele data property. Open the contour-label layer to see how the formula works.

Looking for more guidance? Read our tutorials.

このexampleは役に立ちましたか?