@performant-software/geospatial 3.1.15-beta.0 → 3.1.16-beta.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/dist/index.cjs201.js +1 -1
- package/dist/index.cjs211.js +1 -1
- package/dist/index.cjs212.js +1 -1
- package/dist/index.cjs213.js +1 -1
- package/dist/index.cjs231.js +1 -1
- package/dist/index.cjs238.js +1 -1
- package/dist/index.cjs238.js.map +1 -1
- package/dist/index.cjs239.js +1 -1
- package/dist/index.cjs239.js.map +1 -1
- package/dist/index.cjs240.js +1 -1
- package/dist/index.cjs240.js.map +1 -1
- package/dist/index.cjs241.js +1 -1
- package/dist/index.cjs241.js.map +1 -1
- package/dist/index.cjs242.js +1 -1
- package/dist/index.cjs242.js.map +1 -1
- package/dist/index.cjs31.js +1 -1
- package/dist/index.cjs33.js +1 -1
- package/dist/index.cjs34.js +1 -1
- package/dist/index.cjs38.js +1 -1
- package/dist/index.cjs75.js +1 -743
- package/dist/index.cjs75.js.map +1 -1
- package/dist/index.cjs76.js +1 -1
- package/dist/index.cjs76.js.map +1 -1
- package/dist/index.cjs80.js +743 -1
- package/dist/index.cjs80.js.map +1 -1
- package/dist/index.cjs81.js +1 -1
- package/dist/index.cjs81.js.map +1 -1
- package/dist/index.es201.js +2 -2
- package/dist/index.es211.js +1 -1
- package/dist/index.es212.js +1 -1
- package/dist/index.es213.js +1 -1
- package/dist/index.es231.js +1 -1
- package/dist/index.es238.js +3 -21
- package/dist/index.es238.js.map +1 -1
- package/dist/index.es239.js +5 -22
- package/dist/index.es239.js.map +1 -1
- package/dist/index.es240.js +8 -3
- package/dist/index.es240.js.map +1 -1
- package/dist/index.es241.js +19 -6
- package/dist/index.es241.js.map +1 -1
- package/dist/index.es242.js +22 -5
- package/dist/index.es242.js.map +1 -1
- package/dist/index.es31.js +1 -1
- package/dist/index.es33.js +2 -2
- package/dist/index.es34.js +2 -2
- package/dist/index.es38.js +1 -1
- package/dist/index.es75.js +104 -21350
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +10 -2
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es80.js +21350 -104
- package/dist/index.es80.js.map +1 -1
- package/dist/index.es81.js +2 -10
- package/dist/index.es81.js.map +1 -1
- package/package.json +1 -1
- package/types/components/GeoJSONLayerTest.js.flow +0 -190
- package/types/components/LocationMarker.js.flow +0 -82
package/dist/index.es81.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var t = {
|
|
3
|
-
color: void 0,
|
|
4
|
-
size: void 0,
|
|
5
|
-
className: void 0,
|
|
6
|
-
style: void 0,
|
|
7
|
-
attr: void 0
|
|
8
|
-
}, d = e.createContext && /* @__PURE__ */ e.createContext(t);
|
|
1
|
+
var e = { exports: {} };
|
|
9
2
|
export {
|
|
10
|
-
|
|
11
|
-
d as IconContext
|
|
3
|
+
e as __module
|
|
12
4
|
};
|
|
13
5
|
//# sourceMappingURL=index.es81.js.map
|
package/dist/index.es81.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es81.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.es81.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/package.json
CHANGED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import React, { type ReactNode, useEffect, useState } from 'react';
|
|
4
|
-
import { Map } from 'maplibre-gl';
|
|
5
|
-
import {
|
|
6
|
-
HoverTooltip,
|
|
7
|
-
removeLayerIfExists,
|
|
8
|
-
removeSourceIfExists,
|
|
9
|
-
useLoadedMap
|
|
10
|
-
} from '@peripleo/maplibre';
|
|
11
|
-
import MapStyles from '../utils/MapStyles';
|
|
12
|
-
|
|
13
|
-
type Props = {
|
|
14
|
-
|
|
15
|
-
cluster?: boolean,
|
|
16
|
-
|
|
17
|
-
clusterMaxZoom?: number,
|
|
18
|
-
|
|
19
|
-
clusterMinPoints?: number,
|
|
20
|
-
|
|
21
|
-
clusterProperties?: any,
|
|
22
|
-
|
|
23
|
-
clusterRadius?: number,
|
|
24
|
-
|
|
25
|
-
data: any,
|
|
26
|
-
|
|
27
|
-
fillStyle?: Object,
|
|
28
|
-
|
|
29
|
-
id: string,
|
|
30
|
-
|
|
31
|
-
interactive?: boolean,
|
|
32
|
-
|
|
33
|
-
pointStyle?: Object,
|
|
34
|
-
|
|
35
|
-
tooltip?: (hoverState: any) => ReactNode,
|
|
36
|
-
|
|
37
|
-
strokeStyle?: Object,
|
|
38
|
-
|
|
39
|
-
visible?: boolean,
|
|
40
|
-
|
|
41
|
-
onLoad?: () => void
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const setStyle = (map: typeof Map, layerId: string, style: any) => {
|
|
46
|
-
if (!map) return;
|
|
47
|
-
|
|
48
|
-
Object
|
|
49
|
-
.entries(style.paint)
|
|
50
|
-
.forEach(([key, value]) =>
|
|
51
|
-
map.setPaintProperty(layerId, key, value));
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const GeoJSONLayerTest = (props: Props) => {
|
|
55
|
-
|
|
56
|
-
const { id, data } = props;
|
|
57
|
-
|
|
58
|
-
const visible = props.visible === undefined ? true : props.visible;
|
|
59
|
-
|
|
60
|
-
const fillStyle = props.fillStyle || MapStyles.fill;
|
|
61
|
-
|
|
62
|
-
const strokeStyle = props.strokeStyle || MapStyles.stroke;
|
|
63
|
-
|
|
64
|
-
const pointStyle = props.pointStyle || MapStyles.point;
|
|
65
|
-
|
|
66
|
-
const map = useLoadedMap();
|
|
67
|
-
|
|
68
|
-
const [sourceId, setSourceId] = useState();
|
|
69
|
-
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if (map) {
|
|
72
|
-
const layerIds = new Set(map.getStyle().layers.map(l => l.id));
|
|
73
|
-
|
|
74
|
-
if (layerIds.has(`layer-${props.id}-fill`)) {
|
|
75
|
-
map.setLayoutProperty(`layer-${props.id}-fill`, 'visibility', visible ? 'visible' : 'none');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (layerIds.has(`layer-${props.id}-line`)) {
|
|
79
|
-
map.setLayoutProperty(`layer-${props.id}-line`, 'visibility', visible ? 'visible' : 'none');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (layerIds.has(`layer-${props.id}-point`)) {
|
|
83
|
-
map.setLayoutProperty(`layer-${props.id}-point`, 'visibility', visible ? 'visible' : 'none');
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, [visible, map]);
|
|
87
|
-
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
if (!map) return;
|
|
90
|
-
|
|
91
|
-
const sourceId = `source-${id}`;
|
|
92
|
-
|
|
93
|
-
map.addSource(sourceId, {
|
|
94
|
-
type: 'geojson',
|
|
95
|
-
// @ts-ignore
|
|
96
|
-
data,
|
|
97
|
-
// Note that mapLibre checks by key, and will fail if cluster args
|
|
98
|
-
// are undefined. Therefore we need to add on demand.
|
|
99
|
-
...(props.cluster && { cluster: true }),
|
|
100
|
-
...(props.clusterRadius !== undefined && { clusterRadius: props.clusterRadius }),
|
|
101
|
-
...(props.clusterMaxZoom !== undefined && { clusterMaxZoom: props.clusterMaxZoom }),
|
|
102
|
-
...(props.clusterMinPoints !== undefined && { clusterMinPoints: props.clusterMinPoints }),
|
|
103
|
-
...(props.clusterProperties !== undefined && { clusterProperties: props.clusterProperties })
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// Map emits 'IDLE' event when the source is fully loaded
|
|
107
|
-
if (props.onLoad)
|
|
108
|
-
map.once('idle', () => props.onLoad());
|
|
109
|
-
|
|
110
|
-
if (!props.cluster) {
|
|
111
|
-
map.addLayer({
|
|
112
|
-
id: `layer-${id}-fill`,
|
|
113
|
-
...fillStyle,
|
|
114
|
-
source: `source-${id}`,
|
|
115
|
-
filter: ['!=', '$type', 'Point'],
|
|
116
|
-
layout: {
|
|
117
|
-
visibility: visible ? 'visible' : 'none'
|
|
118
|
-
},
|
|
119
|
-
metadata: {
|
|
120
|
-
interactive: props.interactive
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
map.addLayer({
|
|
125
|
-
id: `layer-${id}-line`,
|
|
126
|
-
...strokeStyle,
|
|
127
|
-
source: `source-${id}`,
|
|
128
|
-
filter: ['!=', '$type', 'Point'],
|
|
129
|
-
layout: {
|
|
130
|
-
visibility: visible ? 'visible' : 'none'
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
map.addLayer({
|
|
136
|
-
id: `layer-${id}-point`,
|
|
137
|
-
...pointStyle,
|
|
138
|
-
filter: ['==', '$type', 'Point'],
|
|
139
|
-
source: `source-${id}`,
|
|
140
|
-
layout: {
|
|
141
|
-
visibility: visible ? 'visible' : 'none'
|
|
142
|
-
},
|
|
143
|
-
metadata: {
|
|
144
|
-
interactive: props.interactive
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
setSourceId(sourceId);
|
|
149
|
-
|
|
150
|
-
setTimeout(() => map.moveLayer(`layer-${id}-point`), 10);
|
|
151
|
-
|
|
152
|
-
return () => {
|
|
153
|
-
removeLayerIfExists(map, `layer-${id}-point`);
|
|
154
|
-
removeLayerIfExists(map, `layer-${id}-line`);
|
|
155
|
-
removeLayerIfExists(map, `layer-${id}-fill`);
|
|
156
|
-
|
|
157
|
-
removeSourceIfExists(map, sourceId);
|
|
158
|
-
};
|
|
159
|
-
}, [map]);
|
|
160
|
-
|
|
161
|
-
useEffect(() => {
|
|
162
|
-
if (!sourceId) return;
|
|
163
|
-
|
|
164
|
-
// @ts-ignore
|
|
165
|
-
map.getSource(sourceId).setData(data);
|
|
166
|
-
}, [sourceId, data]);
|
|
167
|
-
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
if (!props.cluster)
|
|
170
|
-
setStyle(map, `layer-${id}-fill`, props.fillStyle|| MapStyles.fill);
|
|
171
|
-
}, [props.fillStyle, props.cluster]);
|
|
172
|
-
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
if (!props.cluster)
|
|
175
|
-
setStyle(map, `layer-${id}-line`, props.strokeStyle|| MapStyles.stroke);
|
|
176
|
-
}, [props.strokeStyle, props.cluster]);
|
|
177
|
-
|
|
178
|
-
useEffect(() => {
|
|
179
|
-
setStyle(map, `layer-${id}-point`, props.pointStyle|| MapStyles.point);
|
|
180
|
-
}, [props.pointStyle]);
|
|
181
|
-
|
|
182
|
-
return props.tooltip ? (
|
|
183
|
-
<HoverTooltip
|
|
184
|
-
layerId={[`layer-${id}-point`, `layer-${id}-fill`]}
|
|
185
|
-
tooltip={props.tooltip} />
|
|
186
|
-
) : null;
|
|
187
|
-
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export default GeoJSONLayerTest;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import { MixedGeoJSONLayer, PulsingMarkerLayer, useMap } from '@peripleo/maplibre';
|
|
4
|
-
import React, { useEffect } from 'react';
|
|
5
|
-
import { DEFAULT_FILL_STYLE, DEFAULT_POINT_STYLE, DEFAULT_STROKE_STYLE } from '../utils/MapStyles';
|
|
6
|
-
import MapUtils from '../utils/Map';
|
|
7
|
-
|
|
8
|
-
type Props = {
|
|
9
|
-
/**
|
|
10
|
-
* If `true`, the point marker will display with a pulsing animation.
|
|
11
|
-
*/
|
|
12
|
-
animate?: boolean,
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The number of miles to buffer the GeoJSON data.
|
|
16
|
-
*/
|
|
17
|
-
buffer: number,
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The GeoJSON data representing the location.
|
|
21
|
-
*/
|
|
22
|
-
data: { [key: string]: any },
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* GeoJSON layer fill style.
|
|
26
|
-
*/
|
|
27
|
-
fillStyle?: { [key: string]: any },
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* GeoJSON layer point style.
|
|
31
|
-
*/
|
|
32
|
-
pointStyle?: { [key: string]: any },
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* GeoJSON layer stroke style
|
|
36
|
-
*/
|
|
37
|
-
strokeStyle?: { [key: string]: any }
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const DEFAULT_BUFFER = 2;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* This component renders a location marker to be used in a Peripleo context.
|
|
44
|
-
*/
|
|
45
|
-
const LocationMarker = (props: Props) => {
|
|
46
|
-
const map = useMap();
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Sets the bounding box on the map.
|
|
50
|
-
*/
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (map && props.data) {
|
|
53
|
-
const boundingBox = MapUtils.getBoundingBox(props.data, props.buffer);
|
|
54
|
-
map.fitBounds(boundingBox);
|
|
55
|
-
}
|
|
56
|
-
}, [map, props.buffer, props.data]);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<>
|
|
60
|
-
{ props.animate && (
|
|
61
|
-
<PulsingMarkerLayer
|
|
62
|
-
data={props.data}
|
|
63
|
-
/>
|
|
64
|
-
)}
|
|
65
|
-
<MixedGeoJSONLayer
|
|
66
|
-
data={props.data}
|
|
67
|
-
fillStyle={props.fillStyle}
|
|
68
|
-
strokeStyle={props.strokeStyle}
|
|
69
|
-
pointStyle={props.pointStyle}
|
|
70
|
-
/>
|
|
71
|
-
</>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
LocationMarker.defaultProps = {
|
|
76
|
-
buffer: DEFAULT_BUFFER,
|
|
77
|
-
fillStyle: DEFAULT_FILL_STYLE,
|
|
78
|
-
pointStyle: DEFAULT_POINT_STYLE,
|
|
79
|
-
strokeStyle: DEFAULT_STROKE_STYLE
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default LocationMarker;
|