Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Contour Colors]: It would be great to be able to change the color of contours when inside a polygon #265

Open
fallaciousreasoning opened this issue Jul 30, 2024 · 3 comments

Comments

@fallaciousreasoning
Copy link

Sorry, filing this here as I didn't want to disrupt the spec discussion:

The raster topographic maps provided by the NZ government changes the color of contour lines to blue when inside a glacier.

image

I find this makes it much easier to distinguish the feature than what opentopomap and other vector tiles generally do (which is put a white polygon with a blue outline under the contours:

image
(it's hard to see, but this map actually has a bunch of glaciers marked)

I find this makes it much easier to quickly orient yourself (by the shape/amount of glacier cover) when zoomed out.

I was thinking of extending maplibre-contour to optionally take a polygon which it should only render contours within and then have two separate sources:

  1. Does the normal maplibre contour thing
  2. Downloads the Mapbox Vector Tile & DEM for the current point extracts the glacier polygons and clips the contour lines to be inside the glacier polygons.

Do you think upstream would be interested in this? Alternatively, I could see it working if there was some maplibre-gl expression for inside which takes another polygon on the tile, but I'm a bit of a maplibre noob, so dunno if they'd be interested.

@msbarry
Copy link
Contributor

msbarry commented Jul 31, 2024

You definitely could do something just for contours in the plugin or maplibre code when this gets merged, but this problem isn't unique to contour lines. What we really want is the ability to control how maplibre blends certain layers together so we could customize it to make glacier polygons change the color of contour lines they are above, and also so that regular contour lines show up consistently above different color backgrounds.

There has been a maplibre-gl issue for this open for a while: maplibre/maplibre-gl-js#48 but people really want it so there's also a $5k+ bounty associated with it: maplibre/maplibre#269.

Here's a blog post on the benefits this would add even for regular contour lines: https://oliverwipfli.ch/color-blending-of-contour-lines-2024-04-03/

@SebZachrau
Copy link

Is it then possible to create an elevation heat map showing terrain heights with different colors using MapLibre?

Looking for examples or documentation on implementing this visualization.

elevation-heat-contour-map

@msbarry
Copy link
Contributor

msbarry commented Nov 30, 2024

The contour plugin just generates lines, not polygons. Isoband polygons might be a useful but are a bit more complex to generate.

For this particular use-case the re-colored elevation seems like it could be represented as raster so you could either convert the raster-dem images to color scale prior to serving, or register a hook using addProtocol that fetches the DEM, recolors it according to your scale, and re-encodes it as PNG client-side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants