@performant-software/geospatial 3.1.18-beta.1 → 3.1.18-beta.10

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 (126) 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.cjs191.js +1 -1
  5. package/dist/index.cjs2.js +1 -1
  6. package/dist/index.cjs2.js.map +1 -1
  7. package/dist/index.cjs205.js +1 -1
  8. package/dist/index.cjs215.js +1 -1
  9. package/dist/index.cjs216.js +1 -1
  10. package/dist/index.cjs217.js +1 -1
  11. package/dist/index.cjs235.js +1 -1
  12. package/dist/index.cjs242.js +1 -1
  13. package/dist/index.cjs242.js.map +1 -1
  14. package/dist/index.cjs243.js +1 -1
  15. package/dist/index.cjs243.js.map +1 -1
  16. package/dist/index.cjs244.js +1 -1
  17. package/dist/index.cjs244.js.map +1 -1
  18. package/dist/index.cjs245.js +1 -1
  19. package/dist/index.cjs245.js.map +1 -1
  20. package/dist/index.cjs246.js +1 -1
  21. package/dist/index.cjs246.js.map +1 -1
  22. package/dist/index.cjs252.js +1 -1
  23. package/dist/index.cjs254.js +1 -1
  24. package/dist/index.cjs258.js +1 -1
  25. package/dist/index.cjs259.js +1 -1
  26. package/dist/index.cjs262.js +1 -1
  27. package/dist/index.cjs265.js +1 -1
  28. package/dist/index.cjs265.js.map +1 -1
  29. package/dist/index.cjs266.js +1 -1
  30. package/dist/index.cjs266.js.map +1 -1
  31. package/dist/index.cjs267.js +1 -1
  32. package/dist/index.cjs267.js.map +1 -1
  33. package/dist/index.cjs268.js +1 -1
  34. package/dist/index.cjs268.js.map +1 -1
  35. package/dist/index.cjs29.js +1 -1
  36. package/dist/index.cjs32.js +1 -1
  37. package/dist/index.cjs34.js +1 -1
  38. package/dist/index.cjs35.js +1 -1
  39. package/dist/index.cjs39.js +1 -1
  40. package/dist/index.cjs73.js +1 -1
  41. package/dist/index.cjs73.js.map +1 -1
  42. package/dist/index.cjs74.js +1 -1
  43. package/dist/index.cjs75.js +9 -1
  44. package/dist/index.cjs75.js.map +1 -1
  45. package/dist/index.cjs76.js +17 -1
  46. package/dist/index.cjs76.js.map +1 -1
  47. package/dist/index.cjs77.js +743 -1
  48. package/dist/index.cjs77.js.map +1 -1
  49. package/dist/index.cjs78.js +1 -9
  50. package/dist/index.cjs78.js.map +1 -1
  51. package/dist/index.cjs79.js +1 -17
  52. package/dist/index.cjs79.js.map +1 -1
  53. package/dist/index.cjs80.js +1 -1
  54. package/dist/index.cjs80.js.map +1 -1
  55. package/dist/index.cjs81.js +1 -1
  56. package/dist/index.cjs81.js.map +1 -1
  57. package/dist/index.cjs82.js +1 -743
  58. package/dist/index.cjs82.js.map +1 -1
  59. package/dist/index.cjs83.js +1 -1
  60. package/dist/index.cjs83.js.map +1 -1
  61. package/dist/index.es13.js +62 -49
  62. package/dist/index.es13.js.map +1 -1
  63. package/dist/index.es15.js +1 -1
  64. package/dist/index.es191.js +1 -1
  65. package/dist/index.es2.js +7 -7
  66. package/dist/index.es2.js.map +1 -1
  67. package/dist/index.es205.js +2 -2
  68. package/dist/index.es215.js +1 -1
  69. package/dist/index.es216.js +1 -1
  70. package/dist/index.es217.js +1 -1
  71. package/dist/index.es235.js +1 -1
  72. package/dist/index.es242.js +3 -21
  73. package/dist/index.es242.js.map +1 -1
  74. package/dist/index.es243.js +20 -22
  75. package/dist/index.es243.js.map +1 -1
  76. package/dist/index.es244.js +22 -7
  77. package/dist/index.es244.js.map +1 -1
  78. package/dist/index.es245.js +6 -3
  79. package/dist/index.es245.js.map +1 -1
  80. package/dist/index.es246.js +6 -4
  81. package/dist/index.es246.js.map +1 -1
  82. package/dist/index.es252.js +1 -1
  83. package/dist/index.es254.js +1 -1
  84. package/dist/index.es258.js +1 -1
  85. package/dist/index.es259.js +2 -2
  86. package/dist/index.es262.js +1 -1
  87. package/dist/index.es265.js +2 -69
  88. package/dist/index.es265.js.map +1 -1
  89. package/dist/index.es266.js +15 -4
  90. package/dist/index.es266.js.map +1 -1
  91. package/dist/index.es267.js +4 -15
  92. package/dist/index.es267.js.map +1 -1
  93. package/dist/index.es268.js +69 -2
  94. package/dist/index.es268.js.map +1 -1
  95. package/dist/index.es29.js +2 -2
  96. package/dist/index.es32.js +2 -2
  97. package/dist/index.es34.js +2 -2
  98. package/dist/index.es35.js +2 -2
  99. package/dist/index.es39.js +1 -1
  100. package/dist/index.es73.js +7 -1992
  101. package/dist/index.es73.js.map +1 -1
  102. package/dist/index.es74.js +2 -6
  103. package/dist/index.es74.js.map +1 -1
  104. package/dist/index.es75.js +26 -2
  105. package/dist/index.es75.js.map +1 -1
  106. package/dist/index.es76.js +588 -7
  107. package/dist/index.es76.js.map +1 -1
  108. package/dist/index.es77.js +21352 -2
  109. package/dist/index.es77.js.map +1 -1
  110. package/dist/index.es78.js +2 -26
  111. package/dist/index.es78.js.map +1 -1
  112. package/dist/index.es79.js +1960 -556
  113. package/dist/index.es79.js.map +1 -1
  114. package/dist/index.es80.js +5 -105
  115. package/dist/index.es80.js.map +1 -1
  116. package/dist/index.es81.js +2 -10
  117. package/dist/index.es81.js.map +1 -1
  118. package/dist/index.es82.js +104 -21350
  119. package/dist/index.es82.js.map +1 -1
  120. package/dist/index.es83.js +10 -2
  121. package/dist/index.es83.js.map +1 -1
  122. package/package.json +1 -1
  123. package/src/components/CertaintyLayer.js +10 -4
  124. package/src/utils/Map.js +35 -36
  125. package/types/components/CertaintyLayer.js.flow +10 -4
  126. package/types/utils/Map.js.flow +35 -36
