You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tiler should generate centroid points for named non-boundary areas #543
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.
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:
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:
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.
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.
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:
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.
@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)
👋 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
Activity
vknoppkewetzel commentedon May 30, 2023
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.
jeffreyameyer commentedon May 31, 2023
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
1ec5 commentedon Aug 9, 2023
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:
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:
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 withtransparentanyways.Moving across the street, this building is labeled twice even though it doesn’t cross any tile boundary.
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.
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=*andamenity=*. 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:
GL JS knows it’s the same feature in each tile:
Not sure why it won’t consolidate these features into one.
1ec5 commentedon Aug 10, 2023
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_CentroidorST_PointOnSurfaceorST_MaximumInscribedCirclepoints.danrademacher commentedon Mar 27, 2024
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
jeffreyameyer commentedon Mar 27, 2024
17 remaining items
jeffreyameyer commentedon Jun 25, 2024
@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)
vknoppkewetzel commentedon Jun 26, 2024
Hey @jeffreyameyer thanks for the ping! I was out on vacatoin last week - I can get to work on this this week ✅
vknoppkewetzel commentedon Jun 26, 2024
👋 I see
other_areasin the stylesheet, but these are all fills, not labels, so not sure what the associatedother_areas_centroidsis meant to be pointing to (in terms of symbols/labels). Did make updates for the rest of the list, howevervknoppkewetzel commentedon Jun 26, 2024
The above updates are in the
map-stylesrepo, and can be seen in the demo style: https://openhistoricalmap.github.io/mbgl-timeslider/demo/#14.328/51.50486/-0.15966/1850,-4000-2023todrobbins commentedon Jun 28, 2024
Looks terrific, @vknoppkewetzel!

vknoppkewetzel commentedon Jul 25, 2024
done in OHM ✅