@performant-software/geospatial 3.1.18-beta.3 → 3.1.18-beta.4

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.
Files changed (99) hide show
  1. package/dist/index.cjs13.js +1 -1
  2. package/dist/index.cjs13.js.map +1 -1
  3. package/dist/index.cjs15.js +1 -1
  4. package/dist/index.cjs2.js +1 -1
  5. package/dist/index.cjs2.js.map +1 -1
  6. package/dist/index.cjs200.js +1 -1
  7. package/dist/index.cjs215.js +1 -1
  8. package/dist/index.cjs235.js +1 -1
  9. package/dist/index.cjs244.js +1 -1
  10. package/dist/index.cjs244.js.map +1 -1
  11. package/dist/index.cjs246.js +1 -1
  12. package/dist/index.cjs246.js.map +1 -1
  13. package/dist/index.cjs254.js +1 -1
  14. package/dist/index.cjs258.js +1 -1
  15. package/dist/index.cjs259.js +1 -1
  16. package/dist/index.cjs262.js +1 -1
  17. package/dist/index.cjs266.js +1 -1
  18. package/dist/index.cjs266.js.map +1 -1
  19. package/dist/index.cjs267.js +1 -1
  20. package/dist/index.cjs267.js.map +1 -1
  21. package/dist/index.cjs268.js +1 -1
  22. package/dist/index.cjs268.js.map +1 -1
  23. package/dist/index.cjs29.js +1 -1
  24. package/dist/index.cjs32.js +1 -1
  25. package/dist/index.cjs34.js +1 -1
  26. package/dist/index.cjs35.js +1 -1
  27. package/dist/index.cjs39.js +1 -1
  28. package/dist/index.cjs73.js +743 -1
  29. package/dist/index.cjs73.js.map +1 -1
  30. package/dist/index.cjs75.js +1 -9
  31. package/dist/index.cjs75.js.map +1 -1
  32. package/dist/index.cjs76.js +1 -17
  33. package/dist/index.cjs76.js.map +1 -1
  34. package/dist/index.cjs77.js +9 -1
  35. package/dist/index.cjs77.js.map +1 -1
  36. package/dist/index.cjs78.js +17 -1
  37. package/dist/index.cjs78.js.map +1 -1
  38. package/dist/index.cjs79.js +1 -1
  39. package/dist/index.cjs79.js.map +1 -1
  40. package/dist/index.cjs80.js +1 -1
  41. package/dist/index.cjs80.js.map +1 -1
  42. package/dist/index.cjs81.js +1 -1
  43. package/dist/index.cjs81.js.map +1 -1
  44. package/dist/index.cjs82.js +1 -743
  45. package/dist/index.cjs82.js.map +1 -1
  46. package/dist/index.cjs83.js +1 -1
  47. package/dist/index.cjs83.js.map +1 -1
  48. package/dist/index.es13.js +44 -54
  49. package/dist/index.es13.js.map +1 -1
  50. package/dist/index.es15.js +1 -1
  51. package/dist/index.es2.js +8 -8
  52. package/dist/index.es2.js.map +1 -1
  53. package/dist/index.es200.js +1 -1
  54. package/dist/index.es215.js +1 -1
  55. package/dist/index.es235.js +1 -1
  56. package/dist/index.es244.js +8 -3
  57. package/dist/index.es244.js.map +1 -1
  58. package/dist/index.es246.js +3 -8
  59. package/dist/index.es246.js.map +1 -1
  60. package/dist/index.es254.js +1 -1
  61. package/dist/index.es258.js +1 -1
  62. package/dist/index.es259.js +2 -2
  63. package/dist/index.es262.js +1 -1
  64. package/dist/index.es266.js +69 -15
  65. package/dist/index.es266.js.map +1 -1
  66. package/dist/index.es267.js +4 -69
  67. package/dist/index.es267.js.map +1 -1
  68. package/dist/index.es268.js +15 -4
  69. package/dist/index.es268.js.map +1 -1
  70. package/dist/index.es29.js +2 -2
  71. package/dist/index.es32.js +2 -2
  72. package/dist/index.es34.js +2 -2
  73. package/dist/index.es35.js +2 -2
  74. package/dist/index.es39.js +1 -1
  75. package/dist/index.es73.js +21351 -7
  76. package/dist/index.es73.js.map +1 -1
  77. package/dist/index.es75.js +7 -25
  78. package/dist/index.es75.js.map +1 -1
  79. package/dist/index.es76.js +2 -589
  80. package/dist/index.es76.js.map +1 -1
  81. package/dist/index.es77.js +25 -1992
  82. package/dist/index.es77.js.map +1 -1
  83. package/dist/index.es78.js +588 -5
  84. package/dist/index.es78.js.map +1 -1
  85. package/dist/index.es79.js +1993 -2
  86. package/dist/index.es79.js.map +1 -1
  87. package/dist/index.es80.js +5 -105
  88. package/dist/index.es80.js.map +1 -1
  89. package/dist/index.es81.js +2 -10
  90. package/dist/index.es81.js.map +1 -1
  91. package/dist/index.es82.js +104 -21350
  92. package/dist/index.es82.js.map +1 -1
  93. package/dist/index.es83.js +10 -2
  94. package/dist/index.es83.js.map +1 -1
  95. package/package.json +1 -1
  96. package/src/components/CertaintyLayer.js +9 -3
  97. package/src/utils/Map.js +13 -35
  98. package/types/components/CertaintyLayer.js.flow +9 -3
  99. package/types/utils/Map.js.flow +13 -35