@@ -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.1",
3
+ "version": "3.1.18-beta.10",
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,18 +14,24 @@ 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.toCertaintyCircle(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
25
31
  {...MapStyles.fill}
26
32
  id='certainty-layer'
27
33
  paint={{
28
- ...MapStyles.fill.paint,
34
+ ...MapStyles.fill.paint
29
35
  }}
30
36
  />
31
37
  </Source>
package/src/utils/Map.js CHANGED
@@ -26,45 +26,45 @@ 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 toCertaintyCircle = (item, radius: number) => {
30
+ if (item.geometry?.type === 'FeatureCollection') {
31
+ let children = [];
32
+
33
+ for (const childFeature of item.geometry.features) {
34
+ if (childFeature.geometry?.type === 'Point') {
35
+ const { geometry, type } = buildCircle(childFeature.geometry, radius);
36
+ children.push({
37
+ ...childFeature,
38
+ geometry,
39
+ type
40
+ });
38
41
  }
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
42
  }
48
- }
49
- };
50
43
 
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);
64
- }
44
+ return {
45
+ ...item,
46
+ geometry: {
47
+ type: 'GeometryCollection',
48
+ geometries: children
49
+ }
50
+ };
51
+ } else if (item?.type === 'GeometryCollection') {
52
+ return {
53
+ ...item,
54
+ geometries: item.geometries.map((geometry) => geometry.type === 'Point'
55
+ ? buildCircle(geometry, radius)
56
+ : geometry)
57
+ };
58
+ } else if (item.geometry?.type === 'Point') {
59
+ const { geometry, type } = buildCircle(item.geometry, radius);
60
+ return {
61
+ ...item,
62
+ geometry,
63
+ type
64
+ };
65
65
  }
66
66
 
67
- return featureCollection(features);
67
+ return item;
68
68
  };
69
69
 
70
70
  /**
@@ -213,8 +213,7 @@ const validateCoordinates = (coordinates) => {
213
213
 
214
214
  export default {
215
215
  addGeoreferenceLayer,
216
- getCertaintyCircle,
217
- getCertaintyCircleFeatureCollection,
216
+ toCertaintyCircle,
218
217
  getBoundingBox,
219
218
  removeLayer,
220
219
  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,18 +14,24 @@ 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.toCertaintyCircle(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
25
31
  {...MapStyles.fill}
26
32
  id='certainty-layer'
27
33
  paint={{
28
- ...MapStyles.fill.paint,
34
+ ...MapStyles.fill.paint
29
35
  }}
30
36
  />
31
37
  </Source>
@@ -26,45 +26,45 @@ 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 toCertaintyCircle = (item, radius: number) => {
30
+ if (item.geometry?.type === 'FeatureCollection') {
31
+ let children = [];
32
+
33
+ for (const childFeature of item.geometry.features) {
34
+ if (childFeature.geometry?.type === 'Point') {
35
+ const { geometry, type } = buildCircle(childFeature.geometry, radius);
36
+ children.push({
37
+ ...childFeature,
38
+ geometry,
39
+ type
40
+ });
38
41
  }
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
42
  }
48
- }
49
- };
50
43
 
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);
64
- }
44
+ return {
45
+ ...item,
46
+ geometry: {
47
+ type: 'GeometryCollection',
48
+ geometries: children
49
+ }
50
+ };
51
+ } else if (item?.type === 'GeometryCollection') {
52
+ return {
53
+ ...item,
54
+ geometries: item.geometries.map((geometry) => geometry.type === 'Point'
55
+ ? buildCircle(geometry, radius)
56
+ : geometry)
57
+ };
58
+ } else if (item.geometry?.type === 'Point') {
59
+ const { geometry, type } = buildCircle(item.geometry, radius);
60
+ return {
61
+ ...item,
62
+ geometry,
63
+ type
64
+ };
65
65
  }
66
66
 
67
- return featureCollection(features);
67
+ return item;
68
68
  };
69
69
 
70
70
  /**
@@ -213,8 +213,7 @@ const validateCoordinates = (coordinates) => {
213
213
 
214
214
  export default {
215
215
  addGeoreferenceLayer,
216
- getCertaintyCircle,
217
- getCertaintyCircleFeatureCollection,
216
+ toCertaintyCircle,
218
217
  getBoundingBox,
219
218
  removeLayer,
220
219
  toFeature,