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
Merge Point and Centroid in a single layer - vector tiles for simplified styling #1040
Currently in the VTiles, we have some layers representing areas from which we’ve extracted centroids to improve map styling. However, in some cases, we are duplicating layers: one containing points directly from OHM data, and another containing centroids derived from area geometries. For example:
• water_areas → we also have a layer called water_areas_centroids
• amenity_areas → we also have amenity_areas_centroids, and additionally amenity_points
• landuse_areas → we also have landuse_areas_centroids, and also landuse_points
• other_areas → we also have other_areas_centroids, and also other_points
To reduce the number of layers in the stylesheet, it might be worth considering combining both the points and the centroids into a single layer, since they represent the same type of data. We could use a distinguishing attribute like source—similar to the approach we’re taking with the buildings layer. #940 (comment)
Yes please. The style specification has always had a built-in operator for distinguishing between point, linear, and polygonal features, so no additional attribute should be necessary.
We’ll need to coordinate this change with @tsinn for the official styles. I don’t know of anyone else depending on the structure of our vector tiles that specifically, but we can announce something once the change is about to land.
Yes please. The style specification has always had a built-in operator for distinguishing between point, linear, and polygonal features, so no additional attribute should be necessary.
it works for this data type point/line/polygon, but I mean, in case we may need a styling attribute to distinguish between direct points and derived centroids.
If I’m not mistaken, a derived centroid point’s source_type would be way or relation, right? So the stylesheet could detect a direct point as having both a geometry-type of point and a source_type of node.
After evaluating the current landuse_areas_centroids and landuse_points layers in the map styles, we found they are used starting at zoom level 10. However, in the vector tiles, they are currently available from zoom level 3. Since we are now refactoring them into a single landuse_points_centroids layer, this new layer will start at zoom level 10 to align with the map style usage and reduce the overall vector tile size.
changed the title [-]Proposal to combine Point and Centroid layers in vector tiles for simplified styling[/-][+]Merge Point and Centroid in a single layer - vector tiles for simplified styling[/+]on May 8, 2025
I’ve added the layers that merge points and centroids, based on the document I extracted from map-styles, which outlines from which zoom level each layer is used.
For most point layers, they are used starting from zoom level 14, except for landuse, which is used starting from zoom 10. according to the document
The new layers are more complete and include additional information—for example, the area field (height for buildings), which is derived from the original polygons. This field is only present when the point comes from polygons; otherwise, it will be null.
Also, most centroids are filtered to include only polygons that have a name. If a polygon doesn’t have a name, a centroid is not created.
@tsinn@1ec5 Regarding place_points and land_ohm_centroids, both represent boundary points. Do you think it’s appropriate to merge them into a single layer, as we did with other layers?
Also, the layers land_ohm_lines, land_ohm_centroids, and land_ohm_maritime would benefit from more descriptive names, as they all represent boundaries.
After reading more about the documentation on place and boundary, it seems they serve different purposes and merging them is not ideal. The place tag is typically used in a more informal or descriptive way and can be applied to points or polygons. On the other hand, boundary=administrative with admin_level is used to define official administrative divisions. Therefore, it’s better to keep them separate based on their intended use.
So my proposal is to create centroids from place_areas and combine them with the existing place_points, while keeping them in a separate layer from the boundary centroids.
What do you think?
Sounds good at a glance. place=* is a tricky one because there are a few exceptions like place=square. Fortunately, place=square areas are correctly showing up in place_areas on staging.
I've been reviewing today, and testing in Maputnik with the staging tiles. I'm curious about the landuse points - the landuse_points_centroids are not pulling in all of the landuse_points and landuse_areas_centroids. But they should be, right? And landuse_points_centroids should be replacing both of those individual layers in the style JSON? That was my understanding. Here's an area to review: https://vtiles.staging.openhistoricalmap.org/#15.38/50.47062/30.513213 and seen in the screenshot below. Note that I changed the color of landuse_points in the screenshot to make it easier to visually differentiate.
The ST_MaximumInscribedCircle(geometry).center in PostGIS finds the center of the largest circle that fits within a given geometry, including polygons. The centroid of a polygon is the center of gravity of that polygon, and while they are related, they are not always identical, especially for non-regular polygons.
There could be some variation when PostGIS is generating the centroids, since both are being generated in different functions but using the same geo function.(ST_MaximumInscribedCircle(geometry)).center AS geometry so I think it is fine for now.
For this area,
I had been considering only landuse points with names, but since the area contains trees, I’m going to consider all features from landuse_points.
Generally, this looks very good to me. In my testing, I think I've swapped out all of the previous points for points_centroids layers in the style JSON.
Per our last meeting, a question came up about how much the tile size has increased with the addition of the new layers. I’ve been reviewing the impact after adding the new *_points_centroids layers for Places, Transport, Other, Landuse, Buildings, and Amenity. I’ve noticed that some tiles have grown by 1 KB to 20 KB, which I believe is a reasonable increase. As mentioned earlier, these new layers will eventually replace existing ones once the styles are finalized.
It seems that Connor-Sebastian-S/Archive-story-map and FBLordn/DateTheMap have not implemented the migration yet. Currently, we no longer support the transport_points layer.
Activity
1ec5 commentedon Apr 30, 2025
Yes please. The style specification has always had a built-in operator for distinguishing between point, linear, and polygonal features, so no additional attribute should be necessary.
We’ll need to coordinate this change with @tsinn for the official styles. I don’t know of anyone else depending on the structure of our vector tiles that specifically, but we can announce something once the change is about to land.
Rub21 commentedon Apr 30, 2025
it works for this data type point/line/polygon, but I mean, in case we may need a styling attribute to distinguish between direct points and derived centroids.
1ec5 commentedon May 1, 2025
If I’m not mistaken, a derived centroid point’s
source_typewould bewayorrelation, right? So the stylesheet could detect a direct point as having both ageometry-typeofpointand asource_typeofnode.Rub21 commentedon May 6, 2025
After evaluating the current landuse_areas_centroids and landuse_points layers in the map styles, we found they are used starting at zoom level 10. However, in the vector tiles, they are currently available from zoom level 3. Since we are now refactoring them into a single landuse_points_centroids layer, this new layer will start at zoom level 10 to align with the map style usage and reduce the overall vector tile size.
Doc: https://docs.google.com/spreadsheets/d/1Z36eTkEx-SsLK2z_gKPf1aGx0WroeRAN72A4pAF6IEw/edit?usp=sharing
[-]Proposal to combine Point and Centroid layers in vector tiles for simplified styling[/-][+]Merge Point and Centroid in a single layer - vector tiles for simplified styling[/+]Rub21 commentedon May 8, 2025
I’ve added the layers that merge points and centroids, based on the document I extracted from map-styles, which outlines from which zoom level each layer is used.
For most point layers, they are used starting from zoom level 14, except for landuse, which is used starting from zoom 10. according to the document
Added layers:
amenity
amenity_points_centroids
buildings
buildings_points_centroids
landuse
landuse_points_centroids
landuse_points_centroids
landuse_points_centroids
other areas
other_points_centroids
transport
transport_points_centroids
The new layers are more complete and include additional information—for example, the area field (height for buildings), which is derived from the original polygons. This field is only present when the point comes from polygons; otherwise, it will be null.
Also, most centroids are filtered to include only polygons that have a name. If a polygon doesn’t have a name, a centroid is not created.
Currently deployed in staging: https://vtiles.staging.openhistoricalmap.org/
cc . @tsinn @1ec5
Rub21 commentedon May 8, 2025
@tsinn @1ec5 Regarding place_points and land_ohm_centroids, both represent boundary points. Do you think it’s appropriate to merge them into a single layer, as we did with other layers?
Also, the layers land_ohm_lines, land_ohm_centroids, and land_ohm_maritime would benefit from more descriptive names, as they all represent boundaries.
tsinn commentedon May 8, 2025
Yes, thinking about this briefly, seems like a fine idea to merge into a single layer.
Rub21 commentedon May 12, 2025
After reading more about the documentation on place and boundary, it seems they serve different purposes and merging them is not ideal. The place tag is typically used in a more informal or descriptive way and can be applied to points or polygons. On the other hand, boundary=administrative with admin_level is used to define official administrative divisions. Therefore, it’s better to keep them separate based on their intended use.
place=*boundary=administrative+admin_level=*place=city,place=suburb,place=hamletboundary=administrative,admin_level=2,admin_level=8On the other hand, I noticed there are place_areas that don’t have labels shown on the map. So it seems we could extract centroids from those areas and combine them with the existing place_points, similar to what we’re doing with landuse and amenity layers.
e.g https://www.openhistoricalmap.org/relation/2513656#map=17/43.818148/146.914904&layers=O&date=1744-06-02&daterange=1-01-01,2025-12-31 , Many of these island has name but does not shows in the map.
So my proposal is to create centroids from place_areas and combine them with the existing place_points, while keeping them in a separate layer from the boundary centroids.
What do you think?
cc. @tsinn @1ec5
Rub21 commentedon May 16, 2025
I have completed the points_centroids layer for different categories. Here is a summary of the layers and their sources:
osm_place_areas,osm_place_pointsmview_place_points_centroids_z0_2mview_place_points_centroids_z3_5mview_place_points_centroids_z6_10mview_place_points_centroids_z11_20osm_transport_areas,osm_transport_pointsmview_transport_points_centroids_z14_20osm_other_areas,osm_other_pointsmview_other_points_centroids_z14_20osm_landuse_areas,osm_landuse_pointsmview_landuse_points_centroids_z10_11mview_landuse_points_centroids_z12_13mview_landuse_points_centroids_z14_20osm_buildings,osm_buildings_points_namedmview_buildings_points_centroids_z14_20osm_amenity_areas,osm_amenity_pointsmview_amenity_points_centroids_z14_20Filters and Transformations
name IS NOT NULL AND name <> ''.area > min_area, configurable per zoom levelST_MaximumInscribedCircle(geometry).centerROUND(area)::integer AS area_m2for land_ohm_centroids which is the bounduaries we manage it as area_mk2NULL AS area_m2to reduce vector tile size(osm_id, type)or(osm_id, type, class)I haven’t removed the points and centroids layers yet, as the map style hasn’t been updated. This is to avoid breaking the current map style.
This is currently running in staging: https://vtiles.staging.openhistoricalmap.org/
cc. @tsinn @1ec5
1ec5 commentedon May 19, 2025
Sounds good at a glance.
place=*is a tricky one because there are a few exceptions likeplace=square. Fortunately,place=squareareas are correctly showing up inplace_areason staging.tsinn commentedon May 19, 2025
I've been reviewing today, and testing in Maputnik with the staging tiles. I'm curious about the landuse points - the
landuse_points_centroidsare not pulling in all of thelanduse_pointsandlanduse_areas_centroids. But they should be, right? Andlanduse_points_centroidsshould be replacing both of those individual layers in the style JSON? That was my understanding. Here's an area to review: https://vtiles.staging.openhistoricalmap.org/#15.38/50.47062/30.513213 and seen in the screenshot below. Note that I changed the color oflanduse_pointsin the screenshot to make it easier to visually differentiate.Rub21 commentedon May 19, 2025
@tsinn
you are right, it should get from landuse_points and landuse_areas_centroids, I will check that
Rub21 commentedon May 19, 2025
For example, in this case, both points are extracted from the same polygon, both represents same area but they are offset. They should appear in the same position since I’m using the same function to get the centroids.
(ST_MaximumInscribedCircle(geometry)).center AS geometryhttps://vtiles.staging.openhistoricalmap.org/#19.51/50.4687089/30.5082334
I found this fro google search:
The ST_MaximumInscribedCircle(geometry).center in PostGIS finds the center of the largest circle that fits within a given geometry, including polygons. The centroid of a polygon is the center of gravity of that polygon, and while they are related, they are not always identical, especially for non-regular polygons.
There could be some variation when PostGIS is generating the centroids, since both are being generated in different functions but using the same geo function.
(ST_MaximumInscribedCircle(geometry)).center AS geometryso I think it is fine for now.For this area,

