Kitware / trame-leaflet

MIT License
2 stars 2 forks source link

Hide leaflet attribution #14

Open kerim371 opened 2 days ago

kerim371 commented 2 days ago

Hi,

I'm trying to hide leaflet attribution using the provided example. According to the stackoverflow Q&A I need to set attributionControl to false but that doesn't work:

    with layout.content:
        with vuetify.VContainer(
            fluid=True,
            classes="pa-0 fill-height",
        ):
            with leaflet.LMap(zoom=("zoom", 15), center=("center", [51.505, -0.159]), attributionControl=("attributionControl", "false")):
                leaflet.LTileLayer(
                    url=("url", "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"),
                    attribution=(
                        "attribution",
                        '&copy; <a target="_blank" href="http://osm.org/copyright">OpenStreetMap</a> contributors',
                    ),
                )
                leaflet.VGeosearch(options=("options",{"provider": "OpenStreetMapProvider"}))
                leaflet.LMarker(lat_lng=("markerLatLng", [51.504, -0.159]))
jourdain commented 2 days ago

Did you try to set the attribution= to an empty string?

kerim371 commented 2 days ago

@jourdain yes I've tried, neither of these two worked:

with leaflet.LMap(zoom=("zoom", 15), center=("center", [51.505, -0.159]), attribution=''):
# or
with leaflet.LMap(zoom=("zoom", 15), center=("center", [51.505, -0.159]), attribution=("attribution", "")):
jourdain commented 2 days ago

Did you try passing the options like suggested in the link you provided?

Also don't forget that you can reach out for professional support.

kerim371 commented 2 days ago

@jourdain yes I've tried using options in the following way and it didn't work:

with leaflet.LMap(zoom=("zoom", 15), center=("center", [51.505, -0.159]), options=("options", "{attributionControl: false}")):

Also don't forget that you can reach out for professional support.

I remember that, thank you. That is something I keep in mind.

jourdain commented 1 day ago

The second argument needs to be a dictionary not a string.

with leaflet.LMap(
   zoom=("zoom", 15),
   center=("center", [51.505, -0.159]),
   options=("options", {"attributionControl": False}),
):
kerim371 commented 1 day ago

This didn't worked neither.

It seems that almost any of the Leaflet options doesnt work. For example doubleClickZoom:

            with leaflet.LMap(
                zoom=("zoom", 15),
                center=("center", [51.505, -0.159]),
                doubleClickZoom=("doubleClickZoom", False),
                ):

still allows to zoom with double click.

Even though zoom and center options are working.

jourdain commented 1 day ago

I don't see doubleClickZoom in the available properties so it make sense that nothing new would happen with that extra kwarg.

jourdain commented 1 day ago

If you want to create your own bundle of a vue3/leaflet version, keep in mind that you can use the widget generator

kerim371 commented 1 day ago

I see.. Very interesting, thank you! I will take a try