-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Show the contour-label symbol in meters or feet #5018
Comments
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? |
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'})")
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 #10642 is adding new source types for rawer vector terrain data. While that PR is focused on hillshading effects, I wonder if it would unblock generating these terrain contour geometries on the client side as well. /cc @mollymerp @kkaefer |
@1ec5 for reference: client side contour generation ticketed here mapbox/mapbox-gl-js#5844 |
Hello, |
@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:image001.png@01D42D6F.8C3D14A0]
|
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:
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. |
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
Steps to trigger behavior
contour-line
andcontour-label
).minzoom
forcontour-label
is 11)contour-label
will display as '12345 m', as the data is in metersProposed [feature]
Actual behavior
Background
Mapbox Architecture
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"
?The text was updated successfully, but these errors were encountered: