Skip to content

Generate waterbody centerlines #1374

Open

Description

@1ec5

The tiles represent any body of water as a nameless polygon in the water_areas layer plus a named point in the water_areas_centroids layer. This produces a single point-placed label at the centroid of the waterbody. Some waterbodies are elongated or very irregularly shaped, making it more difficult for the user to find this centroid or associate it with a far-flung part of the waterbody. For example, the user is very likely to view a part of Lake Mead that is not labeled:

A single label at the centroid.

Conventionally, maps would label such a waterbody somewhat like a river, repeating a label along the “centerline”. OpenMapTiles uses osm-lakelines to generate these centerlines:

Repeated labels along two branches.

It would be great if our tiles could similarly supply stylesheets with centerlines as an alternative to the usual centroids. For backwards compatibility, we could introduce a flag on the centroids that allows stylesheets to suppress them in favor of the centerlines. Otherwise, the centerline features would have all the same attributes as the existing centroid points. We could conceivably apply this same approach to other elongated features, such as administrative areas.

Activity

  1. added theissue type on May 28, 2026
  2. Rub21 commented on Oct 20, 2026

    @Rub21
    Member

    I'm working on this in OpenHistoricalMap/ohm-deploy#890, which adds a new water_areas_centerlines layer. Elongated lakes also have a centroid in water_areas_centroids, so their name would show up twice on the map.

    To fix this, I'll remove the centroid for any lake that has a centerline. Each lake will then appear only once: as a line if it's elongated, or as a point if it isn't. OpenMapTiles does the same in its water_name layer.

  3. 1ec5 commented on Oct 20, 2026

    @1ec5
    MemberAuthor

    We have a few options for structuring these centerline labels:

    • Separate the centroids and centerlines into distinct tile layers, as you’ve done. Existing styles will silently drop labels for major waterbodies.
    • Separate the centroids and centerlines into distinct tile layers, but don’t deduplicate the features. Instead, any centroid that duplicates a centerline has a has_centerline attribute on it that the style can use to suppress the centroid.
    • Combine the centroids and centerlines into the same tile layer. This is ideal from a styling standpoint: existing stylesheets will continue to label all waterbodies without any changes. MapLibre automatically positions a symbol at the midpoint of the centerline or flows the symbol along the centerline, depending on the style layer’s layout properties. This also gives styles the flexibility to label waterbodies using point labels at certain zoom levels where a curved label may be too difficult to follow. However, water_areas_centroids would become a misnomer. We might have to rename the layer anyways.
  4. Rub21 commented on Oct 22, 2026

    @Rub21
    Member

    I added the lake centerlines to a new layer, water_name (z8–20). It has a point for regular lakes and a centerline for elongated lakes, never both.

    water_areas_centroids stays the same as before, points only, so current styles keep working. Once our styles move to water_name, we can drop it.

    e.g:
    https://vtiles.ohmstaging.org/#9.65/-5.3037/29.1001
    Image

  5. 1ec5 commented on Nov 20, 2026

    @1ec5
    MemberAuthor

    Centerlines are available in the tiles, but we need to make use of them in the stylesheets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions