Skip to content

Commit 470e69b

Browse files
authored
Use MapLibre in examples/editable-layers (#75)
1 parent f2ec957 commit 470e69b

File tree

19 files changed

+36
-32
lines changed

19 files changed

+36
-32
lines changed

examples/editable-layers/advanced/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8" />
55
<title>deck.gl Community Example</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
7-
<link href="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.css" rel="stylesheet" />
7+
<link href="https://unpkg.com/maplibre-gl@^4.1.3/dist/maplibre-gl.css" rel="stylesheet" />
88
</head>
99
<body></body>
1010
<script type="module" src="./src/app.tsx"></script>

examples/editable-layers/advanced/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@deck.gl/react": "^9.0.12",
1414
"@types/react": "^18.2.75",
1515
"@types/react-dom": "^18.2.24",
16-
"mapbox-gl": "^3.2.0",
16+
"maplibre-gl": "^4.1.3",
1717
"react": "^18.2.0",
1818
"react-dom": "^18.2.0",
1919
"react-map-gl": "^7.1.7",

examples/editable-layers/advanced/src/app.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,3 @@ if (document.body) {
1212
const root = createRoot(container);
1313
root.render(<Example />);
1414
}
15-
16-
// eslint-disable-next-line no-console
17-
console.info('MapboxAccessToken', import.meta.env.VITE_MAPBOX_ACCESS_TOKEN);

examples/editable-layers/advanced/src/example.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {MapView, MapController} from '@deck.gl/core';
55
import StaticMap from 'react-map-gl';
66
import {GL} from '@luma.gl/constants';
77
import circle from '@turf/circle';
8+
import MapLibre from 'maplibre-gl';
89

910
import {
1011
EditableGeoJsonLayer,
@@ -828,8 +829,9 @@ export default class Example extends React.Component<
828829
renderStaticMap(viewport: Record<string, any>) {
829830
return (
830831
<StaticMap
832+
mapLib={MapLibre}
831833
{...viewport}
832-
mapStyle={'https://basemaps.cartocdn.com/gl/positron-gl-style/style.jsondark-v10'}
834+
mapStyle={'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json'}
833835
/>
834836
);
835837
}

examples/editable-layers/codesandbox/getting-started/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import DeckGL from '@deck.gl/react';
55
// eslint-disable-next-line import/named, import/no-extraneous-dependencies
66
import {HtmlOverlayItem, HtmlClusterOverlay} from '@deck.gl-community/react';
77
import StaticMap from 'react-map-gl';
8-
9-
const MAPBOX_ACCESS_TOKEN =
10-
'pk.eyJ1IjoiZ2Vvcmdpb3MtdWJlciIsImEiOiJjanZidTZzczAwajMxNGVwOGZrd2E5NG90In0.gdsRu_UeU_uPi9IulBruXA';
8+
import MapLibre from 'maplibre-gl';
119

1210
const DATA_URL = 'https://cors-tube.vercel.app/?url=https://whc.unesco.org/en/list/georss/';
1311

@@ -119,7 +117,7 @@ export class WorldHeritageApp extends React.Component {
119117
render() {
120118
return (
121119
<DeckGL initialViewState={initialViewState} controller={true}>
122-
<StaticMap mapboxApiAccessToken={MAPBOX_ACCESS_TOKEN} />
120+
<StaticMap mapLib={MapLibre} />
123121
{this.renderWorldHeritage()}
124122
</DeckGL>
125123
);

examples/editable-layers/codesandbox/getting-started/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"@deck.gl/react": "^8.8.23",
55
"@turf/helpers": "^6.5.0",
66
"global": "4.4.0",
7+
"maplibre-gl": "^4.1.3",
78
"react": "16.14.0",
89
"react-dom": "16.14.0",
910
"react-map-gl": "7.1.7",

examples/editable-layers/codesandbox/world-heritage/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import DeckGL from '@deck.gl/react';
55
// eslint-disable-next-line import/named
66
import {HtmlOverlayItem, HtmlClusterOverlay} from '@deck.gl-community/react';
77
import {StaticMap} from 'react-map-gl';
8-
9-
const MAPBOX_ACCESS_TOKEN =
10-
'pk.eyJ1IjoiZ2Vvcmdpb3MtdWJlciIsImEiOiJjanZidTZzczAwajMxNGVwOGZrd2E5NG90In0.gdsRu_UeU_uPi9IulBruXA';
8+
import MapLibre from 'maplibre-gl';
119

1210
const DATA_URL = 'https://cors-tube.vercel.app/?url=https://whc.unesco.org/en/list/georss/';
1311

@@ -119,7 +117,7 @@ export class WorldHeritageApp extends React.Component {
119117
render() {
120118
return (
121119
<DeckGL initialViewState={initialViewState} controller={true}>
122-
<StaticMap mapboxApiAccessToken={MAPBOX_ACCESS_TOKEN} />
120+
<StaticMap mapLib={MapLibre} />
123121
{this.renderWorldHeritage()}
124122
</DeckGL>
125123
);

examples/editable-layers/editable-h3-cluster-layer/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8" />
55
<title>deck.gl Community Example</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
7-
<link href="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.css" rel="stylesheet" />
7+
<link href="https://unpkg.com/maplibre-gl@^4.1.3/dist/maplibre-gl.css" rel="stylesheet" />
88
</head>
99
<body></body>
1010
<script type="module" src="./index.tsx"></script>

examples/editable-layers/editable-h3-cluster-layer/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import {
1010
} from '@deck.gl-community/editable-layers';
1111
import StaticMap from 'react-map-gl';
1212
import {hexagonCluster1, hexagonCluster2, hexagonCluster3} from './data';
13-
14-
const MAPBOX_ACCESS_TOKEN =
15-
'pk.eyJ1IjoiZ2Vvcmdpb3MtdWJlciIsImEiOiJjanZidTZzczAwajMxNGVwOGZrd2E5NG90In0.gdsRu_UeU_uPi9IulBruXA';
13+
import MapLibre from 'maplibre-gl';
1614

1715
const SELECTED_FILL_COLOR = [50, 100, 200, 230];
1816
const UNSELECTED_FILL_COLOR = [50, 100, 200, 100];
@@ -197,7 +195,10 @@ export function Example() {
197195
layers={[layer]}
198196
getCursor={layer.getCursor.bind(layer)}
199197
>
200-
<StaticMap mapStyle={'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json'} />
198+
<StaticMap
199+
mapLib={MapLibre}
200+
mapStyle={'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json'}
201+
/>
201202
</DeckGL>
202203
<Toolbar
203204
{...{

examples/editable-layers/editable-h3-cluster-layer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@deck.gl/react": "^9.0.12",
1616
"@types/react": "^18.2.75",
1717
"@types/react-dom": "^18.2.24",
18-
"mapbox-gl": "^3.2.0",
18+
"maplibre-gl": "^4.1.3",
1919
"react": "^18.2.0",
2020
"react-dom": "^18.2.0",
2121
"react-map-gl": "^7.1.7"

0 commit comments

Comments
 (0)