-
Notifications
You must be signed in to change notification settings - Fork 819
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
Switch to ST_PointOnSurface? #1644
Comments
This comment has been minimized.
This comment has been minimized.
Note resorting to ST_PointOnSurface() to accommodate vector tiles workflows would codify the current bad quality label placement even if mapnik should in the future allow better quality - you would be limited in possible improvements to such offered by the database engine which are unlikely to be within its scope. Ultimately good quality labeling is simply diametrical to the idea of a strictly tiled approach to rendering. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm reopening this since a few things have changed and we should look at the decision in light of them
|
The argument in #1644 (comment) still applies i think but this is based on the assumption that Mapnik would eventually offer more sophisticated label placement - which is unlikely given that Mapnik is essentially a dead horse. The idea that you could generate points from polygons from within SQL that are universally significantly better for labeling is probably not realistic though - this too much depends on font size, actual label text, surrounding labels and other stuff. |
Both Mapnik and ST_PointOnSurface just generate a point and place the label. If at some point there were an option that considered label size and surroundings, we could look at it, but for now, that doesn't matter. |
Well - i guess my main point here is that ultimately ST_PointOnSurface() is going to be a dead end regarding quality label placement but Mapnik likely is as well so it really does not matter. |
There are more ideas to improve Mapnik algorithm: The question is if someone will try to code a better solution and which one is acceptable regarding speed and complexity. |
I added this issue to the vector tiles project. |
Resolves gravitystorm#1644. This is a necessary step towards vector rendering (see gravitystorm#1644). As this changes the label placement algorithm for polygons, this causes differences in label placement. (SQL deliberately not indented to increase readability of the diff.)
Resolves gravitystorm#1644. This is a necessary step towards vector rendering (see gravitystorm#1644). As this changes the label placement algorithm for polygons, this causes differences in label placement. (SQL deliberately not indented to increase readability of the diff.)
Resolves gravitystorm#1644. This is a necessary step towards vector rendering (see gravitystorm#1644). This is a second trial of gravitystorm#3228, based on the word by @pnorman in gravitystorm#3233. This is a first step, once we have this than we can probably merge the point and poly layers (for example amenity-points and amenity-points-poly).
PRs #3233, #3690, #3712, #3781, and #3874 have switched the layers But it was noted that It looks like the |
I believe all relevant layers have been switched to ST_PointOnSurface, so this issue is resolved. |
In vector tiles, polygons cannot be used for labeling, as polygons are clipped to the vector tile bounds.
This is a particular problem for non-PostGIS datasources, but for PostGIS ones, the standard solution is to use ST_PointOnSurface. #349 found that it was not really better or worse than Mapnik label placement.
#349 (comment) raised the possibility of performance concerns. I am not sure, but there are a couple of ways this can be addressed
Appropriate use of
!bbox!
.(SELECT ST_PointOnSurface(way) AS way FROM planet_osm_polygon) AS p
does not work because the geometry filtering condition used isST_PointOnSurface(way) && !bbox!
.The appropriate way to write the query is
This will then use indexes to limit the data fetched, with a second filtering taking place in the outer select added by Mapnik. A functional index on
ST_PointOnSurface(way) WHERE name IS NOT NULL
could also help.I don't know if @mrwojo did this when testing. If not, it could easily explain any performance differences.
Where this is both a point and a polygon layer, these can be combined into one query with
UNION ALL
The text was updated successfully, but these errors were encountered: