17

I am use leaflet-directive to create map using leaflet.

Is it possible to remove leaflet link and OSM copyright from the map.

I wish to put in leaflet image instead.

Alvin
  • 8,219
  • 25
  • 96
  • 177

4 Answers4

44

When creating the map object, try this:

var map = L.map('map', { attributionControl:false });

It worked for me

Stef Verdonk
  • 596
  • 1
  • 5
  • 6
12

A reference to the attribution control instance is being stored in the attributionControl property of your L.Map instance:

var map = new L.Map('map').setView([0, 0], 0);

attribution = map.attributionControl;

When you've got that you can use the setPrefix method to set a new prefix:

attribution.setPrefix('<img src="image.png">');

http://leafletjs.com/reference.html#control-attribution-setprefix

iH8
  • 27,722
  • 4
  • 67
  • 76
0

Simply hide it with CSS

.leaflet-control-attribution.leaflet-control {
    display: none;
}
-4

It's probably not legal to remove copy-right information, but if you're familiar with javascript search in the leaflet code for

'leaflet-control-attribution'

Greetings

  • @steenhulthin - The attribution control isn't just showing a link; as the question says (" remove ... and OSM copyright"), it includes "Map data (c) OpenStreetMap". Leaving that there is one way to satisfy the *attribution requirement* of whatever map service (e.g. OpenStreetMap) you are using, if any. – ToolmakerSteve Oct 06 '19 at 17:39