@deck.gl/jupyter-widget 8.9.0-alpha.5 → 8.9.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4276 -26
- package/dist/index.js.map +7 -1
- package/package.json +15 -15
- package/src/deck-bundle.js +7 -13
- package/src/index.js +26 -18
- package/src/lib/jupyter-transport-model.js +59 -50
- package/src/lib/jupyter-transport-view.js +49 -41
- package/src/playground/create-deck.js +17 -13
- package/src/playground/playground.js +3 -2
- package/src/playground/utils/google-maps-utils.js +5 -3
- package/src/playground/utils/mapbox-utils.js +3 -10
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@deck.gl/jupyter-widget",
|
|
3
3
|
"description": "Jupyter widget for rendering deck.gl in a Jupyter notebook",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "8.9.0-
|
|
5
|
+
"version": "8.9.0-beta.2",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"jupyter",
|
|
8
8
|
"jupyterlab",
|
|
@@ -23,24 +23,24 @@
|
|
|
23
23
|
],
|
|
24
24
|
"sideEffects": false,
|
|
25
25
|
"scripts": {
|
|
26
|
-
"watch": "
|
|
27
|
-
"build": "
|
|
26
|
+
"watch": "npm run build -- --watch",
|
|
27
|
+
"build": "ocular-bundle ./src/index.js --output=./dist/index.js --globalName= --sourcemap --format=umd --externals=@jupyter-widgets/base",
|
|
28
28
|
"build:labextension": "npm pack",
|
|
29
|
-
"prepublishOnly": "
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@deck.gl/aggregation-layers": "8.9.0-
|
|
33
|
-
"@deck.gl/geo-layers": "8.9.0-
|
|
34
|
-
"@deck.gl/google-maps": "8.9.0-
|
|
35
|
-
"@deck.gl/json": "8.9.0-
|
|
36
|
-
"@deck.gl/layers": "8.9.0-
|
|
37
|
-
"@deck.gl/mesh-layers": "8.9.0-
|
|
32
|
+
"@deck.gl/aggregation-layers": "8.9.0-beta.2",
|
|
33
|
+
"@deck.gl/geo-layers": "8.9.0-beta.2",
|
|
34
|
+
"@deck.gl/google-maps": "8.9.0-beta.2",
|
|
35
|
+
"@deck.gl/json": "8.9.0-beta.2",
|
|
36
|
+
"@deck.gl/layers": "8.9.0-beta.2",
|
|
37
|
+
"@deck.gl/mesh-layers": "8.9.0-beta.2",
|
|
38
38
|
"@jupyter-widgets/base": "^1.1.10 || ^2 || ^3 || ^4",
|
|
39
|
-
"@loaders.gl/3d-tiles": "^3.
|
|
40
|
-
"@loaders.gl/core": "^3.
|
|
41
|
-
"@loaders.gl/csv": "^3.
|
|
39
|
+
"@loaders.gl/3d-tiles": "^3.3.1",
|
|
40
|
+
"@loaders.gl/core": "^3.3.1",
|
|
41
|
+
"@loaders.gl/csv": "^3.3.1",
|
|
42
42
|
"@luma.gl/constants": "^8.5.16",
|
|
43
|
-
"mapbox-gl": "^1.2
|
|
43
|
+
"mapbox-gl": "^1.13.2"
|
|
44
44
|
},
|
|
45
45
|
"jupyterlab": {
|
|
46
46
|
"extension": "src/plugin",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "5dae086e4f3eb46c30d8e761f9d600be4f68e949"
|
|
55
55
|
}
|
package/src/deck-bundle.js
CHANGED
|
@@ -2,16 +2,10 @@
|
|
|
2
2
|
* Pulls together all deck.gl dependencies used
|
|
3
3
|
* in @deck.gl/jupyter-widget
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
require('@deck.gl/mesh-layers'),
|
|
13
|
-
require('@deck.gl/google-maps'),
|
|
14
|
-
require('@deck.gl/json')
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
module.exports = deck;
|
|
5
|
+
export * from '@deck.gl/core';
|
|
6
|
+
export * from '@deck.gl/layers';
|
|
7
|
+
export * from '@deck.gl/aggregation-layers';
|
|
8
|
+
export * from '@deck.gl/geo-layers';
|
|
9
|
+
export * from '@deck.gl/mesh-layers';
|
|
10
|
+
export * from '@deck.gl/google-maps';
|
|
11
|
+
export * from '@deck.gl/json';
|
package/src/index.js
CHANGED
|
@@ -3,42 +3,50 @@
|
|
|
3
3
|
// See https://github.com/jupyter-widgets/widget-ts-cookiecutter/blob/master/%7B%7Bcookiecutter.github_project_name%7D%7D/src/extension.ts
|
|
4
4
|
// Entry point for the Jupyter Notebook bundle containing custom Backbone model and view definitions.
|
|
5
5
|
|
|
6
|
+
import {MODULE_VERSION, MODULE_NAME} from './version';
|
|
7
|
+
// TODO - this should be placed in a separate module `@deck.gl/playground`
|
|
8
|
+
import {createDeck, updateDeck} from './playground/create-deck';
|
|
9
|
+
import {initPlayground} from './playground';
|
|
10
|
+
import jupyterTransport from './lib/jupyter-transport';
|
|
11
|
+
import JupyterTransportModel from './lib/jupyter-transport-model';
|
|
12
|
+
import JupyterTransportView from './lib/jupyter-transport-view';
|
|
13
|
+
|
|
14
|
+
import * as deckExports from './deck-bundle';
|
|
15
|
+
import * as lumaExports from '@deck.gl/core/scripting/lumagl';
|
|
16
|
+
import * as loadersExports from '@deck.gl/core/scripting/loadersgl';
|
|
17
|
+
|
|
6
18
|
// Some static assets may be required by the custom widget javascript. The base
|
|
7
19
|
// url for the notebook is not known at build time and is therefore computed dynamically.
|
|
8
20
|
const dataBaseUrl = document.body && document.body.getAttribute('data-base-url');
|
|
9
21
|
if (dataBaseUrl) {
|
|
22
|
+
// @ts-expect-error undefined global property
|
|
10
23
|
window.__webpack_public_path__ = `${dataBaseUrl}nbextensions/pydeck/nb_extension`;
|
|
11
24
|
}
|
|
12
25
|
|
|
13
26
|
// Initialize the transport
|
|
14
|
-
const {jupyterTransport} = require('./lib/jupyter-transport').default;
|
|
15
|
-
|
|
16
|
-
let JupyterTransportModel = null;
|
|
17
|
-
let JupyterTransportView = null;
|
|
18
|
-
try {
|
|
19
|
-
JupyterTransportModel = require('./lib/jupyter-transport-model').default;
|
|
20
|
-
JupyterTransportView = require('./lib/jupyter-transport-view').default;
|
|
21
|
-
} catch (err) {
|
|
22
|
-
// Note: Happens in the to_html() case
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const {MODULE_VERSION, MODULE_NAME} = require('./version');
|
|
26
27
|
|
|
27
|
-
// TODO - this should be placed in a separate module `@deck.gl/playground`
|
|
28
|
-
const {createDeck, updateDeck} = require('./playground/create-deck');
|
|
29
|
-
const {initPlayground} = require('./playground');
|
|
30
28
|
initPlayground();
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
// Expose deck
|
|
31
|
+
globalThis.deck = globalThis.deck || {};
|
|
32
|
+
Object.assign(globalThis.deck, deckExports);
|
|
33
|
+
|
|
34
|
+
// Expose luma
|
|
35
|
+
globalThis.luma = globalThis.luma || {};
|
|
36
|
+
Object.assign(globalThis.luma, lumaExports);
|
|
37
|
+
|
|
38
|
+
// Expose loaders
|
|
39
|
+
globalThis.loaders = globalThis.loaders || {};
|
|
40
|
+
Object.assign(globalThis.loaders, loadersExports);
|
|
41
|
+
|
|
42
|
+
export {
|
|
33
43
|
// Transports
|
|
34
44
|
jupyterTransport,
|
|
35
|
-
|
|
36
45
|
// Jupyter Hooks
|
|
37
46
|
MODULE_VERSION,
|
|
38
47
|
MODULE_NAME,
|
|
39
48
|
JupyterTransportModel,
|
|
40
49
|
JupyterTransportView,
|
|
41
|
-
|
|
42
50
|
// For to_html()...
|
|
43
51
|
initPlayground,
|
|
44
52
|
// TODO - use playground?
|
|
@@ -1,56 +1,65 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as widgets from '@jupyter-widgets/base';
|
|
2
2
|
import {MODULE_NAME, MODULE_VERSION} from '../version';
|
|
3
3
|
import {deserializeMatrix} from './utils/deserialize-matrix';
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* Note: Variables shared explictly between Python and JavaScript use snake_case
|
|
7
|
-
*/
|
|
8
|
-
export default class JupyterTransportModel extends DOMWidgetModel {
|
|
9
|
-
defaults() {
|
|
10
|
-
return {
|
|
11
|
-
...super.defaults(),
|
|
12
|
-
_model_name: JupyterTransportModel.model_name,
|
|
13
|
-
_model_module: JupyterTransportModel.model_module,
|
|
14
|
-
_model_module_version: JupyterTransportModel.model_module_version,
|
|
15
|
-
_view_name: JupyterTransportModel.view_name,
|
|
16
|
-
_view_module: JupyterTransportModel.view_module,
|
|
17
|
-
_view_module_version: JupyterTransportModel.view_module_version,
|
|
18
|
-
custom_libraries: [],
|
|
19
|
-
json_input: null,
|
|
20
|
-
mapbox_key: null,
|
|
21
|
-
selected_data: [],
|
|
22
|
-
data_buffer: null,
|
|
23
|
-
tooltip: null,
|
|
24
|
-
width: '100%',
|
|
25
|
-
height: 500,
|
|
26
|
-
js_warning: false
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
4
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...DOMWidgetModel.serializers,
|
|
33
|
-
// Add any extra serializers here
|
|
34
|
-
data_buffer: {deserialize: deserializeMatrix}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
5
|
+
let JupyterTransportModel = null;
|
|
6
|
+
const DOMWidgetModel = widgets && widgets.DOMWidgetModel;
|
|
37
7
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
8
|
+
if (DOMWidgetModel) {
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* Note: Variables shared explictly between Python and JavaScript use snake_case
|
|
12
|
+
*/
|
|
13
|
+
class Model extends DOMWidgetModel {
|
|
14
|
+
defaults() {
|
|
15
|
+
return {
|
|
16
|
+
...super.defaults(),
|
|
17
|
+
_model_name: JupyterTransportModel.model_name,
|
|
18
|
+
_model_module: JupyterTransportModel.model_module,
|
|
19
|
+
_model_module_version: JupyterTransportModel.model_module_version,
|
|
20
|
+
_view_name: JupyterTransportModel.view_name,
|
|
21
|
+
_view_module: JupyterTransportModel.view_module,
|
|
22
|
+
_view_module_version: JupyterTransportModel.view_module_version,
|
|
23
|
+
custom_libraries: [],
|
|
24
|
+
json_input: null,
|
|
25
|
+
mapbox_key: null,
|
|
26
|
+
selected_data: [],
|
|
27
|
+
data_buffer: null,
|
|
28
|
+
tooltip: null,
|
|
29
|
+
width: '100%',
|
|
30
|
+
height: 500,
|
|
31
|
+
js_warning: false
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static get serializers() {
|
|
36
|
+
return {
|
|
37
|
+
...DOMWidgetModel.serializers,
|
|
38
|
+
// Add any extra serializers here
|
|
39
|
+
data_buffer: {deserialize: deserializeMatrix}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static get model_name() {
|
|
44
|
+
return 'JupyterTransportModel';
|
|
45
|
+
}
|
|
46
|
+
static get model_module() {
|
|
47
|
+
return MODULE_NAME;
|
|
48
|
+
}
|
|
49
|
+
static get model_module_version() {
|
|
50
|
+
return MODULE_VERSION;
|
|
51
|
+
}
|
|
52
|
+
static get view_name() {
|
|
53
|
+
return 'JupyterTransportView';
|
|
54
|
+
}
|
|
55
|
+
static get view_module() {
|
|
56
|
+
return MODULE_NAME;
|
|
57
|
+
}
|
|
58
|
+
static get view_module_version() {
|
|
59
|
+
return MODULE_VERSION;
|
|
60
|
+
}
|
|
55
61
|
}
|
|
62
|
+
JupyterTransportModel = Model;
|
|
56
63
|
}
|
|
64
|
+
|
|
65
|
+
export default JupyterTransportModel;
|
|
@@ -1,56 +1,64 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as widgets from '@jupyter-widgets/base';
|
|
2
2
|
import JupyterTransport from './jupyter-transport';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.listenTo(this.model, 'destroy', this.remove);
|
|
4
|
+
let JupyterTransportView = null;
|
|
5
|
+
const DOMWidgetView = widgets && widgets.DOMWidgetView;
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
if (DOMWidgetView) {
|
|
8
|
+
class View extends DOMWidgetView {
|
|
9
|
+
initialize() {
|
|
10
|
+
this.listenTo(this.model, 'destroy', this.remove);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.transport._initialize();
|
|
16
|
-
super.initialize.apply(this, arguments);
|
|
17
|
-
}
|
|
12
|
+
// TODO - is there any variable information on the model we can use to
|
|
13
|
+
// give an interesting name or id to this instance?
|
|
14
|
+
this.transport = new JupyterTransport();
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.transport.
|
|
22
|
-
this.transport.
|
|
23
|
-
|
|
24
|
-
this.transport = null;
|
|
16
|
+
// Expose Jupyter internals to enable work-arounds
|
|
17
|
+
this.transport.jupyterModel = this.model;
|
|
18
|
+
this.transport.jupyterView = this;
|
|
19
|
+
this.transport._initialize();
|
|
20
|
+
super.initialize.apply(this, arguments);
|
|
25
21
|
}
|
|
26
|
-
}
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
remove() {
|
|
24
|
+
if (this.transport) {
|
|
25
|
+
this.transport._finalize();
|
|
26
|
+
this.transport.jupyterModel = null;
|
|
27
|
+
this.transport.jupyterView = null;
|
|
28
|
+
this.transport = null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
render() {
|
|
33
|
+
super.render();
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
this.model.on('change:json_input', this.onJsonChanged.bind(this));
|
|
36
|
+
this.model.on('change:data_buffer', this.onDataBufferChanged.bind(this));
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.transport._messageReceived({type: 'json', json});
|
|
40
|
-
}
|
|
38
|
+
this.onDataBufferChanged();
|
|
39
|
+
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const dataBuffer = this.model.get('data_buffer');
|
|
45
|
-
|
|
46
|
-
if (json && dataBuffer) {
|
|
47
|
-
this.transport._messageReceived({
|
|
48
|
-
type: 'json-with-binary',
|
|
49
|
-
json,
|
|
50
|
-
binary: dataBuffer
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
41
|
+
onJsonChanged() {
|
|
42
|
+
const json = JSON.parse(this.model.get('json_input'));
|
|
53
43
|
this.transport._messageReceived({type: 'json', json});
|
|
54
44
|
}
|
|
45
|
+
|
|
46
|
+
onDataBufferChanged() {
|
|
47
|
+
const json = this.model.get('json_input');
|
|
48
|
+
const dataBuffer = this.model.get('data_buffer');
|
|
49
|
+
|
|
50
|
+
if (json && dataBuffer) {
|
|
51
|
+
this.transport._messageReceived({
|
|
52
|
+
type: 'json-with-binary',
|
|
53
|
+
json,
|
|
54
|
+
binary: dataBuffer
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
this.transport._messageReceived({type: 'json', json});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
55
60
|
}
|
|
61
|
+
JupyterTransportView = View;
|
|
56
62
|
}
|
|
63
|
+
|
|
64
|
+
export default JupyterTransportView;
|
|
@@ -13,10 +13,14 @@ import {createGoogleMapsDeckOverlay} from './utils/google-maps-utils';
|
|
|
13
13
|
|
|
14
14
|
import {addSupportComponents} from '../lib/components/index';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
/* eslint-disable import/namespace */
|
|
17
|
+
import * as deckExports from '../deck-bundle';
|
|
18
|
+
import {COORDINATE_SYSTEM, log, WebMercatorViewport} from '@deck.gl/core';
|
|
19
|
+
import {JSONConverter} from '@deck.gl/json';
|
|
20
|
+
import DeckGL from '@deck.gl/core/scripting/deckgl';
|
|
17
21
|
|
|
18
22
|
const classesFilter = x => x.charAt(0) === x.charAt(0).toUpperCase();
|
|
19
|
-
const functionsFilter = x => x.charAt(0) === x.charAt(0).toLowerCase() && x.charAt(0)
|
|
23
|
+
const functionsFilter = x => x.charAt(0) === x.charAt(0).toLowerCase() && x.charAt(0) !== '_';
|
|
20
24
|
|
|
21
25
|
function extractElements(library = {}, filter) {
|
|
22
26
|
// Extracts exported elements as a dictionary from a library
|
|
@@ -30,17 +34,17 @@ function extractElements(library = {}, filter) {
|
|
|
30
34
|
|
|
31
35
|
// Handle JSONConverter and loaders configuration
|
|
32
36
|
const jsonConverterConfiguration = {
|
|
33
|
-
classes: extractElements(
|
|
37
|
+
classes: extractElements(deckExports, classesFilter),
|
|
34
38
|
// Will be resolved as `<enum-name>.<enum-value>`
|
|
35
39
|
enumerations: {
|
|
36
|
-
COORDINATE_SYSTEM
|
|
40
|
+
COORDINATE_SYSTEM,
|
|
37
41
|
GL: GLConstants
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
registerLoaders([CSVLoader]);
|
|
42
46
|
|
|
43
|
-
const jsonConverter = new
|
|
47
|
+
const jsonConverter = new JSONConverter({
|
|
44
48
|
configuration: jsonConverterConfiguration
|
|
45
49
|
});
|
|
46
50
|
|
|
@@ -122,7 +126,7 @@ function createStandaloneFromProvider({
|
|
|
122
126
|
onHover: info => handleEvent('deck-hover-event', info),
|
|
123
127
|
onResize: size => handleEvent('deck-resize-event', size),
|
|
124
128
|
onViewStateChange: ({viewState, interactionState, oldViewState}) => {
|
|
125
|
-
const viewport = new
|
|
129
|
+
const viewport = new WebMercatorViewport(viewState);
|
|
126
130
|
viewState.nw = viewport.unproject([0, 0]);
|
|
127
131
|
viewState.se = viewport.unproject([viewport.width, viewport.height]);
|
|
128
132
|
handleEvent('deck-view-state-change-event', viewState);
|
|
@@ -141,8 +145,8 @@ function createStandaloneFromProvider({
|
|
|
141
145
|
|
|
142
146
|
switch (mapProvider) {
|
|
143
147
|
case 'mapbox':
|
|
144
|
-
|
|
145
|
-
return new
|
|
148
|
+
log.info('Using Mapbox base maps')();
|
|
149
|
+
return new DeckGL({
|
|
146
150
|
...sharedProps,
|
|
147
151
|
...props,
|
|
148
152
|
map: mapboxgl,
|
|
@@ -150,22 +154,22 @@ function createStandaloneFromProvider({
|
|
|
150
154
|
onLoad: modifyMapboxElements
|
|
151
155
|
});
|
|
152
156
|
case 'carto':
|
|
153
|
-
|
|
154
|
-
return new
|
|
157
|
+
log.info('Using Carto base maps')();
|
|
158
|
+
return new DeckGL({
|
|
155
159
|
map: mapboxgl,
|
|
156
160
|
...sharedProps,
|
|
157
161
|
...props
|
|
158
162
|
});
|
|
159
163
|
case 'google_maps':
|
|
160
|
-
|
|
164
|
+
log.info('Using Google Maps base maps')();
|
|
161
165
|
return createGoogleMapsDeckOverlay({
|
|
162
166
|
...sharedProps,
|
|
163
167
|
...props,
|
|
164
168
|
googleMapsKey
|
|
165
169
|
});
|
|
166
170
|
default:
|
|
167
|
-
|
|
168
|
-
return new
|
|
171
|
+
log.info('No recognized map provider specified')();
|
|
172
|
+
return new DeckGL({
|
|
169
173
|
...sharedProps,
|
|
170
174
|
...props,
|
|
171
175
|
map: null,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {Layer} from '@deck.gl/core';
|
|
2
2
|
|
|
3
3
|
import {Transport} from '@deck.gl/json';
|
|
4
4
|
|
|
@@ -83,7 +83,8 @@ export function processDataBuffer({binary, convertedJson}) {
|
|
|
83
83
|
|
|
84
84
|
// Filters circular references on JSON string conversion
|
|
85
85
|
function filterJsonValue(key, value) {
|
|
86
|
-
|
|
86
|
+
// eslint-disable-next-line
|
|
87
|
+
return value instanceof Layer ? value.id : value;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
// Handles a general event
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* global window */
|
|
2
|
-
|
|
2
|
+
/* eslint-disable import/namespace */
|
|
3
|
+
import {log} from '@deck.gl/core';
|
|
4
|
+
import {GoogleMapsOverlay} from '@deck.gl/google-maps';
|
|
3
5
|
|
|
4
6
|
export function createGoogleMapsDeckOverlay({
|
|
5
7
|
container,
|
|
@@ -12,10 +14,10 @@ export function createGoogleMapsDeckOverlay({
|
|
|
12
14
|
initialViewState = {latitude: 0, longitude: 0, zoom: 1}
|
|
13
15
|
}) {
|
|
14
16
|
if (!googleMapsKey) {
|
|
15
|
-
|
|
17
|
+
log.warn('No Google Maps API key set')();
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
|
-
const deckOverlay = new
|
|
20
|
+
const deckOverlay = new GoogleMapsOverlay({layers});
|
|
19
21
|
const view = {
|
|
20
22
|
center: {lat: initialViewState.latitude, lng: initialViewState.longitude},
|
|
21
23
|
mapTypeId: mapStyle,
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
/* global
|
|
1
|
+
/* global document */
|
|
2
2
|
import {loadCSS} from './css-utils';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
// From https://github.com/mapbox/mapbox-gl-js/issues/4593#issuecomment-546290823
|
|
6
|
-
// eslint-disable-next-line no-undef
|
|
7
|
-
let mapboxgl;
|
|
4
|
+
import mapboxgl from 'mapbox-gl';
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
mapboxgl = require('mapbox-gl');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const MAPBOX_CSS_URL = 'https://api.tiles.mapbox.com/mapbox-gl-js/v1.2.1/mapbox-gl.css';
|
|
6
|
+
const MAPBOX_CSS_URL = 'https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css';
|
|
14
7
|
|
|
15
8
|
export default mapboxgl;
|
|
16
9
|
|