@maplibre/maplibre-react-native 8.6.0-beta.1 → 9.0.0
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/CHANGELOG.md +7 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +1 -7
- package/android/install.md +3 -3
- package/android/rctmgl/build.gradle +1 -1
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +33 -0
- package/app.plugin.js +1 -1
- package/docs/Annotation.md +1 -1
- package/docs/Annotations.md +3 -8
- package/docs/BackgroundLayer.md +2 -2
- package/docs/Callout.md +1 -1
- package/docs/Camera.md +2 -2
- package/docs/CircleLayer.md +31 -14
- package/docs/CustomHttpHeaders.md +9 -9
- package/docs/FillExtrusionLayer.md +2 -2
- package/docs/FillLayer.md +27 -10
- package/docs/GettingStarted.md +6 -8
- package/docs/HeadingIndicator.md +1 -1
- package/docs/HeatmapLayer.md +2 -2
- package/docs/ImageSource.md +1 -1
- package/docs/Images.md +1 -1
- package/docs/Light.md +1 -1
- package/docs/LineLayer.md +31 -14
- package/docs/{MapboxGL.md → MapLibreGL.md} +5 -5
- package/docs/MapView.md +5 -5
- package/docs/MarkerView.md +1 -1
- package/docs/NativeUserLocation.md +1 -1
- package/docs/OfflineManager.md +16 -16
- package/docs/PointAnnotation.md +1 -1
- package/docs/RasterLayer.md +2 -2
- package/docs/RasterSource.md +2 -2
- package/docs/ShapeSource.md +2 -2
- package/docs/Style.md +3 -3
- package/docs/StyleSheet.md +93 -72
- package/docs/SymbolLayer.md +17 -13
- package/docs/UserLocation.md +2 -2
- package/docs/VectorSource.md +2 -2
- package/docs/docs.json +102 -46
- package/docs/snapshotManager.md +7 -7
- package/index.d.ts +8 -7
- package/ios/RCTMGL/RCTMGLStyle.h +3 -0
- package/ios/RCTMGL/RCTMGLStyle.m +23 -2
- package/ios/RCTMGL/index.d.ts +24 -5
- package/ios/install.md +12 -4
- package/javascript/components/BackgroundLayer.js +2 -2
- package/javascript/components/Camera.js +6 -6
- package/javascript/components/CircleLayer.js +2 -2
- package/javascript/components/FillExtrusionLayer.js +2 -2
- package/javascript/components/FillLayer.js +2 -2
- package/javascript/components/HeatmapLayer.js +2 -2
- package/javascript/components/LineLayer.js +2 -2
- package/javascript/components/MapView.js +38 -41
- package/javascript/components/RasterLayer.js +2 -2
- package/javascript/components/RasterSource.js +2 -2
- package/javascript/components/ShapeSource.js +2 -2
- package/javascript/components/Style.js +3 -3
- package/javascript/components/SymbolLayer.js +2 -2
- package/javascript/components/UserLocation.js +2 -0
- package/javascript/components/VectorSource.js +2 -2
- package/javascript/index.js +38 -42
- package/javascript/modules/location/locationManager.js +8 -8
- package/javascript/modules/offline/OfflinePack.js +4 -4
- package/javascript/modules/offline/offlineManager.js +34 -34
- package/javascript/modules/snapshot/SnapshotOptions.js +2 -2
- package/javascript/modules/snapshot/snapshotManager.js +8 -8
- package/javascript/utils/styleMap.js +37 -6
- package/maplibre-react-native.podspec +1 -1
- package/package.json +5 -5
- package/plugin/build/{withMapbox.d.ts → withMapLibre.d.ts} +1 -1
- package/plugin/build/{withMapbox.js → withMapLibre.js} +7 -7
- package/plugin/install.md +1 -1
- package/scripts/download-style-spec.sh +2 -2
- package/scripts/templates/component.md.ejs +1 -1
- package/scripts/templates/styleMap.js.ejs +1 -1
- package/style-spec/v8.json +266 -43
package/docs/MapView.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<!-- This file was autogenerated from MapView.js do not modify -->
|
|
2
|
-
## <
|
|
3
|
-
### MapView backed by
|
|
2
|
+
## <MapLibreGL.MapView />
|
|
3
|
+
### MapView backed by MapLibre GL Native
|
|
4
4
|
|
|
5
5
|
### props
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
8
|
| contentInset | `union` | `none` | `false` | The distance from the edges of the map view’s frame to the edges of the map view’s logical viewport. |
|
|
9
9
|
| style | `any` | `none` | `false` | Style for wrapping React Native View |
|
|
10
|
-
| styleURL | `string` | `none` | `false` | Style URL for map - notice, if non is set it _will_ default to `
|
|
10
|
+
| styleURL | `string` | `none` | `false` | Style URL for map - notice, if non is set it _will_ default to `MapLibreGL.StyleURL.Street` |
|
|
11
11
|
| styleJSON | `string` | `none` | `false` | StyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec |
|
|
12
12
|
| preferredFramesPerSecond | `number` | `none` | `false` | iOS: The preferred frame rate at which the map view is rendered.<br/>The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,<br/>which will adaptively set the preferred frame rate based on the capability of<br/>the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.<br/><br/>Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.<br/>This property can be set to arbitrary integer values. |
|
|
13
13
|
| localizeLabels | `bool` | `false` | `false` | Automatically change the language of the map labels to the system’s preferred language,<br/>this is not something that can be toggled on/off |
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
| scrollEnabled | `bool` | `true` | `false` | Enable/Disable scroll on the map |
|
|
16
16
|
| pitchEnabled | `bool` | `true` | `false` | Enable/Disable pitch on map |
|
|
17
17
|
| rotateEnabled | `bool` | `true` | `false` | Enable/Disable rotation on map |
|
|
18
|
-
| attributionEnabled | `bool` | `true` | `false` |
|
|
18
|
+
| attributionEnabled | `bool` | `true` | `false` | Enable/Disable attribution on map.<br/><br/>This must be enabled for Mapbox-hosted tiles and styles. Please refer to the Mapbox Terms of Service.<br/>Other providers do not require this. |
|
|
19
19
|
| attributionPosition | `union` | `none` | `false` | Adds attribution offset, e.g. `{top: 8, left: 8}` will put attribution button in top-left corner of the map |
|
|
20
20
|
| tintColor | `union` | `none` | `false` | MapView's tintColor |
|
|
21
|
-
| logoEnabled | `bool` | `
|
|
21
|
+
| logoEnabled | `bool` | `false` | `false` | Enable/Disable the logo on the map. |
|
|
22
22
|
| logoPosition | `union` | `none` | `false` | Adds logo offset, e.g. `{top: 8, left: 8}` will put the logo in top-left corner of the map |
|
|
23
23
|
| compassEnabled | `bool` | `none` | `false` | Enable/Disable the compass from appearing on the map |
|
|
24
24
|
| compassViewPosition | `number` | `none` | `false` | Change corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight |
|
package/docs/MarkerView.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!-- This file was autogenerated from MarkerView.js do not modify -->
|
|
2
|
-
## <
|
|
2
|
+
## <MapLibreGL.MarkerView />
|
|
3
3
|
### MarkerView allows you to place a interactive react native marker to the map.<br/><br/>If you have static view consider using PointAnnotation or SymbolLayer they'll offer much better performance<br/>.<br/>This is based on [MakerView plugin](https://docs.mapbox.com/android/plugins/overview/markerview/) on Android<br/>and PointAnnotation on iOS.
|
|
4
4
|
|
|
5
5
|
### props
|
package/docs/OfflineManager.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!-- This file was autogenerated from offlineManager.js do not modify -->
|
|
2
|
-
## <
|
|
2
|
+
## <MapLibreGL.offlineManager />
|
|
3
3
|
### OfflineManager implements a singleton (shared object) that manages offline packs.<br/>All of this class’s instance methods are asynchronous, reflecting the fact that offline resources are stored in a database.<br/>The shared object maintains a canonical collection of offline packs.
|
|
4
4
|
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ Creates and registers an offline pack that downloads the resources needed to use
|
|
|
21
21
|
const progressListener = (offlineRegion, status) => console.log(offlineRegion, status);
|
|
22
22
|
const errorListener = (offlineRegion, err) => console.log(offlineRegion, err);
|
|
23
23
|
|
|
24
|
-
await
|
|
24
|
+
await MapLibreGL.offlineManager.createPack({
|
|
25
25
|
name: 'offlinePack',
|
|
26
26
|
styleURL: 'mapbox://...',
|
|
27
27
|
minZoom: 14,
|
|
@@ -43,7 +43,7 @@ Invalidates the specified offline pack. This method checks that the tiles in the
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
```javascript
|
|
46
|
-
await
|
|
46
|
+
await MapLibreGL.offlineManager.invalidatePack('packName')
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
|
|
@@ -59,7 +59,7 @@ Unregisters the given offline pack and allows resources that are no longer requi
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
```javascript
|
|
62
|
-
await
|
|
62
|
+
await MapLibreGL.offlineManager.deletePack('packName')
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
|
|
@@ -75,7 +75,7 @@ Forces a revalidation of the tiles in the ambient cache and downloads a fresh ve
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
```javascript
|
|
78
|
-
await
|
|
78
|
+
await MapLibreGL.offlineManager.invalidateAmbientCache();
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
|
|
@@ -91,7 +91,7 @@ Erases resources from the ambient cache.<br/>This method clears the cache and de
|
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
```javascript
|
|
94
|
-
await
|
|
94
|
+
await MapLibreGL.offlineManager.clearAmbientCache();
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
|
|
@@ -107,7 +107,7 @@ Sets the maximum size of the ambient cache in bytes. Disables the ambient cache
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
```javascript
|
|
110
|
-
await
|
|
110
|
+
await MapLibreGL.offlineManager.setMaximumAmbientCacheSize(5000000);
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
|
|
@@ -123,7 +123,7 @@ Deletes the existing database, which includes both the ambient cache and offline
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
```javascript
|
|
126
|
-
await
|
|
126
|
+
await MapLibreGL.offlineManager.resetDatabase();
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
|
|
@@ -139,7 +139,7 @@ Retrieves all the current offline packs that are stored in the database.
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
```javascript
|
|
142
|
-
const offlinePacks = await
|
|
142
|
+
const offlinePacks = await MapLibreGL.offlineManager.getPacks();
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
|
|
@@ -155,7 +155,7 @@ Retrieves an offline pack that is stored in the database by name.
|
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
```javascript
|
|
158
|
-
const offlinePack = await
|
|
158
|
+
const offlinePack = await MapLibreGL.offlineManager.getPack();
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
|
|
@@ -171,13 +171,13 @@ Sideloads offline db
|
|
|
171
171
|
|
|
172
172
|
|
|
173
173
|
```javascript
|
|
174
|
-
await
|
|
174
|
+
await MapLibreGL.offlineManager.mergeOfflineRegions(path);
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
|
|
178
178
|
#### setTileCountLimit(limit)
|
|
179
179
|
|
|
180
|
-
Sets the maximum number of
|
|
180
|
+
Sets the maximum number of tiles that may be downloaded and stored on the current device.<br/>Consult the Terms of Service for your map tile host before changing this value.
|
|
181
181
|
|
|
182
182
|
##### arguments
|
|
183
183
|
| Name | Type | Required | Description |
|
|
@@ -187,7 +187,7 @@ Sets the maximum number of Mapbox-hosted tiles that may be downloaded and stored
|
|
|
187
187
|
|
|
188
188
|
|
|
189
189
|
```javascript
|
|
190
|
-
|
|
190
|
+
MapLibreGL.offlineManager.setTileCountLimit(1000);
|
|
191
191
|
```
|
|
192
192
|
|
|
193
193
|
|
|
@@ -203,7 +203,7 @@ Sets the period at which download status events will be sent over the React Nati
|
|
|
203
203
|
|
|
204
204
|
|
|
205
205
|
```javascript
|
|
206
|
-
|
|
206
|
+
MapLibreGL.offlineManager.setProgressEventThrottle(500);
|
|
207
207
|
```
|
|
208
208
|
|
|
209
209
|
|
|
@@ -223,7 +223,7 @@ Subscribe to download status/error events for the requested offline pack.<br/>No
|
|
|
223
223
|
```javascript
|
|
224
224
|
const progressListener = (offlinePack, status) => console.log(offlinePack, status)
|
|
225
225
|
const errorListener = (offlinePack, err) => console.log(offlinePack, err)
|
|
226
|
-
|
|
226
|
+
MapLibreGL.offlineManager.subscribe('packName', progressListener, errorListener)
|
|
227
227
|
```
|
|
228
228
|
|
|
229
229
|
|
|
@@ -239,7 +239,7 @@ Unsubscribes any listeners associated with the offline pack.<br/>It's a good ide
|
|
|
239
239
|
|
|
240
240
|
|
|
241
241
|
```javascript
|
|
242
|
-
|
|
242
|
+
MapLibreGL.offlineManager.unsubscribe('packName')
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
|
package/docs/PointAnnotation.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!-- This file was autogenerated from PointAnnotation.js do not modify -->
|
|
2
|
-
## <
|
|
2
|
+
## <MapLibreGL.PointAnnotation />
|
|
3
3
|
### PointAnnotation represents a one-dimensional shape located at a single geographical coordinate.<br/><br/>Consider using ShapeSource and SymbolLayer instead, if you have many points and you have static images,<br/>they'll offer much better performance<br/><br/>.<br/>If you need interctive views please use MarkerView,<br/>as with PointAnnotation on Android child views are rendered onto a bitmap for better performance.
|
|
4
4
|
|
|
5
5
|
### props
|
package/docs/RasterLayer.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<!-- This file was autogenerated from RasterLayer.js do not modify -->
|
|
2
|
-
## <
|
|
2
|
+
## <MapLibreGL.RasterLayer />
|
|
3
3
|
###
|
|
4
4
|
|
|
5
5
|
### props
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
8
|
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
|
|
9
|
-
| sourceID | `string` | `
|
|
9
|
+
| sourceID | `string` | `MapLibreGL.StyleSource.DefaultSourceID` | `false` | The source from which to obtain the data to style.<br/>If the source has not yet been added to the current style, the behavior is undefined.<br/>Inferred from parent source only if the layer is a direct child to it. |
|
|
10
10
|
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style. |
|
|
11
11
|
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
|
|
12
12
|
| belowLayerID | `string` | `none` | `false` | Inserts a layer below belowLayerID |
|
package/docs/RasterSource.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!-- This file was autogenerated from RasterSource.js do not modify -->
|
|
2
|
-
## <
|
|
2
|
+
## <MapLibreGL.RasterSource />
|
|
3
3
|
### RasterSource is a map content source that supplies raster image tiles to be shown on the map.<br/>The location of and metadata about the tiles are defined either by an option dictionary<br/>or by an external file that conforms to the TileJSON specification.
|
|
4
4
|
|
|
5
5
|
### props
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
|
-
| id | `string` | `
|
|
8
|
+
| id | `string` | `MapLibreGL.StyleSource.DefaultSourceID` | `false` | A string that uniquely identifies the source. |
|
|
9
9
|
| url | `string` | `none` | `false` | A URL to a TileJSON configuration file describing the source’s contents and other metadata. |
|
|
10
10
|
| tileUrlTemplates | `array` | `none` | `false` | An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.<br/>Example: https://example.com/raster-tiles/{z}/{x}/{y}.png |
|
|
11
11
|
| minZoomLevel | `number` | `none` | `false` | An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.<br/>The value should be between 0 and 22, inclusive, and less than<br/>maxZoomLevel, if specified. The default value for this option is 0. |
|
package/docs/ShapeSource.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!-- This file was autogenerated from ShapeSource.js do not modify -->
|
|
2
|
-
## <
|
|
2
|
+
## <MapLibreGL.ShapeSource />
|
|
3
3
|
### ShapeSource is a map content source that supplies vector shapes to be shown on the map.<br/>The shape may be a url or a GeoJSON object
|
|
4
4
|
|
|
5
5
|
### props
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
|
-
| id | `string` | `
|
|
8
|
+
| id | `string` | `MapLibreGL.StyleSource.DefaultSourceID` | `false` | A string that uniquely identifies the source. |
|
|
9
9
|
| url | `string` | `none` | `false` | An HTTP(S) URL, absolute file URL, or local file URL relative to the current application’s resource bundle. |
|
|
10
10
|
| shape | `object` | `none` | `false` | The contents of the source. A shape can represent a GeoJSON geometry, a feature, or a feature colllection. |
|
|
11
11
|
| cluster | `bool` | `none` | `false` | Enables clustering on the source for point shapes. |
|
package/docs/Style.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file was autogenerated from Style.js do not modify -->
|
|
2
|
-
## <
|
|
3
|
-
### Style is a component that automatically adds sources / layers to the map using
|
|
2
|
+
## <MapLibreGL.Style />
|
|
3
|
+
### Style is a component that automatically adds sources / layers to the map using MapLibre Style Spec.<br/>Only [`sources`](https://maplibre.org/maplibre-gl-js-docs/style-spec/sources/) & [`layers`](https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/) are supported.<br/>Other fields such as `sprites`, `glyphs` etc. will be ignored. Not all layer / source attributes from the style spec are supported, in general the supported attributes will be mentioned under https://github.com/maplibre/maplibre-react-native/tree/main/docs.<br/><br/>TODO: Maintainer forking this project does not understand the above comment regarding what is supported.
|
|
4
4
|
|
|
5
5
|
### props
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
|
-
| json | `any` | `none` | `false` | A JSON object conforming to the schema described in the
|
|
8
|
+
| json | `any` | `none` | `false` | A JSON object conforming to the schema described in the MapLibre Style Specification, or a URL to such JSON. |
|
|
9
9
|
|
|
10
10
|
|
package/docs/StyleSheet.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
### Stylesheet is now a JS object, see [CHANGELOG.md](../CHANGELOG.md) for more details
|
|
5
5
|
|
|
6
|
-
See (
|
|
6
|
+
See (MapLibre expression specs)[https://maplibre.org/maplibre-gl-js-docs/style-spec/expressions/] for reference on expressions.
|
|
7
7
|
|
|
8
8
|
### Style functions
|
|
9
9
|
|
|
@@ -35,20 +35,21 @@ new:
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
old:
|
|
38
|
+
|
|
38
39
|
```js
|
|
39
40
|
// color would change based on zoom level keys.
|
|
40
|
-
|
|
41
|
+
MapLibreGL.StyleSheet.camera({
|
|
41
42
|
0: 'blue',
|
|
42
43
|
10: 'green',
|
|
43
44
|
20: 'yellow',
|
|
44
|
-
},
|
|
45
|
+
}, MapLibreGL.InterpolationMode.Exponential);
|
|
45
46
|
|
|
46
47
|
// Example of use inside stylesheet
|
|
47
|
-
|
|
48
|
-
fillColor:
|
|
48
|
+
MapLibreGL.StyleSheet.create({
|
|
49
|
+
fillColor: MapLibreGL.StyleSheet.camera({
|
|
49
50
|
15: 'blue',
|
|
50
51
|
20: 'green',
|
|
51
|
-
},
|
|
52
|
+
}, MapLibreGL.InterpolationMode.Interval),
|
|
52
53
|
});
|
|
53
54
|
```
|
|
54
55
|
|
|
@@ -85,25 +86,26 @@ new:
|
|
|
85
86
|
|
|
86
87
|
|
|
87
88
|
old:
|
|
89
|
+
|
|
88
90
|
```js
|
|
89
91
|
// would color the layer based the property rating=[1, 5]
|
|
90
|
-
|
|
92
|
+
MapLibreGL.StyleSheet.source([
|
|
91
93
|
[1, 'red'],
|
|
92
94
|
[2, 'orange'],
|
|
93
95
|
[3, 'yellow'],
|
|
94
96
|
[4, 'yellowgreen'],
|
|
95
97
|
[5, 'green'],
|
|
96
|
-
], 'rating',
|
|
98
|
+
], 'rating', MapLibreGL.InterpolationMode.Categorical);
|
|
97
99
|
|
|
98
100
|
// Example of use inside stylesheet
|
|
99
|
-
|
|
100
|
-
circleColor:
|
|
101
|
+
MapLibreGL.StyleSheet.create({
|
|
102
|
+
circleColor: MapLibreGL.StyleSheet.source([
|
|
101
103
|
[1, 'red'],
|
|
102
104
|
[2, 'orange'],
|
|
103
105
|
[3, 'yellow'],
|
|
104
106
|
[4, 'yellowgreen'],
|
|
105
107
|
[5, 'green'],
|
|
106
|
-
], 'rating',
|
|
108
|
+
], 'rating', MapLibreGL.InterpolationMode.Categorical),
|
|
107
109
|
});
|
|
108
110
|
```
|
|
109
111
|
|
|
@@ -152,23 +154,24 @@ new:
|
|
|
152
154
|
|
|
153
155
|
|
|
154
156
|
old:
|
|
157
|
+
|
|
155
158
|
```js
|
|
156
159
|
// would change based on the zoom level and rating value
|
|
157
160
|
// {zoom_level}: [{value}, {style_value}]
|
|
158
|
-
|
|
161
|
+
MapLibreGL.StyleSheet.composite({
|
|
159
162
|
0: [0, 0],
|
|
160
163
|
0: [5, 5],
|
|
161
164
|
20: [0, 0],
|
|
162
165
|
20: [5, 20],
|
|
163
|
-
}, 'rating',
|
|
166
|
+
}, 'rating', MapLibreGL.InterpolationMode.Interval);
|
|
164
167
|
|
|
165
|
-
|
|
166
|
-
circleRadius:
|
|
168
|
+
MapLibreGL.StyleSheet.create({
|
|
169
|
+
circleRadius: MapLibreGL.StyleSheet.composite({
|
|
167
170
|
0: [0, 0],
|
|
168
171
|
0: [5, 5],
|
|
169
172
|
20: [0, 0],
|
|
170
173
|
20: [5, 20],
|
|
171
|
-
}, 'rating',
|
|
174
|
+
}, 'rating', MapLibreGL.InterpolationMode.Interval),
|
|
172
175
|
});
|
|
173
176
|
```
|
|
174
177
|
|
|
@@ -188,8 +191,8 @@ new:
|
|
|
188
191
|
old:
|
|
189
192
|
|
|
190
193
|
```js
|
|
191
|
-
|
|
192
|
-
fillExtrusionHeight:
|
|
194
|
+
MapLibreGL.StyleSheet.create({
|
|
195
|
+
fillExtrusionHeight: MapLibreGL.StyleSheet.identity('height'),
|
|
193
196
|
});
|
|
194
197
|
```
|
|
195
198
|
|
|
@@ -210,8 +213,8 @@ const styles = {
|
|
|
210
213
|
|
|
211
214
|
...
|
|
212
215
|
|
|
213
|
-
<
|
|
214
|
-
<
|
|
216
|
+
<MapLibreGL.FillLayer ... style={styles.buildings} />
|
|
217
|
+
<MapLibreGL.FillLayer ... style={styles.street} />
|
|
215
218
|
```
|
|
216
219
|
|
|
217
220
|
```js
|
|
@@ -259,68 +262,82 @@ const layerStyles = {
|
|
|
259
262
|
|
|
260
263
|
...
|
|
261
264
|
|
|
262
|
-
<
|
|
265
|
+
<MapLibreGL.SymbolLayer
|
|
263
266
|
id='pointCount'
|
|
264
267
|
style={layerStyles.clusterCount} />
|
|
265
268
|
|
|
266
|
-
<
|
|
269
|
+
<MapLibreGL.CircleLayer
|
|
267
270
|
id='clusteredPoints'
|
|
268
271
|
belowLayerID='pointCount'
|
|
269
272
|
filter={['has', 'point_count']}
|
|
270
273
|
style={layerStyles.clusteredPoints} />
|
|
271
274
|
|
|
272
|
-
<
|
|
275
|
+
<MapLibreGL.CircleLayer
|
|
273
276
|
id='singlePoint'
|
|
274
277
|
filter={['!has', 'point_count']}
|
|
275
278
|
style={layerStyles.singlePoint} />
|
|
276
279
|
```
|
|
277
280
|
|
|
278
281
|
```javascript
|
|
279
|
-
const layerStyles =
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
282
|
+
const layerStyles = MapLibreGL.StyleSheet.create({
|
|
283
|
+
building: {
|
|
284
|
+
fillExtrusionOpacity: 1,
|
|
285
|
+
fillExtrusionHeight: ['get', 'height'],
|
|
286
|
+
fillExtrusionBase: ['get', 'min_height'],
|
|
287
|
+
fillExtrusionColor: [
|
|
288
|
+
'interpolate',
|
|
289
|
+
['exponential', 1.5],
|
|
290
|
+
['get', 'height'],
|
|
291
|
+
[0, 'white'],
|
|
292
|
+
[50, 'blue'],
|
|
293
|
+
[100, 'red'],
|
|
294
|
+
],
|
|
292
295
|
},
|
|
293
296
|
fillExtrusionColorTransition: { duration: 2000, delay: 0 },
|
|
294
297
|
},
|
|
295
|
-
streets
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
298
|
+
streets
|
|
299
|
+
:
|
|
300
|
+
{
|
|
301
|
+
lineColor: 'blue',
|
|
302
|
+
lineWidth
|
|
303
|
+
:
|
|
304
|
+
2,
|
|
305
|
+
lineOpacity
|
|
306
|
+
:
|
|
307
|
+
0.50,
|
|
308
|
+
lineJoin
|
|
309
|
+
:
|
|
310
|
+
MapLibreGL.LineJoin.Round,
|
|
311
|
+
lineCap
|
|
312
|
+
:
|
|
313
|
+
MapLibreGL.LineCap.Round,
|
|
314
|
+
lineDasharray
|
|
315
|
+
:
|
|
316
|
+
[2, 2],
|
|
317
|
+
}
|
|
318
|
+
,
|
|
319
|
+
})
|
|
320
|
+
;
|
|
304
321
|
|
|
305
322
|
...
|
|
306
323
|
|
|
307
|
-
<
|
|
324
|
+
<MapLibreGL.FillExtrusionLayer
|
|
308
325
|
id='building3d'
|
|
309
326
|
sourceLayerID='building'
|
|
310
|
-
style={layerStyles.building}
|
|
327
|
+
style={layerStyles.building}/>
|
|
311
328
|
|
|
312
|
-
<
|
|
329
|
+
<MapLibreGL.LineLayer
|
|
313
330
|
id='streetLineColor'
|
|
314
331
|
sourceLayerID='road'
|
|
315
332
|
minZoomLevel={14}
|
|
316
333
|
belowLayerID='building3d'
|
|
317
|
-
style={layerStyles.streets}
|
|
334
|
+
style={layerStyles.streets}/>
|
|
318
335
|
```
|
|
319
336
|
|
|
320
337
|
#### old:
|
|
321
338
|
|
|
322
339
|
```js
|
|
323
|
-
const styles =
|
|
340
|
+
const styles = MapLibreGL.StyleSheet.create({
|
|
324
341
|
buildings: {
|
|
325
342
|
fillColor: 'blue',
|
|
326
343
|
},
|
|
@@ -331,12 +348,16 @@ const styles = MapboxGL.StyleSheet.create({
|
|
|
331
348
|
|
|
332
349
|
...
|
|
333
350
|
|
|
334
|
-
<
|
|
335
|
-
|
|
351
|
+
<MapLibreGL.FillLayer ...
|
|
352
|
+
style = { styles.buildings }
|
|
353
|
+
/>
|
|
354
|
+
<MapLibreGL.FillLayer ...
|
|
355
|
+
style = { styles.street }
|
|
356
|
+
/>
|
|
336
357
|
```
|
|
337
358
|
|
|
338
359
|
```js
|
|
339
|
-
const layerStyles =
|
|
360
|
+
const layerStyles = MapLibreGL.StyleSheet.create({
|
|
340
361
|
singlePoint: {
|
|
341
362
|
circleColor: 'green',
|
|
342
363
|
circleOpacity: 0.84,
|
|
@@ -346,20 +367,20 @@ const layerStyles = MapboxGL.StyleSheet.create({
|
|
|
346
367
|
},
|
|
347
368
|
|
|
348
369
|
clusteredPoints: {
|
|
349
|
-
circleColor:
|
|
370
|
+
circleColor: MapLibreGL.StyleSheet.source([
|
|
350
371
|
[25, 'yellow'],
|
|
351
372
|
[50, 'red'],
|
|
352
373
|
[75, 'blue'],
|
|
353
374
|
[100, 'orange'],
|
|
354
375
|
[300, 'pink'],
|
|
355
376
|
[750, 'white'],
|
|
356
|
-
], 'point_count',
|
|
377
|
+
], 'point_count', MapLibreGL.InterpolationMode.Exponential),
|
|
357
378
|
|
|
358
|
-
circleRadius:
|
|
379
|
+
circleRadius: MapLibreGL.StyleSheet.source([
|
|
359
380
|
[0, 15],
|
|
360
381
|
[100, 20],
|
|
361
382
|
[750, 30],
|
|
362
|
-
], 'point_count',
|
|
383
|
+
], 'point_count', MapLibreGL.InterpolationMode.Exponential),
|
|
363
384
|
|
|
364
385
|
circleOpacity: 0.84,
|
|
365
386
|
circleStrokeWidth: 2,
|
|
@@ -374,53 +395,53 @@ const layerStyles = MapboxGL.StyleSheet.create({
|
|
|
374
395
|
|
|
375
396
|
...
|
|
376
397
|
|
|
377
|
-
<
|
|
398
|
+
<MapLibreGL.SymbolLayer
|
|
378
399
|
id='pointCount'
|
|
379
|
-
style={layerStyles.clusterCount}
|
|
400
|
+
style={layerStyles.clusterCount}/>
|
|
380
401
|
|
|
381
|
-
<
|
|
402
|
+
<MapLibreGL.CircleLayer
|
|
382
403
|
id='clusteredPoints'
|
|
383
404
|
belowLayerID='pointCount'
|
|
384
405
|
filter={['has', 'point_count']}
|
|
385
|
-
style={layerStyles.clusteredPoints}
|
|
406
|
+
style={layerStyles.clusteredPoints}/>
|
|
386
407
|
|
|
387
|
-
<
|
|
408
|
+
<MapLibreGL.CircleLayer
|
|
388
409
|
id='singlePoint'
|
|
389
410
|
filter={['!has', 'point_count']}
|
|
390
|
-
style={layerStyles.singlePoint}
|
|
411
|
+
style={layerStyles.singlePoint}/>
|
|
391
412
|
```
|
|
392
413
|
|
|
393
414
|
```javascript
|
|
394
|
-
const layerStyles =
|
|
415
|
+
const layerStyles = MapLibreGL.StyleSheet.create({
|
|
395
416
|
building: {
|
|
396
417
|
fillExtrusionOpacity: 1,
|
|
397
|
-
fillExtrusionHeight:
|
|
398
|
-
fillExtrusionBase:
|
|
399
|
-
fillExtrusionColor:
|
|
418
|
+
fillExtrusionHeight: MapLibreGL.StyleSheet.identity('height'),
|
|
419
|
+
fillExtrusionBase: MapLibreGL.StyleSheet.identity('min_height'),
|
|
420
|
+
fillExtrusionColor: MapLibreGL.StyleSheet.source([
|
|
400
421
|
[0, 'white'],
|
|
401
422
|
[50, 'blue'],
|
|
402
423
|
[100, 'red'],
|
|
403
|
-
], 'height',
|
|
424
|
+
], 'height', MapLibreGL.InterpolationMode.Exponential),
|
|
404
425
|
fillExtrusionColorTransition: { duration: 2000, delay: 0 },
|
|
405
426
|
},
|
|
406
427
|
streets: {
|
|
407
428
|
lineColor: 'blue',
|
|
408
429
|
lineWidth: 2,
|
|
409
430
|
lineOpacity: 0.50,
|
|
410
|
-
lineJoin:
|
|
411
|
-
lineCap:
|
|
431
|
+
lineJoin: MapLibreGL.LineJoin.Round,
|
|
432
|
+
lineCap: MapLibreGL.LineCap.Round,
|
|
412
433
|
lineDasharray: [2, 2],
|
|
413
434
|
},
|
|
414
435
|
});
|
|
415
436
|
|
|
416
437
|
...
|
|
417
438
|
|
|
418
|
-
<
|
|
439
|
+
<MapLibreGL.FillExtrusionLayer
|
|
419
440
|
id='building3d'
|
|
420
441
|
sourceLayerID='building'
|
|
421
442
|
style={layerStyles.building} />
|
|
422
443
|
|
|
423
|
-
<
|
|
444
|
+
<MapLibreGL.LineLayer
|
|
424
445
|
id='streetLineColor'
|
|
425
446
|
sourceLayerID='road'
|
|
426
447
|
minZoomLevel={14}
|