You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that by default, the `MVTLoader` parses data using web workers, with code loaded from a [CDN](https://unpkg.com). To change this behavior, see [loaders and workers](/docs/developer-guide/loading-data.md#loaders-and-web-workers).
Copy file name to clipboardExpand all lines: docs/api-reference/geo-layers/terrain-layer.md
+3-9Lines changed: 3 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,21 +145,15 @@ Must be supplied when using non-tiled elevation data.
145
145
- Default: `null`
146
146
147
147
148
-
##### `workerUrl` (String, optional)
149
-
150
-
**Advanced** Supply url to local terrain worker bundle. By default, it points to the latest published `@loaders.gl/terrain` NPM module on [unpkg.com](unpkg.com). Custom `workerUrl` may be desirable if the application wishes to serve the worker code itself without relying on the CDN. The worker bundle can be located locally in `"node_modules/@loaders.gl/terrain/dist/terrain-loader.worker.js"`.
151
-
152
-
Set `workerUrl` to an empty string to disable worker during debugging (improves error messages).
153
-
154
-
- Default: `null`
155
-
156
-
157
148
##### `loadOptions` (Object, optional)
158
149
159
150
On top of the [default options](/docs/api-reference/core/layer.md#loadoptions), also accepts options for the following loaders:
-[ImageLoader](https://loaders.gl/modules/images/docs/api-reference/image-loader) if the `texture` prop is supplied
162
154
155
+
Note that by default, the `TerrainLoader` parses data using web workers, with code loaded from a [CDN](https://unpkg.com). To change this behavior, see [loaders and workers](/docs/developer-guide/loading-data.md#loaders-and-web-workers).
Copy file name to clipboardExpand all lines: docs/developer-guide/loading-data.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -136,6 +136,36 @@ setInterval(() => {
136
136
}, 5*60*1000);
137
137
```
138
138
139
+
140
+
## Loaders and Web Workers
141
+
142
+
For the best performance, some specialized loaders parse data using web workers, for example `TerrainLoader` in the [TerrainLayer](/docs/api-reference/geo-layers/terrain-layer.md) and `MVTLoader` in the [MVTLayer](/docs/api-reference/geo-layers/mvt-layer.md). By default, the worker code is loaded from from the latest published NPM module on [unpkg.com](https://unpkg.com).
143
+
144
+
It might be desirable for some applications to serve the worker code itself without relying on the CDN. To do this, locate the worker bundle locally in `node_modules/@loaders.gl/<module>/dist/<name>-loader.worker.js` and serve it as a static asset with your server. Point the loader to use this alternative URL using `loadOptions.<name>.workerUrl`:
145
+
146
+
```js
147
+
newMVTLayer({
148
+
loadOptions: {
149
+
mvt: {
150
+
workerUrl:<my_worker_url>
151
+
}
152
+
}
153
+
}
154
+
```
155
+
156
+
If the layer is used in an environment that does not support web workers, or you need to debug the loader code on the main thread, you may import the full loader like this:
157
+
158
+
```js
159
+
import {MVTLoader} from'@loaders.gl/mvt';
160
+
newMVTLayer({
161
+
loaders: [MVTLoader],
162
+
loadOptions: {worker:false}
163
+
});
164
+
```
165
+
166
+
Refer to each specific layer's documentation to see which loaders are used.
167
+
168
+
139
169
## Load Resource Without an URL
140
170
141
171
In some use cases, resources do not exist at a static URL. For example, some applications construct images dynamically based on user input. Some applications receive arbitrary binary blobs from a server via a WebSocket connection.
Copy file name to clipboardExpand all lines: docs/upgrade-guide.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,25 @@ The module entry point is now only lightly transpiled for the most commonly used
25
25
-`CartoSQLLayer` will be deprecated in 8.6. Use `CartoLayer` instead with `type` set to `MAP_TYPES.QUERY`.
26
26
-`GeoJsonLayer`'s `getRadius` props is deprecated, replaced by `getPointRadius`.
27
27
- It is recommended to use `zoomOffset` in the `TileLayer` when trying to affect the `zoom` resolution at which tiles are fetched.
28
+
-`MVTLayer` and `TerrainLayer`'s default loaders no longer support parsing on the main thread. This is the same behavior as before, just dropping unused code from the bundle. Should you need to use the layers in an environment where web worker is not available, or debug the loaders, you can supply the full loader as such:
29
+
30
+
```js
31
+
import {MVTLoader} from'@loaders.gl/mvt';
32
+
newMVTLayer({
33
+
loaders: [MVTLoader],
34
+
loadOptions: {worker:false}
35
+
});
36
+
```
37
+
38
+
```js
39
+
import {TerrainLoader} from'@loaders.gl/terrain';
40
+
newTerrainLayer({
41
+
loaders: [TerrainLoader],
42
+
loadOptions: {worker:false}
43
+
});
44
+
```
45
+
-`TerrainLayer`'s `workerUrl` prop is removed, use `loadOptions.terrain.workerUrl` instead.
0 commit comments