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

Too large font for places_region #183

Open
Edefritz opened this issue Nov 17, 2023 · 10 comments
Open

Too large font for places_region #183

Edefritz opened this issue Nov 17, 2023 · 10 comments

Comments

@Edefritz
Copy link
Contributor

Edefritz commented Nov 17, 2023

Description
As far as I understand, the places_region layer renders names of states/regions. While this works well for US states, it creates comparatively huge labels for regions in other parts of the world.
The region labels are larger than the country labels and somehow make the map appear cluttered.

I think this is both, a data and a style "issue".

There also seems to be a bug as US state labels seem to disappear after z7 but the state labels in other parts of the world remain rendered:
https://maps.protomaps.com/#map=7.52/42.67/-107.473&theme=light&renderer=maplibregl&tiles=https://build.protomaps.com/20231120.pmtiles
https://maps.protomaps.com/#map=9.64/52.7965/13.1533&theme=light&renderer=maplibregl&tiles=https://build.protomaps.com/20231120.pmtiles

@nvkelso left a comment writing that eventually the source for this layer should transition to Natural Earth data anyway. But in the meantime I would suggest to reduce the font size so the map remains

Location
Looks ok:
https://maps.protomaps.com/#map=5.28/37.241/-83.096&theme=light&renderer=maplibregl&tiles=https://build.protomaps.com/20231120.pmtiles
Not so much:
https://maps.protomaps.com/#map=5.28/52.416/12.78&theme=light&renderer=maplibregl&tiles=https://build.protomaps.com/20231120.pmtiles

Screenshots
Screenshot 2023-11-17 at 15 04 17

Screenshot 2023-11-17 at 14 55 22

I'm not sure how to best address this. I feel changing the style to something like this already looks much tidier:

    {
      id: "places_region",
      type: "symbol",
      source: source,
      "source-layer": "places",
      filter: ["==", "pmap:kind", "region"],
      layout: {
        "symbol-sort-key": ["get", "pmap:min_zoom"],
        "text-field": [
          "step",
          ["zoom"],
          ["get", "name:short"],
          6, // only show full name from zoom 6
          ["get", "name"],
        ],
        "text-font": ["Noto Sans Regular"],
        "text-size": ["interpolate", ["linear"], ["zoom"], 3, 11, 7, 16], // max font size for labels capped at 16
        "text-radial-offset": 0.2,
        "text-anchor": "center",
        "text-transform": "uppercase",
      },
      paint: {
        "text-color": t.state_label,
        "text-halo-color": t.state_label_halo,
        "text-halo-width": 2,
      },
    },

Admittedly, this whole issue might be more of a personal preference thingy :)

@bdon
Copy link
Member

bdon commented Nov 28, 2023

Thanks for the detailed report and suggested change - FYI the build server now only keeps the last week of daily builds and then every Monday build only. I edited your links to point to a Monday build.
Agree that changing the font size here would be an improvement - I'm fine with changing it globally, though do we forsee any need for "grading" the sizes differently for only US, Australia ("big regions") ? @nvkelso

@nvkelso
Copy link
Collaborator

nvkelso commented Nov 28, 2023

Uff, those labels are huge (and shouldn't be). Let's fix that! I'm fine with a simple style text size adjustment now, can you PR this?

The US labels are dropping out because we're using the Natural Earth max zoom property to cull them from tiles and the philosophy is to show them for a few zooms then remove them. But you're right they should still remain a few more zooms. We can override that in the Protomaps basemap ETL until Natural Earth updates.

For the Poland labels in your 2nd screenshot we should do a better job reducing the string length by removing the placetype text (Województwo), too. That's will be a separate data ETL logic change than the style.

To @bdon's comment, some states are larger than others (though generally it's better to treat all states in the same country at the same ranking so labeling is more consistent, even if Rhode Island is a lot smaller than New York). Natural Earth doesn't currently indicate an "area rank" (or list the area in square meters) in the admin-1-states-provinces theme, but I might consider that in the next version. The min_zoom is supposed to capture some of this already. I wonder if the style can be extended to make use of the feature's min_zoom when setting the text sizes? Or we call it good with the smaller text sizes overall combined with sometimes showing a country's admin-1 state labels a zoom or two later?

@wipfli
Copy link
Collaborator

wipfli commented Nov 30, 2023

@wipfli
Copy link
Collaborator

wipfli commented Dec 12, 2023

I think it would actually be best to turn off Kanton labels in Switzerland, and the same for German Bundesländer. The units are just too small here in Europe and we don't have enough space on the map for meaningful label placement for both sub-national states and city labels...

@wipfli
Copy link
Collaborator

wipfli commented Dec 12, 2023

Brings me to another question: Can we have some country / sub-country specific logic?

@nvkelso
Copy link
Collaborator

nvkelso commented Dec 12, 2023

Country / sub-country specific logic is blocked on #44.

In the meantime we can improve the data joins between Natural Earth, OSM, and Wikidata, and change how the min_zoom ranges are curated per country.

@Edefritz
Copy link
Contributor Author

Uff, those labels are huge (and shouldn't be). Let's fix that! I'm fine with a simple style text size adjustment now, can you PR this?

Sorry about the late response. Here are my proposed changes for the mean time: #192

This is also the style we're currently using in production and I think the results are pretty good in comparison. But as already mentioned above, this is just a work around until the issues can be resolved more consistently on a data level.

@bdon
Copy link
Member

bdon commented Dec 27, 2023

Thanks for the patch, let's keep this open until we can address locale specific logic

@bdon
Copy link
Member

bdon commented Jan 2, 2024

Here's the result of one of the visual tests that this change effects (looks better now):

https://maps.protomaps.com/visualtests/?name=world

@wipfli
Copy link
Collaborator

wipfli commented May 4, 2024

For visual consistency I think place=state should only be included for the largest few countries. According to Wikipedia, the list of countries by area is

image

Probably one should use the area value in the projection used for display, i.e., web-mercator. Kazakhstan for example is only 16 percent larger than DRC, but looks like twice as large in a MapLibre map...

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

No branches or pull requests

4 participants