Summary āĀ Give the Mapbox mobile or web customer an option to show the contour-label symbol in meters or feet. We also include discussion and our thoughts on the side effects of this [feature] request.
Platform: core, but working demo shown in iOS
Mapbox SDK version: ios-v3.2.2
contour-line and contour-label). minzoom for contour-label is 11)contour-label will display as '12345 m', as the data is in meters

This has many implications that need input and architecture from the Mapbox core team ā
"contour-label" as "{ele} m"?"mountain-peak-label-with-elevation" as "{name_en}, {elevation_m}m"?Thank you for taking the time to come up with this proof of concept. As youāre probably aware, weād either want the choice of units to be explicit either at design time in the style or at runtime based on the user locale, but this area of the codebase probably isnāt well suited to unit conversion logic. The surrounding code handles various properties defined in the style according to the Mapbox GL Style Specification. Weāve started to discuss the possibility of extending the specification to handle number formatting in mapbox/mapbox-gl-style-spec#452; perhaps unit options make sense in this context.
As for placing the contour lines at different intervals, thatās largely something the source would have to implement. Different sources can provide polylines at different elevations. @lucaswoj can probably explain better. š
Thanks for the feedback on the unit conversion. Yes, are right "_sniffing for meters on every symbol and converting_" isn't well suited. Empirically, we checked several large mountain peaks to see if the contour levels in feet still made sense. We wanted to make something real, rather than slide ware. We will not create a pull request, as it's the wrong architecture.
@lucaswoj, if you have any pointers on source data that may have contour levels in feet, rather than meters, then it would solve all. Then the style JSON could just deal with the units as a label, instead of the conversion.
The raw elevation data and prebuilt contour geometries are available from USGS. They can be hard to work with due to their size. We have some internal projects underway to make this easier to work with but nothing to announce yet.
I wish you luck and regret that I can't provide more help! This is a Hard Problem.
Now that the iOS and macOS SDKs support runtime styling, itās possible for MGLMapView to automatically swap meters for feet, at least in mountain peak elevation labels, without requiring any changes to mbgl. mapbox/mapbox-gl-language#9 discusses the same approach but geared toward GL JS.
Hi,
whats the point in changing the mountain peak to ft whereas the contour labels stay with meter?
Are there any plans to offer {elevation_ft} for contour-label as its available for mountain-peak-label?
@roesneb ā you bring up a good point, and this indeed is a hard problem to solve. My original proposal from a year ago had its own problems. My contour lines were drawn in metric, as it is how the Mapbox contours were made, but the units were converted to Imperial. Still not the right solution.
In order to offer both imperial and metric units for contours would mean the map tile service would have to serve up two distinct layers of contours.
I've studied this quite extensively, and the best solution I could come up with is to make my own contours in Imperial units using USGS data. The contour data set could be large. For the region of San Diego County, California the vector tiles was 100 MB.
Comparison between š¦ Ļ Maps, Klokantech Terrain, and Mapbox Outdoors.
Map | Contour Lines | Contour Labels |
| ------------- |-------------| -----|
| Original Proposal | Metric | Imperial converted from Metric. Lines are still Metric!! |
| š¦ Ļ Maps | Imperial using raw data from USGS | Imperial |
| Klokantech Terrain | Metric | Metric |
(left to right) š¦ Ļ Maps, Klokantech Terrain, Mapbox Outdoors, š¦ Ļ (USGS) + Mapbox (Metric)




Hot Springs Mountain, highest point in San Diego County
Weāve started to discuss the possibility of extending the specification to handle number formatting in mapbox/mapbox-gl-style-spec#452; perhaps unit options make sense in this context.
As of #9439, the style JSON can now contain freeform mathematical expressions, which makes it much easier to implement unit conversions for labels. Runtime styling support for expressions has landed on Android as of #10654, and iOS/macOS support will land in #10726. In Swift, demetricating the label would look like this:
// Convert to feet, round down, cast to a string, and append āftā.
contourLabels.text = NSExpression(format: "mgl_join({CAST(mgl_round(ele / 0.3048), 'NSString'), ' ft'})")
(Iām working on a more concise way to append strings, but the unit conversion itself is pretty concise.)
But to @roesnebās point, a more complete solution would require moving the contours to more appropriate intervals. One approach would be for the source to provide contours at closer intervals, relying on the layer to filter out minor contours. Mapbox Terrain does support variable density, keyed on the index field. However, Iām unsure whether the density is sufficient.
/cc @mollymerp @kkaefer
@1ec5 for reference: client side contour generation ticketed here https://github.com/mapbox/mapbox-gl-js/issues/5844
Hello,
I work for Recreation.gov and we are rebuilding the entire website and system as we speak. Going live with this new effort this October. We will be including an interactive MapBox map on the new site showing campgrounds, campsites, and other federal recreation-related features/places. We are interested in using a MapBox base layer with contours labeled in feet rather than meters (or at least would like the option to toggle between them). Is there an update on the problem with being able to show contours in feet in MapBox?
@GitStu āĀ Our team has solved this problem of "contours in feet" by processing USGS contour lines as Mapbox vector tiles.
The solution for Rec.gov could be similar:
See a live map of the San Bernardino National Forest, http://RobLabs.com/sbnf that has contours in feet and USFS campsites.

Thanks much! Another quick question: do you use authoritative federal roads data too? Such as campground loop roads?
Yes, we use authoritative federal roads data, so campground loop roads do show up. Some forests have "Yellow Posts" campgrounds and those are fairly well documented on the FS web sites, but the loop roads with campsites doesn't seem to be published.
@roblabs it would seem the tilesets are huge? I haven't been able to get them under the upload limit.
Can anyone tell me how we can request Mapbox to remove sensitive data from one of its base layers?
@GitStu If the site/app is following Mapbox ToS, there will be an āImprove this mapā link in the attribution āĀ that site will guide you through reporting issues.
Thanks. I tried that but there is no map to locate the place I need to identify. See screen grabā¦
[cid:[email protected]]
FYI - This wasnāt working in Chrome or IE 11, but I got it to work in Firefox.
@GitStu letās keep this issue on topic āĀ please feel free to report issues via our website.
Will do. Sorry about that.
Hello @davem2020,
Regarding your question on the size of the tiles:
@roblabs it would seem the tilesets are huge? I haven't been able to get them under the upload limit.
Here are some solutions that We have used to work with large tile sets
Thanks for the explanation. I will have to explore tippecanoe. I had been uploading the shp file directly to mapbox which quickly exceeded the 260 mg limit.
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
Most helpful comment
Now that the iOS and macOS SDKs support runtime styling, itās possible for MGLMapView to automatically swap meters for feet, at least in mountain peak elevation labels, without requiring any changes to mbgl. mapbox/mapbox-gl-language#9 discusses the same approach but geared toward GL JS.