Skip to content

Commit f8a7a29

Browse files
committed
fix(map): osm in example1
1 parent f30588e commit f8a7a29

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

superset-frontend/plugins/legacy-preset-chart-deckgl/src/DeckGLContainer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import 'mapbox-gl/dist/mapbox-gl.css';
3939
import { Viewport } from './utils/fitViewport';
4040
import {
4141
MAPBOX_LAYER_PREFIX,
42+
OSM_LAYER_KEYWORDS,
4243
TILE_LAYER_PREFIX,
4344
buildTileLayer,
4445
} from './utils';
@@ -98,7 +99,8 @@ export const DeckGLContainer = memo(
9899

99100
const layers = useCallback(() => {
100101
if (
101-
props.mapStyle?.startsWith(TILE_LAYER_PREFIX) &&
102+
(props.mapStyle?.startsWith(TILE_LAYER_PREFIX) ||
103+
OSM_LAYER_KEYWORDS.some(tilek => props.mapStyle?.includes(tilek))) &&
102104
props.layers.some(
103105
l => typeof l !== 'function' && l?.id === 'tile-layer',
104106
) === false

superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const DEFAULT_NUM_BUCKETS = 10;
3333

3434
export const MAPBOX_LAYER_PREFIX = 'mapbox://';
3535
export const TILE_LAYER_PREFIX = 'tile://';
36+
export const OSM_LAYER_KEYWORDS = ['openstreetmap', 'osm'];
3637

3738
export type Buckets = {
3839
break_points: string[];

superset/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,7 @@ class D3TimeFormat(TypedDict, total=False):
850850
"origins": [
851851
"https://tile.openstreetmap.org",
852852
"https://tile.osm.ch",
853+
"https://c.tile.openstreetmap.org",
853854
]
854855
}
855856

@@ -1680,6 +1681,7 @@ def EMAIL_HEADER_MUTATOR( # pylint: disable=invalid-name,unused-argument # noq
16801681
"https://events.mapbox.com",
16811682
"https://tile.openstreetmap.org",
16821683
"https://tile.osm.ch",
1684+
"https://c.tile.openstreetmap.org",
16831685
],
16841686
"object-src": "'none'",
16851687
"style-src": [
@@ -1713,6 +1715,7 @@ def EMAIL_HEADER_MUTATOR( # pylint: disable=invalid-name,unused-argument # noq
17131715
"https://events.mapbox.com",
17141716
"https://tile.openstreetmap.org",
17151717
"https://tile.osm.ch",
1718+
"https://c.tile.openstreetmap.org",
17161719
],
17171720
"object-src": "'none'",
17181721
"style-src": [

superset/examples/deck.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements
194194
"datasource": "5__table",
195195
"granularity_sqla": None,
196196
"groupby": [],
197-
"mapbox_style": "mapbox://styles/mapbox/light-v9",
197+
"mapbox_style": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
198198
"multiplier": 10,
199199
"point_radius_fixed": {"type": "metric", "value": "count"},
200200
"point_unit": "square_m",
@@ -229,7 +229,7 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements
229229
"point_unit": "square_m",
230230
"row_limit": 5000,
231231
"spatial": {"type": "latlong", "lonCol": "LON", "latCol": "LAT"},
232-
"mapbox_style": "mapbox://styles/mapbox/dark-v9",
232+
"mapbox_style": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
233233
"granularity_sqla": None,
234234
"size": "count",
235235
"viz_type": "deck_screengrid",
@@ -263,7 +263,7 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements
263263
slice_data = {
264264
"spatial": {"type": "latlong", "lonCol": "LON", "latCol": "LAT"},
265265
"row_limit": 5000,
266-
"mapbox_style": "mapbox://styles/mapbox/streets-v9",
266+
"mapbox_style": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
267267
"granularity_sqla": None,
268268
"size": "count",
269269
"viz_type": "deck_hex",
@@ -300,7 +300,7 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements
300300
"autozoom": False,
301301
"spatial": {"type": "latlong", "lonCol": "LON", "latCol": "LAT"},
302302
"row_limit": 5000,
303-
"mapbox_style": "mapbox://styles/mapbox/satellite-streets-v9",
303+
"mapbox_style": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
304304
"granularity_sqla": None,
305305
"size": "count",
306306
"viz_type": "deck_grid",
@@ -367,7 +367,7 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements
367367
},
368368
"line_type": "json",
369369
"linear_color_scheme": "oranges",
370-
"mapbox_style": "mapbox://styles/mapbox/light-v9",
370+
"mapbox_style": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
371371
"viewport": {
372372
"longitude": -122.43388541747726,
373373
"latitude": 37.752020331384834,
@@ -442,7 +442,7 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements
442442
"lonCol": "LONGITUDE_DEST",
443443
},
444444
"row_limit": 5000,
445-
"mapbox_style": "mapbox://styles/mapbox/light-v9",
445+
"mapbox_style": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
446446
"viewport": {
447447
"altitude": 1.5,
448448
"bearing": 8.546256357301871,
@@ -486,7 +486,7 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements
486486
"line_column": "path_json",
487487
"line_type": "json",
488488
"row_limit": 5000,
489-
"mapbox_style": "mapbox://styles/mapbox/light-v9",
489+
"mapbox_style": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
490490
"viewport": {
491491
"longitude": -122.18885402582598,
492492
"latitude": 37.73671752604488,

superset/examples/long_lat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,18 @@ def load_long_lat_data(only_metadata: bool = False, force: bool = False) -> None
107107
"granularity_sqla": "day",
108108
"since": "2014-01-01",
109109
"until": "now",
110-
"viz_type": "mapbox",
110+
"viz_type": "osm",
111111
"all_columns_x": "LON",
112112
"all_columns_y": "LAT",
113-
"mapbox_style": "mapbox://styles/mapbox/light-v9",
113+
"mapbox_style": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
114114
"all_columns": ["occupancy"],
115115
"row_limit": 500000,
116116
}
117117

118118
logger.debug("Creating a slice")
119119
slc = Slice(
120-
slice_name="Mapbox Long/Lat",
121-
viz_type="mapbox",
120+
slice_name="OSM Long/Lat",
121+
viz_type="osm",
122122
datasource_type=DatasourceType.TABLE,
123123
datasource_id=tbl.id,
124124
params=get_slice_json(slice_data),

superset/examples/misc_dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def load_misc_dashboard() -> None:
4747
"meta": {
4848
"chartId": 3969,
4949
"height": 69,
50-
"sliceName": "Mapbox Long/Lat",
50+
"sliceName": "OSM Long/Lat",
5151
"uuid": "164efe31-295b-4408-aaa6-2f4bfb58a212",
5252
"width": 4
5353
},

0 commit comments

Comments
 (0)