Skip to content

Commit 593ddbc

Browse files
authored
Merge pull request #7085 from plotly/no-predefined-stamen
no predefined stamen styles in map subplots
2 parents 1dbc00b + be49ef2 commit 593ddbc

File tree

5 files changed

+70
-119
lines changed

5 files changed

+70
-119
lines changed

draftlogs/7060_add.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add new traces: scattermap, choroplethmap and densitymap and map subplots which use maplibre to render maps [[#7015](https://github.com/plotly/plotly.js/pull/7015), [#7060](https://github.com/plotly/plotly.js/pull/7060), [#7085](https://github.com/plotly/plotly.js/pull/7085)]

src/plots/map/constants.js

-77
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,6 @@ var sortObjectKeys = require('../../lib/sort_object_keys');
44

55
var OSM = '© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
66

7-
var stamenTerrainOrToner = [
8-
'Map tiles by <a target="_blank" href="https://stamen.com">Stamen Design</a>',
9-
'under <a target="_blank" href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>',
10-
'|',
11-
'Data by <a target="_blank" href="https://openstreetmap.org">OpenStreetMap</a> contributors',
12-
'under <a target="_blank" href="https://www.openstreetmap.org/copyright">ODbL</a>'
13-
].join(' ');
14-
15-
var stamenWaterColor = [
16-
'Map tiles by <a target="_blank" href="https://stamen.com">Stamen Design</a>',
17-
'under <a target="_blank" href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>',
18-
'|',
19-
'Data by <a target="_blank" href="https://openstreetmap.org">OpenStreetMap</a> contributors',
20-
'under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
21-
].join(' ');
22-
23-
247
var cartoPositron = 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json';
258
var cartoDarkmatter = 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json';
269
var cartoVoyager = 'https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json';
@@ -173,66 +156,6 @@ var stylesMap = {
173156
'carto-positron-nolabels': cartoPositronNoLabels,
174157
'carto-darkmatter-nolabels': cartoDarkmatterNoLabels,
175158
'carto-voyager-nolabels': cartoVoyagerNoLabels,
176-
'stamen-terrain': {
177-
id: 'stamen-terrain',
178-
version: 8,
179-
sources: {
180-
'plotly-stamen-terrain': {
181-
type: 'raster',
182-
attribution: stamenTerrainOrToner,
183-
tiles: ['https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}.png'],
184-
tileSize: 256
185-
}
186-
},
187-
layers: [{
188-
id: 'plotly-stamen-terrain',
189-
type: 'raster',
190-
source: 'plotly-stamen-terrain',
191-
minzoom: 0,
192-
maxzoom: 22
193-
}],
194-
glyphs: 'https://fonts.openmaptiles.org/{fontstack}/{range}.pbf'
195-
},
196-
'stamen-toner': {
197-
id: 'stamen-toner',
198-
version: 8,
199-
sources: {
200-
'plotly-stamen-toner': {
201-
type: 'raster',
202-
attribution: stamenTerrainOrToner,
203-
tiles: ['https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png'],
204-
tileSize: 256
205-
}
206-
},
207-
layers: [{
208-
id: 'plotly-stamen-toner',
209-
type: 'raster',
210-
source: 'plotly-stamen-toner',
211-
minzoom: 0,
212-
maxzoom: 22
213-
}],
214-
glyphs: 'https://fonts.openmaptiles.org/{fontstack}/{range}.pbf'
215-
},
216-
'stamen-watercolor': {
217-
id: 'stamen-watercolor',
218-
version: 8,
219-
sources: {
220-
'plotly-stamen-watercolor': {
221-
type: 'raster',
222-
attribution: stamenWaterColor,
223-
tiles: ['https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg'],
224-
tileSize: 256
225-
}
226-
},
227-
layers: [{
228-
id: 'plotly-stamen-watercolor',
229-
type: 'raster',
230-
source: 'plotly-stamen-watercolor',
231-
minzoom: 0,
232-
maxzoom: 22
233-
}],
234-
glyphs: 'https://fonts.openmaptiles.org/{fontstack}/{range}.pbf'
235-
}
236159
};
237160

238161
var styleValuesMap = sortObjectKeys(stylesMap);

test/image/mocks/map_stamen-style.json

+67-3
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,79 @@
3030
},
3131
"map": {
3232
"domain": {"row": 0, "column": 0},
33-
"style": "stamen-terrain"
33+
"style": {
34+
"version": 8,
35+
"sources": {
36+
"plotly-stamen-terrain": {
37+
"type": "raster",
38+
"tiles": ["https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}.png"],
39+
"tileSize": 256,
40+
"attribution": "Map tiles by <a target='_blank' href='https://stamen.com'>Stamen Design</a> under <a target='_blank' href='https://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a> | Data by <a target='_blank' href='https://openstreetmap.org'>OpenStreetMap</a> contributors under <a target='_blank' href='https://www.openstreetmap.org/copyright'>ODbL</a>"
41+
}
42+
},
43+
"layers": [{
44+
"id": "plotly-stamen-terrain",
45+
"type": "raster",
46+
"source": "plotly-stamen-terrain",
47+
"minzoom": 0,
48+
"maxzoom": 22
49+
}],
50+
"glyphs": "https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"
51+
}
3452
},
3553
"map2": {
3654
"domain": {"row": 0, "column": 1},
37-
"style": "stamen-toner"
55+
"style": {
56+
"id": "stamen-toner",
57+
"version": 8,
58+
"sources": {
59+
"plotly-stamen-toner": {
60+
"type": "raster",
61+
"tiles": [
62+
"https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png"
63+
],
64+
"tileSize": 256,
65+
"attribution": "Map tiles by <a target='_blank' href='https://stamen.com'>Stamen Design</a> under <a target='_blank' href='https://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a> | Data by <a target='_blank' href='https://openstreetmap.org'>OpenStreetMap</a> contributors under <a target='_blank' href='https://www.openstreetmap.org/copyright'>ODbL</a>"
66+
}
67+
},
68+
"layers": [
69+
{
70+
"id": "plotly-stamen-toner",
71+
"type": "raster",
72+
"source": "plotly-stamen-toner",
73+
"minzoom": 0,
74+
"maxzoom": 22
75+
}
76+
],
77+
"glyphs": "https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"
78+
}
3879
},
3980
"map3": {
4081
"domain": {"row": 0, "column": 2},
41-
"style": "stamen-watercolor"
82+
"style": {
83+
"id": "stamen-watercolor",
84+
"version": 8,
85+
"sources": {
86+
"plotly-stamen-watercolor": {
87+
"type": "raster",
88+
"tiles": [
89+
"https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg"
90+
],
91+
"tileSize": 256,
92+
"attribution": "Map tiles by <a target='_blank' href='https://stamen.com'>Stamen Design</a> under <a target='_blank' href='https://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a> | Data by <a target='_blank' href='https://openstreetmap.org'>OpenStreetMap</a> contributors under <a target='_blank' href='https://creativecommons.org/licenses/by-sa/3.0'>CC BY SA</a>"
93+
}
94+
},
95+
"layers": [
96+
{
97+
"id": "plotly-stamen-watercolor",
98+
"type": "raster",
99+
"source": "plotly-stamen-watercolor",
100+
"minzoom": 0,
101+
"maxzoom": 22
102+
}
103+
],
104+
"glyphs": "https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"
105+
}
42106
}
43107
}
44108
}

