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

Decluttering issue with Esri vector tiles #374

Open
matthias-ccri opened this issue Nov 18, 2021 · 0 comments
Open

Decluttering issue with Esri vector tiles #374

matthias-ccri opened this issue Nov 18, 2021 · 0 comments

Comments

@matthias-ccri
Copy link

Hello again!

We're using Esri vector tiles and trying to see English labels. Esri's map renders things well, and I wonder if olms can do the same.

In the Esri World_Basemap_GCS_v2 tileset, there are two properties: _name_global and _name_local, but _name_global isn't always English. And we had declutter: true, so these non-english labels made English labels disappear.

Setting declutter: false shows the English labels, but overlapped, and things are ... well, cluttered ... so it's not ideal.

So I wonder if olms has a setting or fix for this. Esri is somehow hiding the non-english labels and showing the English ones, but I don't know how.

Here's a codesandbox: https://codesandbox.io/s/olms-esri-decluttering-xvqs2

It shows Beijing in the Forbidden City:

  • with declutter: true:
    image
  • with declutter: false
    image
  • Esri's rendering:
    Selection_145

So Esri's map hides all non-english labels, but I can't tell how... Inspecting the "Altar of Earth and Harvests" label in the middle shows two points with these properties:

{
    "_label_class": 0,
    "_name_local": "祭坛",
    "_name_global": "祭坛",
    "_minzoom": 0,
    "layer": "Building/label"
}

and

{
    "_label_class": 0,
    "_name_local": "社稷坛",
    "_name_global": "Altar of Earth and Harvests",
    "_minzoom": 0,
    "layer": "Emergency/label"
}

However, Esri renders one and not the other. The style rules don't show anything that might achieve that:

{
            "id": "Building/label/Default",
            "type": "symbol",
            "source": "esri",
            "source-layer": "Building/label",
            "minzoom": 15,
            "layout": {
                "symbol-avoid-edges": true,
                "text-font": [
                    "Arial Regular"
                ],
                "text-size": 10,
                "text-letter-spacing": 0.08,
                "text-max-width": 8,
                "text-field": "{_name_global}",
                "text-padding": 20
            },
            "paint": {
                "text-color": "#666659",
                "text-halo-color": "#FAFAE8",
                "text-halo-width": 0.67
            }
        },

and

{
            "id": "Emergency/label/Default",
            "type": "symbol",
            "source": "esri",
            "source-layer": "Emergency/label",
            "minzoom": 13,
            "layout": {
                "symbol-avoid-edges": true,
                "text-font": [
                    "Arial Regular"
                ],
                "text-size": 10,
                "text-letter-spacing": 0.05,
                "text-max-width": 8,
                "text-field": "{_name_global}"
            },
            "paint": {
                "text-color": "#998973",
                "text-halo-color": "#E8DEBB",
                "text-halo-width": 0.67
            }
        },

You might think maybe they consider a label non-english if both _name_global and _name_local are the same, but that applies to English labels as well, such as this park in Ireland:

{
    "_label_class": 0,
    "_name_local": "Royal Liver Assurance Retail Park",
    "_name_global": "Royal Liver Assurance Retail Park",
    "_minzoom": 0,
    "layer": "Retail/label"
}

The only possibility I can think of is that they inspect the characters in the string, which seems crazy:

if (_name_global === _name_local && hasNonLatinCharacters(_name_global)) {
  // Hide the _name_global label
}

Is there something else that could be causing it?

It's been pretty hard debugging these vector tiles. Any help would be appreciated, including hacks.

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

1 participant