@@ -1,5 +1,13 @@
1
- var e = { exports: {} };
1
+ import e from "react";
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);
2
9
  export {
3
- e as __module
10
+ t as DefaultContext,
11
+ d as IconContext
4
12
  };
5
13
  //# sourceMappingURL=index.es83.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es83.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.es83.js","sources":["../../../node_modules/react-icons/lib/iconContext.mjs"],"sourcesContent":["import React from \"react\";\nexport var DefaultContext = {\n color: undefined,\n size: undefined,\n className: undefined,\n style: undefined,\n attr: undefined\n};\nexport var IconContext = React.createContext && /*#__PURE__*/React.createContext(DefaultContext);"],"names":["DefaultContext","IconContext","React"],"mappings":";AACU,IAACA,IAAiB;AAAA,EAC1B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AACR,GACWC,IAAcC,EAAM,iBAA8BA,gBAAAA,EAAM,cAAcF,CAAc;","x_google_ignoreList":[0]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@performant-software/geospatial",
3
- "version": "3.1.18-beta.3",
3
+ "version": "3.1.18-beta.4",
4
4
  "description": "A package of components for all things map-related.",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs.js",
@@ -1,6 +1,6 @@
1
1
  // @flow
2
2
 
3
- import React from 'react';
3
+ import React, { useMemo } from 'react';
4
4
  import { Layer, Source } from 'react-map-gl/maplibre';
5
5
  import MapStyles from '../utils/MapStyles';
6
6
  import MapUtils from '../utils/Map';
