Reputation: 473
attributionControl: true
Does nothing. Where do I need to put the attribution in the mapbox-gl style so that it shows up in the control?
Upvotes: 4
Views: 5302
Reputation: 5525
---- 2023 update ----
here is official mapbox document and example
https://docs.mapbox.com/mapbox-gl-js/api/markers/#attributioncontrol
here is my working code,
Upvotes: -1
Reputation: 21
Meanwhile the feature is available https://docs.mapbox.com/mapbox-gl-js/api/markers/#attributioncontrol
Upvotes: 1
Reputation: 56
For those that still wondering about this. Mapbox have made a good workaround for this as described in Mapbox issue #1485.
I'm simply copying the solution provided by a collaborator of Mapbox:
map.addSource('attribution', {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: []
},
attribution: 'Your custom attribution'
});
Upvotes: 3
Reputation: 169
You can also work around with HTML/CSS + Mapbox CSS Styles by including and positioning a div
inside the map div
wrapper by using the mapboxgl-ctrl-attrib
classes (example):
<div id="map">
<!-- Modify the style: right position so it matches with the mapbox attribution -->
<div id="attribution" class="mapboxgl-ctrl mapboxgl-ctrl-attrib mapboxgl-ctrl-bottom-right" style="position: fixed; bottom: 0; right: 230px;">
<a href="*">Attribution 1</a> |
<a href="*">Attribution 2</a> |
<a href="*">Attribution n</a> |
</div>
</div>
Upvotes: 1
Reputation: 3802
This feature is not yet implemented. It is sorely missing. Would you consider submitting a PR? https://github.com/mapbox/mapbox-gl-js/issues/1485
Upvotes: 1