test/jasmine/tests/map_test.js

+1-35
Original file line numberDiff line numberDiff line change
@@ -1233,40 +1233,6 @@ describe('map plots', function() {
12331233
.then(done, done.fail);
12341234
});
12351235

1236-
['stamen-terrain', 'stamen-toner'].forEach(function(style) {
1237-
it('@noCI @gl should be displayed for style "' + style + '"', function(done) {
1238-
Plotly.newPlot(gd, [{type: 'scattermap'}], {map: {style: style}})
1239-
.then(function() {
1240-
var s = d3SelectAll('.maplibregl-ctrl-attrib');
1241-
expect(s.size()).toBe(1);
1242-
expect(s.text()).toEqual('Map tiles by Stamen Design under CC BY 3.0 | Data by OpenStreetMap contributors under ODbL');
1243-
assertLinks(s, [
1244-
'https://stamen.com/',
1245-
'https://creativecommons.org/licenses/by/3.0',
1246-
'https://openstreetmap.org/',
1247-
'https://www.openstreetmap.org/copyright'
1248-
]);
1249-
})
1250-
.then(done, done.fail);
1251-
});
1252-
});
1253-
1254-
it('@noCI @gl should be displayed for style "stamen-watercolor"', function(done) {
1255-
Plotly.newPlot(gd, [{type: 'scattermap'}], {map: {style: 'stamen-watercolor'}})
1256-
.then(function() {
1257-
var s = d3SelectAll('.maplibregl-ctrl-attrib');
1258-
expect(s.size()).toBe(1);
1259-
expect(s.text()).toEqual('Map tiles by Stamen Design under CC BY 3.0 | Data by OpenStreetMap contributors under CC BY SA');
1260-
assertLinks(s, [
1261-
'https://stamen.com/',
1262-
'https://creativecommons.org/licenses/by/3.0',
1263-
'https://openstreetmap.org/',
1264-
'https://creativecommons.org/licenses/by-sa/3.0'
1265-
]);
1266-
})
1267-
.then(done, done.fail);
1268-
});
1269-
12701236
it('@gl should be displayed for style "open-street-map"', function(done) {
12711237
Plotly.newPlot(gd, [{type: 'scattermap'}], {map: {style: 'open-street-map'}})
12721238
.then(function() {
@@ -1482,7 +1448,7 @@ describe('map react', function() {
14821448
}
14831449

14841450
var firstLink = 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png';
1485-
var secondLink = 'https://a.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg';
1451+
var secondLink = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{x}/{y}.png';
14861452

14871453
var fig = {
14881454
data: [

test/plot-schema.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -4237,7 +4237,7 @@
42374237
},
42384238
"role": "object",
42394239
"style": {
4240-
"description": "Defines the map layers that are rendered by default below the trace layers defined in `data`, which are themselves by default rendered below the layers defined in `layout.map.layers`. These layers can be defined either explicitly as a Map Style object which can contain multiple layer definitions that load data from any public or private Tile Map Service (TMS or XYZ) or Web Map Service (WMS) or implicitly by using one of the built-in style objects which use WMSes or by using a custom style URL Map Style objects are of the form described in the MapLibre GL JS documentation available at https://maplibre.org/maplibre-style-spec/ The built-in plotly.js styles objects are: basic, carto-darkmatter, carto-darkmatter-nolabels, carto-positron, carto-positron-nolabels, carto-voyager, carto-voyager-nolabels, dark, light, open-street-map, outdoors, satellite, satellite-streets, stamen-terrain, stamen-toner, stamen-watercolor, streets, white-bg.",
4240+
"description": "Defines the map layers that are rendered by default below the trace layers defined in `data`, which are themselves by default rendered below the layers defined in `layout.map.layers`. These layers can be defined either explicitly as a Map Style object which can contain multiple layer definitions that load data from any public or private Tile Map Service (TMS or XYZ) or Web Map Service (WMS) or implicitly by using one of the built-in style objects which use WMSes or by using a custom style URL Map Style objects are of the form described in the MapLibre GL JS documentation available at https://maplibre.org/maplibre-style-spec/ The built-in plotly.js styles objects are: basic, carto-darkmatter, carto-darkmatter-nolabels, carto-positron, carto-positron-nolabels, carto-voyager, carto-voyager-nolabels, dark, light, open-street-map, outdoors, satellite, satellite-streets, streets, white-bg.",
42414241
"dflt": "basic",
42424242
"editType": "plot",
42434243
"valType": "any",
@@ -4255,9 +4255,6 @@
42554255
"outdoors",
42564256
"satellite",
42574257
"satellite-streets",
4258-
"stamen-terrain",
4259-
"stamen-toner",
4260-
"stamen-watercolor",
42614258
"streets",
42624259
"white-bg"
42634260
]

0 commit comments

Comments
 (0)