Skip to content

Better contour support for imperial units #2454

@HarelM

Description

@HarelM

Problem Statement

When changing the interface to use imperial units the contours are kept in meters.

Proposed Solution

Change contours to feet when changing UI units, similar to language change.

What alternatives have you considered or tried?

See below.

Additional information

There are a few aspects to this issue.
A possible hack, which is similar to alltrails I think is to only use a conversion formula and keep the contours in meters but present the feet value. I don't like this hack.
We can generate contours with feet and use them as alternative source. I don't like that as it will increase the download size for offline maps, server disk etc.

The most promising direction is to use maplibre-contours, which can decrease the offline download size - very appealing. The problem with this plugin is that it does not support custom protocol in the worker thread, so this won't work with our offline solution.

Brainstorming possible ideas to solve this:

  1. Implement "addProtocol" for this plugin as well (probably the easiest solution)
  2. Implement a similar maplibre plugin that uses addSourceType and inportScriptInWorkers. I think this will require to implement addProtocol inside the worker and allow this method to call the main thread to get tiles, so it's somewhat similar to 1, but avoids the need to define and implement all the actor and worker communication in the plugin.
  3. Implement this in maplibre-gl-js. I've looked at the code @msbarry wrote here: Add contour source maplibre/maplibre-style-spec#623 and his branch here: https://github.com/msbarry/maplibre-gl-js/tree/contour-source and I think the main "problem" is that it's trying to use another dem source in order to save parsing time for those tiles. The same problem exists for terrain and hillshade tile sharing obviously, the problem with both is that they don't need the same tiles, terrain need lower level zoom tiles and contours needs higher level contour tiles. Having said that, I think the workers might be able to share the processed dem tile using some LRU cache. this might solve a lot of complexities. The dem worker source code is fairly simple, using a shared worker cache might simplify some tile loading and processing, maybe IDK.

I'll continue thinking about it. Any other ideas or inputs are very welcome.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions