17

I want to remove the "Leaflet.com" that appears on the right bottom of the screen here. How can I do that?

example

Taras
  • 32,823
  • 4
  • 66
  • 137
Rabie Ben
  • 1,226
  • 5
  • 23
  • 36

6 Answers6

46

The Leaflet way: L.map('map', {attributionControl: false, etc...})

A simple $('.leaflet-control-attribution').hide() or non jQuery document.getElementsByClassName( 'leaflet-control-attribution' )[0].style.display = 'none';.

Vladimir himself says it's OK to remove it: https://groups.google.com/d/msg/leaflet-js/fA6M7fbchOs/JTNVhqdc7JcJ, but it seems like you should leave it or acknowledge Leaflet in some way.

CCantey
  • 1,468
  • 1
  • 16
  • 20
  • Thank you for your answer. Your solution worked for me!! – Md Amiruzzaman Jul 11 '20 at 13:07
  • 4
    Thanks for sharing Vladimirs comment! Here is a way to only remove the Leaflet prefix: map.attributionControl.setPrefix(false) https://leafletjs.com/reference.html#control-attribution-prefix – CoderPi Jan 30 '22 at 16:56
12

This is perfectly explained in the Leaflet API reference for attribution control.

sdonchor
  • 3
  • 2
IvanSanchez
  • 10,206
  • 2
  • 19
  • 35
8

For those using react-leaflet, use:

<Map attributionControl={false} />
Colin Basnett
  • 191
  • 1
  • 5
5

If you just wanna remove "Leaflet" prefix then :

map.attributionControl.setPrefix('YOUR_ATTRIBUTION')

Where map is an object returned by L.map(...) call.

Kalitine
  • 281
  • 5
  • 6
  • I like the attribution coupled with my tileLayer (I use OpenStreetMap), so I call map.attributionControl.setPrefix() with empty args to remove the Leaflet attribution – kevlened Aug 13 '20 at 16:47
0

tutorial here

(leafletMapReady)="onMapReady($event);"
  [leafletOptions]="options"


  import { Layer, tileLayer, Map, control } from 'leaflet';
  ...
  options: any = {};
  constructor() {
    this.options['attributionControl'] = false;
  }
  ...
  onMapReady(map: Map) {
    map.addControl(
        control.attribution({
            position: 'bottomright',
            prefix: ''
        })
    );
  }
0

If you use leaflet on Angular you can disable it at this way:

this.map = new Map('mapId', {attributionControl: false});