Skip to content

Commit 0526952

Browse files
committed
fix: show OpenStreetMap attribution on demo site (#2462)
Signed-off-by: Pierre Blanchet <pierre.blanchet.engineer@gmail.com>
1 parent e2f672c commit 0526952

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/components/src/map-container.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,10 @@ export default function MapContainerFactory(
560560
this._updateMapboxLayers();
561561

562562
if (update && update.style) {
563-
// No attributions are needed if the style doesn't reference Mapbox sources
563+
// Show attributions if the style uses Mapbox or OpenStreetMap sources
564564
this.setState({
565565
showBaseMapAttribution:
566-
isStyleUsingMapboxTiles(update.style) || !isStyleUsingOpenStreetMapTiles(update.style)
566+
isStyleUsingMapboxTiles(update.style) || isStyleUsingOpenStreetMapTiles(update.style)
567567
});
568568
}
569569

src/utils/src/map-style-utils/mapbox-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export function isStyleUsingOpenStreetMapTiles(mapStyle: any) {
3232
const sources = mapStyle?.stylesheet?.sources || {};
3333
return Object.keys(sources).some(sourceId => {
3434
const {attribution} = sources[sourceId] || {};
35-
if (typeof attribution?.attribution === 'string') {
36-
return attribution.attribution.includes('openstreetmap.org');
35+
if (typeof attribution === 'string') {
36+
return attribution.includes('openstreetmap.org');
3737
}
3838
return false;
3939
});

0 commit comments

Comments
 (0)