-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support custom attribution strings #1485
Comments
Good question. Unfortunately there's not a good way to add a custom attribution right now. We'll look into adding this. |
tagging @mapbox/support for known issue |
I just encountered this issue as well. Would it be possible to add an additional "geojson-marker": {
"type": "geojson",
"data": { … },
"attribution": "My custom attribution text."
} Or: var sourceObj = new mapboxgl.GeoJSONSource({
data: { … },
attribution: "My custom attribution text."
}); |
I've found custom attribution strings support for |
I've just noticed that, at least for raster sources you can just pass an |
Until this is implemented, one workaround is to set the attribution string directly: map.addLayer({
"id": "attribution-layer",
"type": "circle",
"source": {
"type": "geojson",
"data": {
"type": "Feature",
"properties": {},
"geometry": null
}
}
});
map.style.sourceCaches['attribution-layer']._source.attribution = "© foobar"; |
The equivalent issue for iOS is tracked in mapbox/mapbox-gl-native#9024. |
It looks like this issue was closed unintended by #6364 because of the word close in the PR description.
Although there are workarounds available, custom attribution strings are not implemented yet. |
@pathmapper You're right passing a fixed string directly to the AttributionControl isn't yet supported, but one workaround is pretty straight forward now: map.addSource('attribution', {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: []
},
attribution: 'Your custom attribution'
}); (until #6281, then you'll need to add a layer too) |
closed by #7033 |
I'm having trouble figuring out how to add a custom attribution to my maps in addition to the standard attributions already added. When I call..... map.addControl(new mapboxgl.Attribution()); where do I add a custom string? Probably a stupid question, but just trying to do the right thing with attributions before I share the awesomeness that is customized Mapbox GL maps.
The text was updated successfully, but these errors were encountered: