Skip to content

Tiler should generate centroid points for named non-boundary areas #543

Closed

Description

@jeffreyameyer

Style change requested

Right now, areas are getting labeled with what appears to be a somewhat random placement of the name=* tag.

See: Maymont House & Park
image

If there's any way around this, even if it requires users to create label points, that would be great.

Right now, the labeling looks random/inexplicable and it's too dense at a lot of zooms.

Activity

  1. vknoppkewetzel commented on May 30, 2023

    @vknoppkewetzel

    Hey @jeffreyameyer yes! The path forward here would be something like the below:

    Taking larger polygons (like parks, or other relevant large polygons) and creating centroid points from them, and utilizing that point layer for labels. For any areas that are multi-polygon, a clean-up of repeat labels would happen. This can be randomly chosen or done intentionally with the multi-polygon area turned points, the intentional choosing being done by a human of course. that is just more time intensive.

  2. jeffreyameyer commented on May 31, 2023

    @jeffreyameyer
    MemberAuthor

    Ok - is that something we need to automate in the a) vector tile generation, and if so, b) can it be overridden if a manual label is present?

    cc: @danrademacher

  3. 1ec5 commented on Aug 9, 2023

    @1ec5
    Member

    Taking larger polygons (like parks, or other relevant large polygons) and creating centroid points from them, and utilizing that point layer for labels. For any areas that are multi-polygon, a clean-up of repeat labels would happen. This can be randomly chosen or done intentionally with the multi-polygon area turned points, the intentional choosing being done by a human of course. that is just more time intensive.

    GL JS is capable of automatically labeling an area at its centroid as long as the style includes a point-placed symbol layer. It also attempts to merge features across tile boundaries when determining label placement. For example, Americana labels East Fork Lake State Park only once, at the centroid, even though the tiles only contain polygons – no one has manually mapped a node at the centroid to also represent the park.

    One issue is that the OHM styles contain eight different style layers attempting to render the same polygon feature. For example, if you click on the industrial area in this inspector style (which only lists features that are being drawn), you’ll see a popup listing this way eight times:

    Rozzi’s Famous Fireworks

    Running the following code in the console confirms that there are eight rendered features, one per style layer, all tied to the same feature in the source layer:

    map.queryRenderedFeatures().map(f => f.layer.id) 

    Array(9) [ "landuse_areas_z12_developed_open_space", "landuse_areas_z12_food_and_farming", "landuse_areas_z12_watercover", "landuse_areas_z12_landcover_tall", "landuse_areas_z12_landcover_short", "landuse_areas_z12_localized_land_use", "landuse_areas_z12_underlying_land_designation", "landuse_areas_z12_generalized_land_use", "land" ]

    However, all of these layers are fill layers, not symbol layers, so they aren’t the root cause, but the wasted memory usage probably adds up quite a bit. These style layers should specify filters to avoid snagging features that they’d end up filling with transparent anyways.

    Moving across the street, this building is labeled twice even though it doesn’t cross any tile boundary.

    Deer Run Shelter

    Apparently there are two features in the vector tiles, one in the building layer and one in an amenities layer. These features are being labeled by two different symbol layers, one for buildings and one for all areas, so GL JS won’t deduplicate the labels. Instead, it pushes one of the labels away from the centroid so it can show both.

    map.queryRenderedFeatures().filter(f => (f.id === 198837780 || f.properties.osm_id === 198837780) && f.layer.type === "symbol").map(f => f.sourceLayer) 

    Array [ "amenity_areas", "buildings" ]

    map.queryRenderedFeatures().filter(f => (f.id === 198837780 || f.properties.osm_id === 198837780) && f.layer.type === "symbol").map(f => f.layer.id)

    Array [ "points_of_interest_fromareas", "points_of_interest_frombuildings" ]

    This duplication tends to happen when a feature is dual-tagged as different categories of things. In this case, the building is functioning as a shelter, so it gets both building=* and amenity=*. Eliminating dual-tagging would have some benefits, but it would require us to depart quite a bit from OSM tagging, making components such as iD more difficult to maintain.

    Now for the surrounding park, which is being labeled once per tile, despite what I said above about merging features across tile boundaries:

    map.showTileBoundaries = true 

    Symmes Township Park

    GL JS knows it’s the same feature in each tile:

    map.queryRenderedFeatures().filter(f => f.layer.type === "symbol" && f.properties.osm_id === 198837734).map(f => f.id)

    Array(3) [ 647531, 647531, 647531 ]

    Not sure why it won’t consolidate these features into one.

  4. 1ec5 commented on Aug 10, 2023

    @1ec5
    Member

    GL JS is capable of automatically labeling an area at its centroid as long as the style includes a point-placed symbol layer. It also attempts to merge features across tile boundaries when determining label placement. For example, Americana labels East Fork Lake State Park only once, at the centroid, even though the tiles only contain polygons – no one has manually mapped a node at the centroid to also represent the park.

    I was mistaken – GL JS doesn’t automatically merge a polygon’s point-placed symbols across tile boundaries. Americana’s park labels are actually a good example of Planetiler (OpenMapTiles) synthesizing a point feature at the area’s centroid. (I just missed that point feature because it wasn’t rendering on the Americana tile inspector map for some reason.)

    So solving this issue would most likely entail beefing up the TOML file to include some ST_Centroid or ST_PointOnSurface or ST_MaximumInscribedCircle points.

  5. danrademacher commented on Mar 27, 2024

    @danrademacher

    Shifting this over to Ruben and Sanjay so we can work out how to find a solution to adding a centroid point to the data that we can hang a label on

  6. jeffreyameyer commented on Mar 27, 2024

    @jeffreyameyer
    MemberAuthor
    • Modify TOML to create centroid points for polygons and put them in appropriate layers
    • Modify existing style sheets to remove the existing tessellated tiles
  7. 17 remaining items

  8. jeffreyameyer commented on Jun 25, 2024

    @jeffreyameyer
    MemberAuthor

    @vknoppkewetzel - any idea of timeframe for getting a style for this up on staging? Any chance for June? (I'm sending out a 6 month update on the forum soon)

  9. vknoppkewetzel commented on Jun 26, 2024

    @vknoppkewetzel

    Hey @jeffreyameyer thanks for the ping! I was out on vacatoin last week - I can get to work on this this week ✅

  10. vknoppkewetzel commented on Jun 26, 2024

    @vknoppkewetzel

    👋 I see other_areas in the stylesheet, but these are all fills, not labels, so not sure what the associated other_areas_centroids is meant to be pointing to (in terms of symbols/labels). Did make updates for the rest of the list, however

    image

  11. vknoppkewetzel commented on Jun 26, 2024

    @vknoppkewetzel
  12. moved this from TODO Soon to In Demo Styles in OHM Cartoon Jun 27, 2024
  13. todrobbins commented on Jun 28, 2024

    @todrobbins

    Looks terrific, @vknoppkewetzel!
    image

  14. moved this from Todo - Known Path to Ready for staging in OpenHistoricalMap Dev Planningon Jul 11, 2024
  15. moved this from Ready for staging to On Staging in OpenHistoricalMap Dev Planningon Jul 19, 2024
  16. moved this from On Staging to On Staging + Tested (Dan?) in OpenHistoricalMap Dev Planningon Jul 23, 2024
  17. moved this from On Staging + Tested (Dan?) to Done in OpenHistoricalMap Dev Planningon Jul 24, 2024
  18. vknoppkewetzel commented on Jul 25, 2024

    @vknoppkewetzel

    done in OHM ✅

  19. moved this from In Demo Styles to Done in OHM Cartoon Jul 25, 2024
  20. added theissue type on Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions