Skip to content
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

The name of a building doesn't show up #4129

Closed
maro-21 opened this issue Apr 27, 2020 · 4 comments
Closed

The name of a building doesn't show up #4129

maro-21 opened this issue Apr 27, 2020 · 4 comments

Comments

@maro-21
Copy link

maro-21 commented Apr 27, 2020

The name of a building doesn't show up
https://www.openstreetmap.org/way/101424849

@jeisenbe
Copy link
Collaborator

Screenshot:

Screen Shot 2020-04-28 at 21 52 37

It appears that the building text is blocked the icons for the doctor's office, Luxmed, which is inside of the building at the point where the label should render.

This is a bit surprising, but because of the odd shape of the building, the label is supposed to appear in the right corner.

At z20 the building name is rendered, on my test server:

export-5

Unfortunately, with the current tools used to render this style, there is not a good option for adjusting the position of text labels. With a new version of Mapnik it might be possible to use a different label placement strategy (grid) - but this might not work with vector tiles

We could adjust the priority of building names to be higher than doctor's offices, but in that case the doctor's office symbol or name would not be rendered.

@maro-21
Copy link
Author

maro-21 commented Apr 29, 2020

I added the name of this building and Luxmed at the same time and I thought the name will appear in the middle, so that's why I chose such position for the doctors.
Luxmed is not necessarily at this side, it is inside the building somewhere, so I can move the icon, it doesn't matter where it is. But this doesn't solve the issue for other buildings with similar shape.

I was expecting the name to appear in the middle. Why is it on the right? The building is symmetrical, I think.

@jeisenbe
Copy link
Collaborator

The name label for buildings (and other polygons with a text label) is placed on a point which is calculated by ST_PointOnSurface in PostGIS. Calculating the "center" of a complex area, from a human standpoint, can get quite complex, so to save processing time the algorithm is not so fancy.

https://gis.stackexchange.com/questions/76498/how-is-st-pointonsurface-calculated

"ST_PointOnSurface() works roughly like this, if the geometry is a polygon:"

"Trace an east-west ray, lying half-way between the northern and southern extents of the polygon.
Find the longest segment of the ray that intersects the polygon.
Return the point that is half-way along said segment."

Actual code used is here: https://github.com/libgeos/geos/blob/38b479b73be2535925e268ec6a5a0af0a278f364/src/algorithm/InteriorPointArea.cpp#L163

In the past, the Mapnik "interior" algorithm was used for labels. This sometimes resulted in better label placesments, but other times the placement was worse. Unfortunately, good label placement algorithms are complex and computationally expensive, so they are difficult to use with this map style, which is primarily intended for the standard map on openstreetmap.org, which needs to provides very frequent updates for the whole globe.

If someone is interested in developing a better algorithm for use in PostGIS, I would be interested in trying that here. But it would need to be not too much slower than ST_PointOnSurface.

@jeisenbe
Copy link
Collaborator

jeisenbe commented Apr 29, 2020

See #3857 to continue discussion about the problems with labeling using ST_PointOnSurface. See #3880 to continue discussion about symbol and label prioritization

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

No branches or pull requests

2 participants