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

Use area visual center for label #1108

Closed
Karry opened this issue Aug 16, 2021 · 5 comments
Closed

Use area visual center for label #1108

Karry opened this issue Aug 16, 2021 · 5 comments
Assignees
Labels
feature For issues and pull request that request or implement a new feature renderer For issues in the content of the rendering engine

Comments

@Karry
Copy link
Collaborator

Karry commented Aug 16, 2021

We are using bounding box center for placing label on map. It is simple and fastest method. But for some natural areas, like islands or lakes its label may be located outside the area. For example "Císařský ostrov" islet in Prague:

Snimek_20210806_001

It would be great to use some precise method for placing label on areas (rings). We can try to use Polylabel algorithm from Mapbox. This method should be fast, code is available in C++ under terms of ISC license, that should be compatible with LGPL. It should be easy to adapt this code to libosmscout.

Not to degrade performace, this algorithm may be used just for some types. Or label position (visual center) may be computed during import time and stored in database.

@Framstag
Copy link
Owner

Yes, sounds interesting. I think import time would be wise for calculation. We can add it as an optional point to the polygon (triggered by some flag). Since we have to handle a huge number of polygons on import, we would need a very selective filter to even start the calculation - likely size (bigger buildings and bigger?) and possibly even types?

@Framstag
Copy link
Owner

I also think for relation based polygons there is a way to define the center. So this can be also evaluated?

@Karry
Copy link
Collaborator Author

Karry commented Oct 12, 2021

I also think for relation based polygons there is a way to define the center. So this can be also evaluated?

As far as I know, such center may be defined for administrative regions possibly other relation types, but it is not used for natural objects like lakes, islands...

@Karry
Copy link
Collaborator Author

Karry commented Oct 12, 2021

I have this task on my todo list, but not on the top :-) I would be happy if someone else will make this improvement.

@Karry Karry added feature For issues and pull request that request or implement a new feature renderer For issues in the content of the rendering engine labels Oct 12, 2021
@Karry Karry self-assigned this Feb 6, 2022
@vyskocil
Copy link
Collaborator

vyskocil commented Feb 7, 2022

@Karry great addition to the renderer ! And I also love Troja, young I spent a lot of time there with my parents and still go there almost every time I travel to Prague :-)

@Karry Karry closed this as completed Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature For issues and pull request that request or implement a new feature renderer For issues in the content of the rendering engine
Projects
None yet
Development

No branches or pull requests

3 participants