I had been considering only landuse points with names, but since the area contains trees, I’m going to consider all features from landuse_points.
https://vtiles.staging.openhistoricalmap.org/#17.73/50.467829/30.519635

tsinn commentedon May 20, 2025
Generally, this looks very good to me. In my testing, I think I've swapped out all of the previous points for
points_centroidslayers in the style JSON.Rub21 commentedon May 21, 2025
Per our last meeting, a question came up about how much the tile size has increased with the addition of the new layers. I’ve been reviewing the impact after adding the new *_points_centroids layers for Places, Transport, Other, Landuse, Buildings, and Amenity. I’ve noticed that some tiles have grown by 1 KB to 20 KB, which I believe is a reasonable increase. As mentioned earlier, these new layers will eventually replace existing ones once the styles are finalized.
https://tiler-compare.openhistoricalmap.org/tegola_interfaces/index.html#8.96/37.4316/-121.8722

Production <-------> Staging
cc @1ec5
Rub21 commentedon May 27, 2025
The changes has been merged to production,
@tsinn let me know when you complete the migration fo the styles to the new *_points_centroids layes, in order to remove the old ones.
1ec5 commentedon May 28, 2025
Following up with known third-party stylesheets:
transport_points_centroidshiddewie/OpenRailwayMap-vector#408transport_pointslayer totransport_points_centroidsConnor-Sebastian-S/Archive-story-map#1transport_pointslayer totransport_points_centroidsFBLordn/DateTheMap#45transport_pointslayer totransport_points_centroidsGreenwood-Cultural-Center/gathering_greenwood#1Rub21 commentedon Jun 26, 2025
It seems that Connor-Sebastian-S/Archive-story-map and FBLordn/DateTheMap have not implemented the migration yet. Currently, we no longer support the transport_points layer.
Rub21 commentedon Jul 29, 2025
Closing this ticket since it is completed!!