@@ -14,11 +14,17 @@ type Props = {
14
14
  * Renders circles with the given certainty_radius circumference around all points in a new layer.
15
15
  */
16
16
  const CertaintyLayer = (props: Props) => {
17
- const circles = MapUtils.getCertaintyCircles([props.geometry], () => props.certaintyRadius);
17
+ const data = useMemo(() => {
18
+ if (props.geometry) {
19
+ return MapUtils.getCertaintyCircle(props.geometry, props.certaintyRadius);
20
+ } else {
21
+ return {};
22
+ }
23
+ }, [props.geometry, props.certaintyRadius]);
18
24
 
19
25
  return (
20
26
  <Source
21
- data={circles}
27
+ data={data}
22
28
  type='geojson'
23
29
  >
24
30
  <Layer
package/src/utils/Map.js CHANGED
@@ -26,45 +26,24 @@ const buildCircle = (point, radius) => (
26
26
  circle(point.coordinates, radius, { units: 'kilometers', steps: 32 })
27
27
  );
28
28
 
29
- const getCertaintyCircle = (item, getCertaintyRadius: (item: any) => number | undefined) => {
30
- const certaintyRadius = getCertaintyRadius(item);
31
-
32
- if (certaintyRadius) {
33
- if (item.geometry?.type === 'FeatureCollection') {
34
- for (const childFeature of item.geometry.features) {
35
- if (childFeature.geometry?.type === 'Point') {
36
- return buildCircle(childFeature.geometry, certaintyRadius);
37
- }
29
+ const getCertaintyCircle = (item, radius: number) => {
30
+ if (item.geometry?.type === 'FeatureCollection') {
31
+ for (const childFeature of item.geometry.features) {
32
+ if (childFeature.geometry?.type === 'Point') {
33
+ return buildCircle(childFeature.geometry, radius);
38
34
  }
39
- } else if (item.geometry?.type === 'GeometryCollection') {
40
- for (const geometry of item.geometry.geometries) {
41
- if (geometry.type === 'Point') {
42
- return buildCircle(geometry, certaintyRadius);
43
- }
44
- }
45
- } else if (item.geometry?.type === 'Point') {
46
- return buildCircle(item.geometry, certaintyRadius);
47
35
  }
48
- }
49
- };
50
-
51
- /**
52
- * Returns a GeoJSON feature collection containing circles for each item in the given array.
53
- */
54
- const getCertaintyCircleFeatureCollection = (
55
- items,
56
- getCertaintyRadius: (item: any) => number | undefined
57
- ) => {
58
- const features = [];
59
-
60
- for (const item of items) {
61
- const circle = getCertaintyCircle(item, getCertaintyRadius);
62
- if (circle) {
63
- features.push(circle);
36
+ } else if (item.geometry?.type === 'GeometryCollection') {
37
+ for (const geometry of item.geometry.geometries) {
38
+ if (geometry.type === 'Point') {
39
+ return buildCircle(geometry, radius);
40
+ }
64
41
  }
42
+ } else if (item.geometry?.type === 'Point') {
43
+ return buildCircle(item.geometry, radius);
65
44
  }
66
45
 
67
- return featureCollection(features);
46
+ return item.geometry;
68
47
  };
69
48
 
70
49
  /**
@@ -214,7 +193,6 @@ const validateCoordinates = (coordinates) => {
214
193
  export default {
215
194
  addGeoreferenceLayer,
216
195
  getCertaintyCircle,
217
- getCertaintyCircleFeatureCollection,
218
196
  getBoundingBox,
219
197
  removeLayer,
220
198
  toFeature,
@@ -1,6 +1,6 @@
1
1
  // @flow
2
2
 
3
- import React from 'react';
3
+ import React, { useMemo } from 'react';
4
4
  import { Layer, Source } from 'react-map-gl/maplibre';
5
5
  import MapStyles from '../utils/MapStyles';
6
6
  import MapUtils from '../utils/Map';
@@ -14,11 +14,17 @@ type Props = {
14
14
  * Renders circles with the given certainty_radius circumference around all points in a new layer.
15
15
  */
16
16
  const CertaintyLayer = (props: Props) => {
17
- const circles = MapUtils.getCertaintyCircles([props.geometry], () => props.certaintyRadius);
17
+ const data = useMemo(() => {
18
+ if (props.geometry) {
19
+ return MapUtils.getCertaintyCircle(props.geometry, props.certaintyRadius);
20
+ } else {
21
+ return {};
22
+ }
23
+ }, [props.geometry, props.certaintyRadius]);
18
24
 
19
25
  return (
20
26
  <Source
21
- data={circles}
27
+ data={data}
22
28
  type='geojson'
23
29
  >
24
30
  <Layer
@@ -26,45 +26,24 @@ const buildCircle = (point, radius) => (
26
26
  circle(point.coordinates, radius, { units: 'kilometers', steps: 32 })
27
27
  );
28
28
 
29
- const getCertaintyCircle = (item, getCertaintyRadius: (item: any) => number | undefined) => {
30
- const certaintyRadius = getCertaintyRadius(item);
31
-
32
- if (certaintyRadius) {
33
- if (item.geometry?.type === 'FeatureCollection') {
34
- for (const childFeature of item.geometry.features) {
35
- if (childFeature.geometry?.type === 'Point') {
36
- return buildCircle(childFeature.geometry, certaintyRadius);
37
- }
29
+ const getCertaintyCircle = (item, radius: number) => {
30
+ if (item.geometry?.type === 'FeatureCollection') {
31
+ for (const childFeature of item.geometry.features) {
32
+ if (childFeature.geometry?.type === 'Point') {
33
+ return buildCircle(childFeature.geometry, radius);
38
34
  }
39
- } else if (item.geometry?.type === 'GeometryCollection') {
40
- for (const geometry of item.geometry.geometries) {
41
- if (geometry.type === 'Point') {
42
- return buildCircle(geometry, certaintyRadius);
43
- }
44
- }
45
- } else if (item.geometry?.type === 'Point') {
46
- return buildCircle(item.geometry, certaintyRadius);
47
35
  }
48
- }
49
- };
50
-
51
- /**
52
- * Returns a GeoJSON feature collection containing circles for each item in the given array.
53
- */
54
- const getCertaintyCircleFeatureCollection = (
55
- items,
56
- getCertaintyRadius: (item: any) => number | undefined
57
- ) => {
58
- const features = [];
59
-
60
- for (const item of items) {
61
- const circle = getCertaintyCircle(item, getCertaintyRadius);
62
- if (circle) {
63
- features.push(circle);
36
+ } else if (item.geometry?.type === 'GeometryCollection') {
37
+ for (const geometry of item.geometry.geometries) {
38
+ if (geometry.type === 'Point') {
39
+ return buildCircle(geometry, radius);
40
+ }
64
41
  }
42
+ } else if (item.geometry?.type === 'Point') {
43
+ return buildCircle(item.geometry, radius);
65
44
  }
66
45
 
67
- return featureCollection(features);
46
+ return item.geometry;
68
47
  };
69
48
 
70
49
  /**
@@ -214,7 +193,6 @@ const validateCoordinates = (coordinates) => {
214
193
  export default {
215
194
  addGeoreferenceLayer,
216
195
  getCertaintyCircle,
217
- getCertaintyCircleFeatureCollection,
218
196
  getBoundingBox,
219
197
  removeLayer,
220
198
  toFeature,