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

Inconsistent priorities of region/city names at levels 5 and 6+ #3034

Open
andrzej-r opened this issue Jan 24, 2018 · 6 comments
Open

Inconsistent priorities of region/city names at levels 5 and 6+ #3034

andrzej-r opened this issue Jan 24, 2018 · 6 comments

Comments

@andrzej-r
Copy link
Contributor

Some, countries (Poland, Italy, Austria, Romania, Greece, Turkey, Ukraine, Syria, Iraq, Iran, Bangladesh, Korea, Japan, Nigeria, Peru, Ecuador, Mexico, Colombia, Mexico) are divided into relatively small administrative regions. In all these countries, at zoom 5, the map shows names of key cities and names of the regions are hidden - I have no problem with that, I often find city names more recognizable than region names, especially when looking at a map of a country I am not familiar with.

However, at zoom levels 6+ the region names are added to the map at higher priority than the names of the key cities. As these cities are often centres of the respective regions, the labels sometimes collide and the names of the cities remain hidden at zoom levels 6+ until there is enough space to fit both. This is inconsistent and confusing - I see a name of the city, try to zoom to it only to find it disappear and reappear 2-3 zoom levels later.

Suggested solutions:

  • Names of large cities should keep their priority over region names at zoom levels 6+ (consistent with current behaviour at zoom level 5)
  • Alternatively, at zoom level 5 the map should display region names instead, or in addition, to the names of large cities.

Possible workarounds:

  • Manually move region labels away from the cities
  • Block city names from being displayed at level 5
  • Improve layout engine to automatically move region labels when possible (assuming there is space for both).

The above is not the only example of such inconsistencies. Similar issue affects India, China, Brasil when switching between levels 4 and 5 (with USA, Russia and Australia probably dealing with it by manual positioning of labels or removing names of large cities).

@kocio-pl
Copy link
Collaborator

kocio-pl commented Jan 24, 2018

Related to #1391.

Improve layout engine to automatically move region labels when possible (assuming there is space for both).

This solution is under way, see #2962 (comment).

The rest of suggestions needs to be tested.

@matthijsmelissen
Copy link
Collaborator

In all these countries, at zoom 5, the map shows names of key cities and names of the regions are hidden

This is not true in general, and there is no difference between z5 and z6.

What is happening that state names are not displayed if the state is too small (measured in pixels), and this is more likely to occur on z5.

@andrzej-r
Copy link
Contributor Author

andrzej-r commented Feb 9, 2018

Thank you for the explanation. I think I now understand how it happens.

Perhaps (assuming we are happy with keeping the priorities) would be better not to limit the area for state labels and let mapnik decide what labels get to be displayed.

That is, instead of:

.state {
  [zoom >= 5][way_pixels > 3000][way_pixels < 196000] {

Use:

.state {
  [zoom >= 5][way_pixels < 196000] {

Unfortunately, I cannot test it because my laptop is not capable of importing larger databases.

For reference, I've checked what other online maps are doing and although the principle is roughly the same there are quite a few detail differences:

  • They display region names only in countries where there is a strong tradition of using them (USA, China, India, etc), many region names (e.g. most European counties). Even then, state labels (except USA) disappear at fairly low zoom levels.
  • Where the state labels are displayed they don't seem to be filtered by the state size and they do take priority over cities. They appear/disappear all at once depending on the zoom level. The zoom levels depend on the country. Perhaps the algorithm checks the worst-case state size in a given country.
  • State/region labels seem to be positioned manually not to obstruct other information.
  • City labels can move to better locations at certain zoom levels - most likely an algorithmic solution.

@kocio-pl
Copy link
Collaborator

kocio-pl commented Feb 9, 2018

You can export partial data for testing (like only admin boundaries and places), for example like this: #2688 (comment).

@andrzej-r
Copy link
Contributor Author

BTW, I've just seen http://tile.openstreetmap.fr/ and really liked their implementation.

At low zoom level they show a country name, region boundaries and a location of the capital.

Then, at the next zoom level, there are region names, name of the capital, and perhaps a couple of big cities.

At the next zoom level region names disappear completely leaving space for the names of cities.

This is a simple, easy to understand and use behaviour. I think we are trying to display too many things too early and keep them on the map for too long. One zoom level for region names should be enough.

@imagico
Copy link
Collaborator

imagico commented Nov 15, 2022

This is essentially a duplicate of #1391 - however that issue was essentially repurposed into discussing new label placement methods - which would not actually solve the issue at hand. So i am making this the main issue and closing #1391.

The core of the problem is

  • we render admin_level=4 boundary relation labels starting z4 with a variable zoom level dependent way_area threshold.
  • we render place=city labels starting z4 with a variable zoom level dependent score threshold.
  • we prioritize boundary relation labels universally before the place=city labels.

And as a result labels inconsistently vanish as you zoom in - which is an unavoidable direct result of the described methodology.

The solution to this that would universally prevent the problem would be to combine both in the same layer and order in SQL by effective starting zoom level. See also #3880.

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

4 participants