5

In the copyright section of a mapboxgl map using a Mapbox Studio style, I see the message "Improve this map", which links here (https://www.mapbox.com/map-feedback/). Where is this link stored or how can I remove it?

I can only set it false, but then no text is shown. I do want to credit Mapbox and OSM:

var map = new mapboxgl.Map({ container: 'map', style: 'mapbox://styles/myname/mystyle', attributionControl: false, center: [10, 30], zoom: 1 });

4
  • I don't know for sure, but you might check to make sure that it is not a part of the license to have that attribution there. By the way, the link is in the 'attribution' option of the 'map'. The purpose of the link is to report something to be fixed in OpenStreetMap, since that is the data source of Mapbox styles.
    – Tangnar
    Feb 3, 2016 at 14:16
  • I can only find the documentation for the leaflet API and not the mapbox-gl api: mapbox.com/help/attribution Feb 3, 2016 at 14:46
  • oh, I see. I wonder if you can create your own attribution control and it will override the default?
    – Tangnar
    Feb 3, 2016 at 14:53
  • The easiest workaround is just to create another <div> in the same container containing the text and floating it above the map. Probably needed at the moment: github.com/mapbox/mapbox-gl-js/issues/1485 Feb 3, 2016 at 14:57

2 Answers 2

5

The current version of Mapbox GL JS doesn't let you programatically hide that link. You can hide it with CSS:

.mapbox-improve-map {
    display: none;
}

This assumes OpenStreetMap/Mapbox is ok with it, as @Tangnar mentioned.

Incidentally, even if you programatically disable map rotation, you still need to hide the rotation control button with CSS.

.mapboxgl-ctrl-compass { display: none; }
4
  • OpenStreetMap is not okay with it. If you ('a Dev', not the responder) want to use maps provided by volunteers for free then the least you can do is display their attribution statements to thank them.
    – jnicho02
    Mar 5, 2021 at 11:43
  • 2021 solution, mapbox does not add easy to select css classes anymore, but currently improve map link is the last of 3, so something like this works .mapboxgl-ctrl-attrib-inner a:last-of-type { display: none; }
    – mwallisch
    Aug 27, 2021 at 10:07
  • @jnicho02 On what basis do you say that OSM requires the "Improve this map" wording? Hiding it would still show the "(C) OpenStreetMap" wording. Jan 19 at 0:47
  • Hi Steve, I take it back if the solutions being suggested block the a.mapbox-improve-map statement and not the whole mapboxgl-ctrl-attrib-inner. I notice that Mapbox themselves do this (2024).
    – jnicho02
    Feb 16 at 13:57
0

In 2021, here's how I hid that section:

  .mapboxgl-ctrl-bottom-right {
     display: none;
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.