@deck.gl/geo-layers 8.7.0 → 8.7.3
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/dist.dev.js +30 -25
- package/dist/es5/mvt-layer/mvt-layer.js +22 -20
- package/dist/es5/mvt-layer/mvt-layer.js.map +1 -1
- package/dist/esm/mvt-layer/mvt-layer.js +13 -9
- package/dist/esm/mvt-layer/mvt-layer.js.map +1 -1
- package/dist.min.js +1 -1
- package/package.json +2 -2
- package/src/mvt-layer/mvt-layer.js +12 -7
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@deck.gl/geo-layers",
|
|
3
3
|
"description": "deck.gl layers supporting geospatial use cases and GIS formats",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "8.7.
|
|
5
|
+
"version": "8.7.3",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"@deck.gl/mesh-layers": "^8.0.0",
|
|
50
50
|
"@loaders.gl/core": "^3.0.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "72504c7acaeaf6862fb85acfa8ea3369d1a6875f"
|
|
53
53
|
}
|
|
@@ -15,6 +15,7 @@ import {GeoJsonLayer} from '@deck.gl/layers';
|
|
|
15
15
|
const WORLD_SIZE = 512;
|
|
16
16
|
|
|
17
17
|
const defaultProps = {
|
|
18
|
+
...GeoJsonLayer.defaultProps,
|
|
18
19
|
uniqueIdProperty: {type: 'string', value: ''},
|
|
19
20
|
highlightedFeatureId: null,
|
|
20
21
|
loaders: [MVTWorkerLoader],
|
|
@@ -24,7 +25,10 @@ const defaultProps = {
|
|
|
24
25
|
export default class MVTLayer extends TileLayer {
|
|
25
26
|
initializeState() {
|
|
26
27
|
super.initializeState();
|
|
28
|
+
// GlobeView doesn't work well with binary data
|
|
29
|
+
const binary = this.context.viewport.resolution !== undefined ? false : this.props.binary;
|
|
27
30
|
this.setState({
|
|
31
|
+
binary,
|
|
28
32
|
data: null,
|
|
29
33
|
tileJSON: null
|
|
30
34
|
});
|
|
@@ -110,7 +114,8 @@ export default class MVTLayer extends TileLayer {
|
|
|
110
114
|
return Promise.reject('Invalid URL');
|
|
111
115
|
}
|
|
112
116
|
let loadOptions = this.getLoadOptions();
|
|
113
|
-
const {binary
|
|
117
|
+
const {binary} = this.state;
|
|
118
|
+
const {fetch} = this.props;
|
|
114
119
|
const {signal, x, y, z} = tile;
|
|
115
120
|
loadOptions = {
|
|
116
121
|
...loadOptions,
|
|
@@ -152,7 +157,7 @@ export default class MVTLayer extends TileLayer {
|
|
|
152
157
|
|
|
153
158
|
const subLayers = super.renderSubLayers(props);
|
|
154
159
|
|
|
155
|
-
if (this.
|
|
160
|
+
if (this.state.binary && !(subLayers instanceof GeoJsonLayer)) {
|
|
156
161
|
log.warn('renderSubLayers() must return GeoJsonLayer when using binary:true')();
|
|
157
162
|
}
|
|
158
163
|
|
|
@@ -193,7 +198,7 @@ export default class MVTLayer extends TileLayer {
|
|
|
193
198
|
|
|
194
199
|
const isWGS84 = this.context.viewport.resolution;
|
|
195
200
|
|
|
196
|
-
if (this.
|
|
201
|
+
if (this.state.binary && info.index !== -1) {
|
|
197
202
|
const {data} = params.sourceLayer.props;
|
|
198
203
|
info.object = binaryToGeojson(data, {globalFeatureId: info.index});
|
|
199
204
|
}
|
|
@@ -212,8 +217,8 @@ export default class MVTLayer extends TileLayer {
|
|
|
212
217
|
}
|
|
213
218
|
|
|
214
219
|
getHighlightedObjectIndex(tile) {
|
|
215
|
-
const {hoveredFeatureId, hoveredFeatureLayerName} = this.state;
|
|
216
|
-
const {uniqueIdProperty, highlightedFeatureId
|
|
220
|
+
const {hoveredFeatureId, hoveredFeatureLayerName, binary} = this.state;
|
|
221
|
+
const {uniqueIdProperty, highlightedFeatureId} = this.props;
|
|
217
222
|
const data = tile.content;
|
|
218
223
|
|
|
219
224
|
const isHighlighted = isFeatureIdDefined(highlightedFeatureId);
|
|
@@ -293,7 +298,7 @@ export default class MVTLayer extends TileLayer {
|
|
|
293
298
|
return null;
|
|
294
299
|
}
|
|
295
300
|
|
|
296
|
-
if (this.
|
|
301
|
+
if (this.state.binary && Array.isArray(tile.content) && !tile.content.length) {
|
|
297
302
|
// TODO: @loaders.gl/mvt returns [] when no content. It should return a valid empty binary.
|
|
298
303
|
// https://github.com/visgl/loaders.gl/pull/1137
|
|
299
304
|
return [];
|
|
@@ -301,7 +306,7 @@ export default class MVTLayer extends TileLayer {
|
|
|
301
306
|
|
|
302
307
|
if (tile._contentWGS84 === undefined) {
|
|
303
308
|
// Create a cache to transform only once
|
|
304
|
-
const content = this.
|
|
309
|
+
const content = this.state.binary ? binaryToGeojson(tile.content) : tile.content;
|
|
305
310
|
tile._contentWGS84 = content.map(feature =>
|
|
306
311
|
transformTileCoordsToWGS84(feature, tile.bbox, this.context.viewport)
|
|
307
312
|
);
|