Skip to content

VectorGridProtobuf not working properly with LayerControl #1716

@giswqs

Description

@giswqs

Describe the bug
The VectorGridProtobuf example works fine with the layer control. However, once the layer control is added, the vector tile layer can no longer be overlaid on the basemap layer. I am not sure if this a folium plugin problem or the upstream leaflet.VectorGrid.Protobuf issue.

@iwpnd

import folium
import folium.plugins as plugins

url = "https://tile.nextzen.org/tilezen/vector/v1/512/all/{z}/{x}/{y}.mvt?api_key=gCZXZglvRQa6sB2z7JzL1w"
m = folium.Map(location=[46.8, 8.2], zoom_start=14)
vc = plugins.VectorGridProtobuf(url, "vector tile")
vc.add_to(m)
folium.LayerControl().add_to(m)
m

Peek 2023-01-31 11-45

Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • Python version: 3.9
  • folium version: 0.14.0

Additional context
Add any other context about the problem here.

Possible solutions
folium.TileLayer has the overlay argument that allows overlaying layer. Can VectorGridProtobuf have the same?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue describing unexpected or malicious behaviour

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions