Skip to content

Commit 97bac68

Browse files
committed
revise carto and stamen attributions
1 parent 76fa029 commit 97bac68

File tree

6 files changed

+52
-14
lines changed

6 files changed

+52
-14
lines changed

src/plots/mapbox/constants.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,27 @@
22

33
var requiredVersion = '1.10.1';
44

5-
var OSM = '© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>';
6-
var Carto = '© <a target="_blank" href="https://carto.com/">Carto</a>';
7-
var Stamen = '© <a target="_blank" href="https://stamen.com">Stamen Design LLC</a>';
5+
var OSM = '© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
6+
var carto = [
7+
'© <a target="_blank" href="https://carto.com/">Carto</a>',
8+
OSM
9+
].join(' ');
10+
11+
var stamenTerrainOrToner = [
12+
'Map tiles by <a target="_blank" href="https://stamen.com">Stamen Design</a>',
13+
'under <a target="_blank" href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>',
14+
'|',
15+
'Data by <a target="_blank" href="https://openstreetmap.org">OpenStreetMap</a> contributors',
16+
'under <a target="_blank" href="https://www.openstreetmap.org/copyright">ODbL</a>'
17+
].join(' ');
18+
19+
var stamenWaterColor = [
20+
'Map tiles by <a target="_blank" href="https://stamen.com">Stamen Design</a>',
21+
'under <a target="_blank" href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>',
22+
'|',
23+
'Data by <a target="_blank" href="https://openstreetmap.org">OpenStreetMap</a> contributors',
24+
'under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
25+
].join(' ');
826

927
var stylesNonMapbox = {
1028
'open-street-map': {
@@ -47,7 +65,7 @@ var stylesNonMapbox = {
4765
sources: {
4866
'plotly-carto-positron': {
4967
type: 'raster',
50-
attribution: [Carto, OSM].join(' '),
68+
attribution: carto,
5169
tiles: ['https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png'],
5270
tileSize: 256
5371
}
@@ -66,7 +84,7 @@ var stylesNonMapbox = {
6684
sources: {
6785
'plotly-carto-darkmatter': {
6886
type: 'raster',
69-
attribution: [Carto, OSM].join(' '),
87+
attribution: carto,
7088
tiles: ['https://cartodb-basemaps-c.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png'],
7189
tileSize: 256
7290
}
@@ -85,7 +103,7 @@ var stylesNonMapbox = {
85103
sources: {
86104
'plotly-stamen-terrain': {
87105
type: 'raster',
88-
attribution: [Stamen, OSM].join(' '),
106+
attribution: stamenTerrainOrToner,
89107
tiles: ['https://stamen-tiles.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png'],
90108
tileSize: 256
91109
}
@@ -104,7 +122,7 @@ var stylesNonMapbox = {
104122
sources: {
105123
'plotly-stamen-toner': {
106124
type: 'raster',
107-
attribution: [Stamen, OSM].join(' '),
125+
attribution: stamenTerrainOrToner,
108126
tiles: ['https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png'],
109127
tileSize: 256
110128
}
@@ -123,7 +141,7 @@ var stylesNonMapbox = {
123141
sources: {
124142
'plotly-stamen-watercolor': {
125143
type: 'raster',
126-
attribution: [Stamen, OSM].join(' '),
144+
attribution: stamenWaterColor,
127145
tiles: ['https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png'],
128146
tileSize: 256
129147
}
1.33 KB
Loading
784 Bytes
Loading
1 KB
Loading
2.59 KB
Loading

test/jasmine/tests/mapbox_test.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ describe('mapbox plots', function() {
14861486
.then(function() {
14871487
var s = d3SelectAll('.mapboxgl-ctrl-attrib');
14881488
expect(s.size()).toBe(1);
1489-
expect(s.text()).toEqual('© Carto © OpenStreetMap');
1489+
expect(s.text()).toEqual('© Carto © OpenStreetMap contributors');
14901490
assertLinks(s, [
14911491
'https://carto.com/',
14921492
'https://www.openstreetmap.org/copyright'
@@ -1495,15 +1495,35 @@ describe('mapbox plots', function() {
14951495
.then(done, done.fail);
14961496
});
14971497

1498-
it('@gl should be displayed for style "Stamen"', function(done) {
1499-
Plotly.newPlot(gd, [{type: 'scattermapbox'}], {mapbox: {style: 'stamen-terrain'}})
1498+
['stamen-terrain', 'stamen-toner'].forEach(function(style) {
1499+
it('@gl should be displayed for style "' + style + '"', function(done) {
1500+
Plotly.newPlot(gd, [{type: 'scattermapbox'}], {mapbox: {style: style}})
1501+
.then(function() {
1502+
var s = d3SelectAll('.mapboxgl-ctrl-attrib');
1503+
expect(s.size()).toBe(1);
1504+
expect(s.text()).toEqual('Map tiles by Stamen Design under CC BY 3.0 | Data by OpenStreetMap contributors under ODbL');
1505+
assertLinks(s, [
1506+
'https://stamen.com/',
1507+
'https://creativecommons.org/licenses/by/3.0',
1508+
'https://openstreetmap.org/',
1509+
'https://www.openstreetmap.org/copyright'
1510+
]);
1511+
})
1512+
.then(done, done.fail);
1513+
});
1514+
});
1515+
1516+
it('@gl should be displayed for style "stamen-watercolor"', function(done) {
1517+
Plotly.newPlot(gd, [{type: 'scattermapbox'}], {mapbox: {style: 'stamen-watercolor'}})
15001518
.then(function() {
15011519
var s = d3SelectAll('.mapboxgl-ctrl-attrib');
15021520
expect(s.size()).toBe(1);
1503-
expect(s.text()).toEqual('© Stamen Design LLC © OpenStreetMap');
1521+
expect(s.text()).toEqual('Map tiles by Stamen Design under CC BY 3.0 | Data by OpenStreetMap contributors under CC BY SA');
15041522
assertLinks(s, [
15051523
'https://stamen.com/',
1506-
'https://www.openstreetmap.org/copyright'
1524+
'https://creativecommons.org/licenses/by/3.0',
1525+
'https://openstreetmap.org/',
1526+
'https://creativecommons.org/licenses/by-sa/3.0'
15071527
]);
15081528
})
15091529
.then(done, done.fail);
@@ -1514,7 +1534,7 @@ describe('mapbox plots', function() {
15141534
.then(function() {
15151535
var s = d3SelectAll('.mapboxgl-ctrl-attrib');
15161536
expect(s.size()).toBe(1);
1517-
expect(s.text()).toEqual('© OpenStreetMap');
1537+
expect(s.text()).toEqual('© OpenStreetMap contributors');
15181538
assertLinks(s, [
15191539
'https://www.openstreetmap.org/copyright'
15201540
]);

0 commit comments

Comments
 (0)