@performant-software/geospatial 3.1.18-beta.7 → 3.1.18-beta.9

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 (158) hide show
  1. package/dist/index.cjs13.js +1 -1
  2. package/dist/index.cjs13.js.map +1 -1
  3. package/dist/index.cjs189.js +1 -1
  4. package/dist/index.cjs189.js.map +1 -1
  5. package/dist/index.cjs190.js +1 -1
  6. package/dist/index.cjs190.js.map +1 -1
  7. package/dist/index.cjs191.js +1 -1
  8. package/dist/index.cjs191.js.map +1 -1
  9. package/dist/index.cjs192.js +1 -1
  10. package/dist/index.cjs192.js.map +1 -1
  11. package/dist/index.cjs193.js +1 -1
  12. package/dist/index.cjs193.js.map +1 -1
  13. package/dist/index.cjs194.js +1 -1
  14. package/dist/index.cjs194.js.map +1 -1
  15. package/dist/index.cjs195.js +1 -1
  16. package/dist/index.cjs195.js.map +1 -1
  17. package/dist/index.cjs196.js +1 -1
  18. package/dist/index.cjs196.js.map +1 -1
  19. package/dist/index.cjs197.js +1 -1
  20. package/dist/index.cjs197.js.map +1 -1
  21. package/dist/index.cjs198.js +1 -1
  22. package/dist/index.cjs198.js.map +1 -1
  23. package/dist/index.cjs199.js +1 -1
  24. package/dist/index.cjs199.js.map +1 -1
  25. package/dist/index.cjs200.js +1 -1
  26. package/dist/index.cjs200.js.map +1 -1
  27. package/dist/index.cjs201.js +1 -1
  28. package/dist/index.cjs201.js.map +1 -1
  29. package/dist/index.cjs202.js +1 -1
  30. package/dist/index.cjs202.js.map +1 -1
  31. package/dist/index.cjs203.js +1 -1
  32. package/dist/index.cjs203.js.map +1 -1
  33. package/dist/index.cjs204.js +1 -1
  34. package/dist/index.cjs204.js.map +1 -1
  35. package/dist/index.cjs205.js +1 -1
  36. package/dist/index.cjs215.js +1 -1
  37. package/dist/index.cjs216.js +1 -1
  38. package/dist/index.cjs217.js +1 -1
  39. package/dist/index.cjs235.js +1 -1
  40. package/dist/index.cjs242.js +1 -1
  41. package/dist/index.cjs242.js.map +1 -1
  42. package/dist/index.cjs243.js +1 -1
  43. package/dist/index.cjs243.js.map +1 -1
  44. package/dist/index.cjs244.js +1 -1
  45. package/dist/index.cjs244.js.map +1 -1
  46. package/dist/index.cjs245.js +1 -1
  47. package/dist/index.cjs245.js.map +1 -1
  48. package/dist/index.cjs246.js +1 -1
  49. package/dist/index.cjs246.js.map +1 -1
  50. package/dist/index.cjs248.js +1 -1
  51. package/dist/index.cjs251.js +1 -1
  52. package/dist/index.cjs257.js +1 -1
  53. package/dist/index.cjs263.js +1 -1
  54. package/dist/index.cjs268.js +1 -1
  55. package/dist/index.cjs29.js +1 -1
  56. package/dist/index.cjs32.js +1 -1
  57. package/dist/index.cjs34.js +1 -1
  58. package/dist/index.cjs35.js +1 -1
  59. package/dist/index.cjs39.js +1 -1
  60. package/dist/index.cjs69.js +1 -1
  61. package/dist/index.cjs71.js +1 -1
  62. package/dist/index.cjs72.js +1 -1
  63. package/dist/index.cjs77.js +1 -743
  64. package/dist/index.cjs77.js.map +1 -1
  65. package/dist/index.cjs78.js +1 -1
  66. package/dist/index.cjs79.js +1 -1
  67. package/dist/index.cjs79.js.map +1 -1
  68. package/dist/index.cjs80.js +743 -1
  69. package/dist/index.cjs80.js.map +1 -1
  70. package/dist/index.cjs81.js +1 -1
  71. package/dist/index.cjs81.js.map +1 -1
  72. package/dist/index.cjs82.js +1 -1
  73. package/dist/index.cjs82.js.map +1 -1
  74. package/dist/index.cjs83.js +1 -1
  75. package/dist/index.cjs83.js.map +1 -1
  76. package/dist/index.cjs84.js +1 -1
  77. package/dist/index.cjs84.js.map +1 -1
  78. package/dist/index.es13.js +51 -41
  79. package/dist/index.es13.js.map +1 -1
  80. package/dist/index.es189.js +12 -146
  81. package/dist/index.es189.js.map +1 -1
  82. package/dist/index.es190.js +147 -6
  83. package/dist/index.es190.js.map +1 -1
  84. package/dist/index.es191.js +7 -5
  85. package/dist/index.es191.js.map +1 -1
  86. package/dist/index.es192.js +7 -3
  87. package/dist/index.es192.js.map +1 -1
  88. package/dist/index.es193.js +1 -1
  89. package/dist/index.es193.js.map +1 -1
  90. package/dist/index.es194.js +3 -38
  91. package/dist/index.es194.js.map +1 -1
  92. package/dist/index.es195.js +38 -3
  93. package/dist/index.es195.js.map +1 -1
  94. package/dist/index.es196.js +3 -25
  95. package/dist/index.es196.js.map +1 -1
  96. package/dist/index.es197.js +25 -2
  97. package/dist/index.es197.js.map +1 -1
  98. package/dist/index.es198.js +0 -1
  99. package/dist/index.es198.js.map +1 -1
  100. package/dist/index.es199.js +1 -0
  101. package/dist/index.es199.js.map +1 -1
  102. package/dist/index.es200.js +2 -33
  103. package/dist/index.es200.js.map +1 -1
  104. package/dist/index.es201.js +31 -13
  105. package/dist/index.es201.js.map +1 -1
  106. package/dist/index.es202.js +11 -12
  107. package/dist/index.es202.js.map +1 -1
  108. package/dist/index.es203.js +13 -8
  109. package/dist/index.es203.js.map +1 -1
  110. package/dist/index.es204.js +8 -13
  111. package/dist/index.es204.js.map +1 -1
  112. package/dist/index.es205.js +2 -2
  113. package/dist/index.es215.js +1 -1
  114. package/dist/index.es216.js +1 -1
  115. package/dist/index.es217.js +1 -1
  116. package/dist/index.es235.js +1 -1
  117. package/dist/index.es242.js +4 -19
  118. package/dist/index.es242.js.map +1 -1
  119. package/dist/index.es243.js +3 -23
  120. package/dist/index.es243.js.map +1 -1
  121. package/dist/index.es244.js +19 -6
  122. package/dist/index.es244.js.map +1 -1
  123. package/dist/index.es245.js +22 -5
  124. package/dist/index.es245.js.map +1 -1
  125. package/dist/index.es246.js +8 -3
  126. package/dist/index.es246.js.map +1 -1
  127. package/dist/index.es248.js +1 -1
  128. package/dist/index.es251.js +1 -1
  129. package/dist/index.es257.js +2 -2
  130. package/dist/index.es263.js +1 -1
  131. package/dist/index.es268.js +2 -2
  132. package/dist/index.es29.js +2 -2
  133. package/dist/index.es32.js +2 -2
  134. package/dist/index.es34.js +2 -2
  135. package/dist/index.es35.js +2 -2
  136. package/dist/index.es39.js +1 -1
  137. package/dist/index.es69.js +1 -1
  138. package/dist/index.es71.js +6 -6
  139. package/dist/index.es72.js +1 -1
  140. package/dist/index.es77.js +1954 -21313
  141. package/dist/index.es77.js.map +1 -1
  142. package/dist/index.es78.js +6 -2
  143. package/dist/index.es78.js.map +1 -1
  144. package/dist/index.es79.js +2 -106
  145. package/dist/index.es79.js.map +1 -1
  146. package/dist/index.es80.js +21352 -10
  147. package/dist/index.es80.js.map +1 -1
  148. package/dist/index.es81.js +2 -1993
  149. package/dist/index.es81.js.map +1 -1
  150. package/dist/index.es82.js +11 -5
  151. package/dist/index.es82.js.map +1 -1
  152. package/dist/index.es83.js +106 -2
  153. package/dist/index.es83.js.map +1 -1
  154. package/dist/index.es84.js +10 -12
  155. package/dist/index.es84.js.map +1 -1
  156. package/package.json +1 -1
  157. package/src/utils/Map.js +14 -9
  158. package/types/utils/Map.js.flow +14 -9
@@ -1,10 +1,10 @@
1
1
  import { WarpedMapLayer as y } from "./index.es68.js";
2
- import { bbox as m } from "./index.es69.js";
2
+ import { bbox as p } from "./index.es69.js";
3
3
  import { bboxPolygon as c } from "./index.es70.js";
4
- import { buffer as f } from "./index.es71.js";
5
- import u from "./index.es72.js";
4
+ import { buffer as u } from "./index.es71.js";
5
+ import f from "./index.es72.js";
6
6
  import { featureCollection as d, feature as g } from "./index.es67.js";
7
- import p from "./index.es36.js";
7
+ import l from "./index.es36.js";
8
8
  import "./index.es37.js";
9
9
  import "./index.es38.js";
10
10
  import "./index.es39.js";
@@ -32,14 +32,18 @@ import "./index.es60.js";
32
32
  import "./index.es61.js";
33
33
  import "./index.es62.js";
34
34
  import "./index.es63.js";
35
- const _ = -90, L = 90, C = -180, G = 180, n = (e, o) => u(e.coordinates, o, { units: "kilometers", steps: 32 }), I = (e, o) => {
35
+ const _ = -90, L = 90, C = -180, G = 180, m = (e, r) => f(e.coordinates, r, { units: "kilometers", steps: 32 }), I = (e, r) => {
36
36
  if (e.geometry?.type === "FeatureCollection") {
37
37
  let t = [];
38
- for (const r of e.geometry.features)
39
- r.geometry?.type === "Point" && t.push({
40
- ...r,
41
- geometry: n(r.geometry, o)
42
- });
38
+ for (const o of e.geometry.features)
39
+ if (o.geometry?.type === "Point") {
40
+ const { geometry: i, type: n } = m(o.geometry, r);
41
+ t.push({
42
+ ...o,
43
+ geometry: i,
44
+ type: n
45
+ });
46
+ }
43
47
  return {
44
48
  ...e,
45
49
  geometry: {
@@ -47,30 +51,36 @@ const _ = -90, L = 90, C = -180, G = 180, n = (e, o) => u(e.coordinates, o, { un
47
51
  geometries: t
48
52
  }
49
53
  };
50
- } else if (e.geometry?.type === "GeometryCollection") {
51
- for (const t of e.geometry.geometries)
52
- if (t.type === "Point")
53
- return {
54
- ...e,
55
- geometry: n(t, o)
56
- };
57
- } else if (e.geometry?.type === "Point")
58
- return {
59
- ...e,
60
- geometry: n(e.geometry, o)
61
- };
54
+ } else {
55
+ if (e.geometry?.type === "GeometryCollection")
56
+ return {
57
+ ...e,
58
+ geometry: {
59
+ ...e.geometry,
60
+ geometries: e.geometry.geometries.map((t) => t.type === "Point" ? m(t, r) : t)
61
+ }
62
+ };
63
+ if (e.geometry?.type === "Point") {
64
+ const { geometry: t, type: o } = m(e.geometry, r);
65
+ return {
66
+ ...e,
67
+ geometry: t,
68
+ type: o
69
+ };
70
+ }
71
+ }
62
72
  return e;
63
- }, M = (e, o, t = {}) => {
64
- const r = new y(o);
65
- e.addLayer(r), t.url ? r.addGeoreferenceAnnotationByUrl(t.url) : t.manifest && r.addGeoreferenceAnnotation(t.manifest), t.opacity && r.setOpacity(t.opacity);
66
- }, b = (e, o = null) => {
67
- const t = m(e);
68
- if (!l(t))
73
+ }, M = (e, r, t = {}) => {
74
+ const o = new y(r);
75
+ e.addLayer(o), t.url ? o.addGeoreferenceAnnotationByUrl(t.url) : t.manifest && o.addGeoreferenceAnnotation(t.manifest), t.opacity && o.setOpacity(t.opacity);
76
+ }, b = (e, r = null) => {
77
+ const t = p(e);
78
+ if (!a(t))
69
79
  return null;
70
- const r = c(t);
80
+ const o = c(t);
71
81
  let i;
72
- return o ? i = f(r, o, { units: "miles" }) : i = r, m(i);
73
- }, v = (e, o) => e && e.removeLayer(o), x = (e, o, t, r) => {
82
+ return r ? i = u(o, r, { units: "miles" }) : i = o, p(i);
83
+ }, v = (e, r) => e && e.removeLayer(r), x = (e, r, t, o) => {
74
84
  const i = {
75
85
  id: e.record_id,
76
86
  ccode: [],
@@ -80,18 +90,18 @@ const _ = -90, L = 90, C = -180, G = 180, n = (e, o) => u(e.coordinates, o, { un
80
90
  name: e.name,
81
91
  names: e.names?.map((s) => ({ toponym: s })),
82
92
  type: e.type,
83
- items: [o],
93
+ items: [r],
84
94
  url: e.url,
85
- originalProperties: r || {}
86
- }, a = parseInt(e.record_id, 10);
87
- return g(t, i, { id: a });
88
- }, A = (e) => d(e), l = (e) => p.every(e, p.isFinite), B = (e) => {
89
- let o = !1;
95
+ originalProperties: o || {}
96
+ }, n = parseInt(e.record_id, 10);
97
+ return g(t, i, { id: n });
98
+ }, A = (e) => d(e), a = (e) => l.every(e, l.isFinite), B = (e) => {
99
+ let r = !1;
90
100
  if (e) {
91
- const [t, r] = e;
92
- o = t >= _ && t <= L && r >= C && r <= G;
101
+ const [t, o] = e;
102
+ r = t >= _ && t <= L && o >= C && o <= G;
93
103
  }
94
- return o;
104
+ return r;
95
105
  }, le = {
96
106
  addGeoreferenceLayer: M,
97
107
  toCertaintyCircle: I,
@@ -99,7 +109,7 @@ const _ = -90, L = 90, C = -180, G = 180, n = (e, o) => u(e.coordinates, o, { un
99
109
  removeLayer: v,
100
110
  toFeature: x,
101
111
  toFeatureCollection: A,
102
- validateBoundingBox: l,
112
+ validateBoundingBox: a,
103
113
  validateCoordinates: B
104
114
  };
105
115
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"index.es13.js","sources":["../src/utils/Map.js"],"sourcesContent":["// @flow\n\nimport { WarpedMapLayer } from '@allmaps/maplibre';\nimport {\n bbox,\n bboxPolygon,\n buffer,\n feature,\n featureCollection\n} from '@turf/turf';\nimport _ from 'underscore';\nimport circle from '@turf/circle';\n\nconst MIN_LATITUDE = -90;\nconst MAX_LATITUDE = 90;\nconst MIN_LONGITUDE = -180;\nconst MAX_LONGITUDE = 180;\n\n/**\n * Returns a GeoJSON circle feature with the given center point and radius.\n * @param point - The center point of the circle.\n * @param radius - The radius of the circle in kilometers.\n * @returns {Feature<Geometry, Properties>} - The GeoJSON circle feature.\n */\nconst buildCircle = (point, radius) => (\n circle(point.coordinates, radius, { units: 'kilometers', steps: 32 })\n);\n\nconst toCertaintyCircle = (item, radius: number) => {\n if (item.geometry?.type === 'FeatureCollection') {\n let children = [];\n\n for (const childFeature of item.geometry.features) {\n if (childFeature.geometry?.type === 'Point') {\n children.push({\n ...childFeature,\n geometry: buildCircle(childFeature.geometry, radius)\n });\n }\n }\n\n return {\n ...item,\n geometry: {\n type: 'GeometryCollection',\n geometries: children\n }\n };\n } else if (item.geometry?.type === 'GeometryCollection') {\n for (const geometry of item.geometry.geometries) {\n if (geometry.type === 'Point') {\n return {\n ...item,\n geometry: buildCircle(geometry, radius)\n };\n }\n }\n } else if (item.geometry?.type === 'Point') {\n return {\n ...item,\n geometry: buildCircle(item.geometry, radius)\n };\n }\n\n return item;\n};\n\n/**\n * Adds the geo-referenced image layer to the passed map.\n *\n * @param map\n * @param layerId\n * @param options\n */\nconst addGeoreferenceLayer = (map, layerId, options = {}) => {\n const warpedMapLayer = new WarpedMapLayer(layerId);\n map.addLayer(warpedMapLayer);\n\n if (options.url) {\n warpedMapLayer.addGeoreferenceAnnotationByUrl(options.url);\n } else if (options.manifest) {\n warpedMapLayer.addGeoreferenceAnnotation(options.manifest);\n }\n\n if (options.opacity) {\n warpedMapLayer.setOpacity(options.opacity);\n }\n};\n\n/**\n * Returns a bounding box for the passed geometry (with optional buffer).\n *\n * @param data\n * @param bufferDistance\n *\n * @returns {BBox}\n */\nconst getBoundingBox = (data, bufferDistance = null) => {\n // Convert the GeoJSON into a bounding box\n const box = bbox(data);\n\n if (!validateBoundingBox(box)) {\n return null;\n }\n\n // Convert the bounding box to a polygon\n const polygon = bboxPolygon(box);\n\n // Create a buffer around the polygon (if a distance is provided)\n let polygonBuffer;\n\n if (bufferDistance) {\n polygonBuffer = buffer(polygon, bufferDistance, { units: 'miles' });\n } else {\n polygonBuffer = polygon;\n }\n\n // Convert the buffer to a bounding box\n return bbox(polygonBuffer);\n};\n\n/**\n * Removes a layer from the passed map.\n *\n * @param map\n * @param layerId\n *\n * @returns {*}\n */\nconst removeLayer = (map, layerId) => map && map.removeLayer(layerId);\n\n/**\n * Wraps the passed record in a feature.\n *\n * @param record\n * @param item\n * @param geometry\n * @param originalProperties\n *\n * @returns {Feature<Geometry, {\n * id: *,\n * ccode: [],\n * title: *,\n * uuid: *,\n * record_id: *,\n * name: *,\n * names: *,\n * type: *,\n * items: [*],\n * url: *\n * }>}\n */\nconst toFeature = (record: any, item: any, geometry: any, originalProperties?: any) => {\n const properties = {\n id: record.record_id,\n ccode: [],\n title: record.name,\n uuid: record.uuid,\n record_id: record.record_id,\n name: record.name,\n names: record.names?.map((toponym: string) => ({ toponym })),\n type: record.type,\n items: [item],\n url: record.url,\n originalProperties: originalProperties || {}\n };\n\n const id = parseInt(record.record_id, 10);\n return feature(geometry, properties, { id });\n};\n\n/**\n * Returns a feature collection for the passed set of features.\n *\n * @param features\n *\n * @returns {FeatureCollection<Geometry, GeoJsonProperties>}\n */\nconst toFeatureCollection = (features: Array<any>) => featureCollection(features);\n\n/**\n * Validates that the passed bounding box contains finite coordinates.\n *\n * @param boundingBox\n *\n * @returns {*}\n */\nconst validateBoundingBox = (boundingBox: Array<number>) => _.every(boundingBox, _.isFinite);\n\n/**\n * Returns true if the passed coordinates are valid.\n *\n * @param coordinates\n *\n * @returns {boolean}\n */\nconst validateCoordinates = (coordinates) => {\n let valid = false;\n\n if (coordinates) {\n const [latitude, longitude] = coordinates;\n\n valid = latitude >= MIN_LATITUDE\n && latitude <= MAX_LATITUDE\n && longitude >= MIN_LONGITUDE\n && longitude <= MAX_LONGITUDE;\n }\n\n return valid;\n};\n\nexport default {\n addGeoreferenceLayer,\n toCertaintyCircle,\n getBoundingBox,\n removeLayer,\n toFeature,\n toFeatureCollection,\n validateBoundingBox,\n validateCoordinates\n};\n"],"names":["MIN_LATITUDE","MAX_LATITUDE","MIN_LONGITUDE","MAX_LONGITUDE","buildCircle","point","radius","circle","toCertaintyCircle","item","children","childFeature","geometry","addGeoreferenceLayer","map","layerId","options","warpedMapLayer","WarpedMapLayer","getBoundingBox","data","bufferDistance","box","bbox","validateBoundingBox","polygon","bboxPolygon","polygonBuffer","buffer","removeLayer","toFeature","record","originalProperties","properties","toponym","id","feature","toFeatureCollection","features","featureCollection","boundingBox","_","validateCoordinates","coordinates","valid","latitude","longitude","MapUtils"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAMA,IAAe,KACfC,IAAe,IACfC,IAAgB,MAChBC,IAAgB,KAQhBC,IAAc,CAACC,GAAOC,MAC1BC,EAAOF,EAAM,aAAaC,GAAQ,EAAE,OAAO,cAAc,OAAO,IAAI,GAGhEE,IAAoB,CAACC,GAAMH,MAAmB;AAClD,MAAIG,EAAK,UAAU,SAAS,qBAAqB;AAC/C,QAAIC,IAAW,CAAA;AAEf,eAAWC,KAAgBF,EAAK,SAAS;AACvC,MAAIE,EAAa,UAAU,SAAS,WAClCD,EAAS,KAAK;AAAA,QACZ,GAAGC;AAAA,QACH,UAAUP,EAAYO,EAAa,UAAUL,CAAM;AAAA,MAAA,CACpD;AAIL,WAAO;AAAA,MACL,GAAGG;AAAA,MACH,UAAU;AAAA,QACR,MAAM;AAAA,QACN,YAAYC;AAAA,MAAA;AAAA,IACd;AAAA,EAEJ,WAAWD,EAAK,UAAU,SAAS;AACjC,eAAWG,KAAYH,EAAK,SAAS;AACnC,UAAIG,EAAS,SAAS;AACpB,eAAO;AAAA,UACL,GAAGH;AAAA,UACH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AASJ,EAAO,WAAW,EAAE;AACxC,SAAOK,EAAQxB,GAAUqB,GAAY,EAAE,IAAAE,GAAI;AAC7C,GASME,IAAsB,CAACC,MAAyBC,EAAkBD,CAAQ,GAS1Ed,IAAsB,CAACgB,MAA+BC,EAAE,MAAMD,GAAaC,EAAE,QAAQ,GASrFC,IAAsB,CAACC,MAAgB;AAC3C,MAAIC,IAAQ;AAEZ,MAAID,GAAa;AACf,UAAM,CAACE,GAAUC,CAAS,IAAIH;AAE9B,IAAAC,IAAQC,KAAY7C,KACf6C,KAAY5C,KACZ6C,KAAa5C,KACb4C,KAAa3C;AAAA,EACpB;AAEA,SAAOyC;AACT,GAEAG,KAAe;AAAA,EACb,sBAAAlC;AAAA,EACA,mBAAAL;AAAA,EACA,gBAAAW;AAAA,EACA,aAAAU;AAAA,EACA,WAAAC;AAAA,EACA,qBAAAO;AAAA,EACA,qBAAAb;AAAA,EACA,qBAAAkB;AACF;"}
1
+ {"version":3,"file":"index.es13.js","sources":["../src/utils/Map.js"],"sourcesContent":["// @flow\n\nimport { WarpedMapLayer } from '@allmaps/maplibre';\nimport {\n bbox,\n bboxPolygon,\n buffer,\n feature,\n featureCollection\n} from '@turf/turf';\nimport _ from 'underscore';\nimport circle from '@turf/circle';\n\nconst MIN_LATITUDE = -90;\nconst MAX_LATITUDE = 90;\nconst MIN_LONGITUDE = -180;\nconst MAX_LONGITUDE = 180;\n\n/**\n * Returns a GeoJSON circle feature with the given center point and radius.\n * @param point - The center point of the circle.\n * @param radius - The radius of the circle in kilometers.\n * @returns {Feature<Geometry, Properties>} - The GeoJSON circle feature.\n */\nconst buildCircle = (point, radius) => (\n circle(point.coordinates, radius, { units: 'kilometers', steps: 32 })\n);\n\nconst toCertaintyCircle = (item, radius: number) => {\n if (item.geometry?.type === 'FeatureCollection') {\n let children = [];\n\n for (const childFeature of item.geometry.features) {\n if (childFeature.geometry?.type === 'Point') {\n const { geometry, type } = buildCircle(childFeature.geometry, radius);\n children.push({\n ...childFeature,\n geometry,\n type\n });\n }\n }\n\n return {\n ...item,\n geometry: {\n type: 'GeometryCollection',\n geometries: children\n }\n };\n } else if (item.geometry?.type === 'GeometryCollection') {\n return {\n ...item,\n geometry: {\n ...item.geometry,\n geometries: item.geometry.geometries.map((geometry) => geometry.type === 'Point'\n ? buildCircle(geometry, radius)\n : geometry)\n }\n };\n } else if (item.geometry?.type === 'Point') {\n const { geometry, type } = buildCircle(item.geometry, radius);\n return {\n ...item,\n geometry,\n type\n };\n }\n\n return item;\n};\n\n/**\n * Adds the geo-referenced image layer to the passed map.\n *\n * @param map\n * @param layerId\n * @param options\n */\nconst addGeoreferenceLayer = (map, layerId, options = {}) => {\n const warpedMapLayer = new WarpedMapLayer(layerId);\n map.addLayer(warpedMapLayer);\n\n if (options.url) {\n warpedMapLayer.addGeoreferenceAnnotationByUrl(options.url);\n } else if (options.manifest) {\n warpedMapLayer.addGeoreferenceAnnotation(options.manifest);\n }\n\n if (options.opacity) {\n warpedMapLayer.setOpacity(options.opacity);\n }\n};\n\n/**\n * Returns a bounding box for the passed geometry (with optional buffer).\n *\n * @param data\n * @param bufferDistance\n *\n * @returns {BBox}\n */\nconst getBoundingBox = (data, bufferDistance = null) => {\n // Convert the GeoJSON into a bounding box\n const box = bbox(data);\n\n if (!validateBoundingBox(box)) {\n return null;\n }\n\n // Convert the bounding box to a polygon\n const polygon = bboxPolygon(box);\n\n // Create a buffer around the polygon (if a distance is provided)\n let polygonBuffer;\n\n if (bufferDistance) {\n polygonBuffer = buffer(polygon, bufferDistance, { units: 'miles' });\n } else {\n polygonBuffer = polygon;\n }\n\n // Convert the buffer to a bounding box\n return bbox(polygonBuffer);\n};\n\n/**\n * Removes a layer from the passed map.\n *\n * @param map\n * @param layerId\n *\n * @returns {*}\n */\nconst removeLayer = (map, layerId) => map && map.removeLayer(layerId);\n\n/**\n * Wraps the passed record in a feature.\n *\n * @param record\n * @param item\n * @param geometry\n * @param originalProperties\n *\n * @returns {Feature<Geometry, {\n * id: *,\n * ccode: [],\n * title: *,\n * uuid: *,\n * record_id: *,\n * name: *,\n * names: *,\n * type: *,\n * items: [*],\n * url: *\n * }>}\n */\nconst toFeature = (record: any, item: any, geometry: any, originalProperties?: any) => {\n const properties = {\n id: record.record_id,\n ccode: [],\n title: record.name,\n uuid: record.uuid,\n record_id: record.record_id,\n name: record.name,\n names: record.names?.map((toponym: string) => ({ toponym })),\n type: record.type,\n items: [item],\n url: record.url,\n originalProperties: originalProperties || {}\n };\n\n const id = parseInt(record.record_id, 10);\n return feature(geometry, properties, { id });\n};\n\n/**\n * Returns a feature collection for the passed set of features.\n *\n * @param features\n *\n * @returns {FeatureCollection<Geometry, GeoJsonProperties>}\n */\nconst toFeatureCollection = (features: Array<any>) => featureCollection(features);\n\n/**\n * Validates that the passed bounding box contains finite coordinates.\n *\n * @param boundingBox\n *\n * @returns {*}\n */\nconst validateBoundingBox = (boundingBox: Array<number>) => _.every(boundingBox, _.isFinite);\n\n/**\n * Returns true if the passed coordinates are valid.\n *\n * @param coordinates\n *\n * @returns {boolean}\n */\nconst validateCoordinates = (coordinates) => {\n let valid = false;\n\n if (coordinates) {\n const [latitude, longitude] = coordinates;\n\n valid = latitude >= MIN_LATITUDE\n && latitude <= MAX_LATITUDE\n && longitude >= MIN_LONGITUDE\n && longitude <= MAX_LONGITUDE;\n }\n\n return valid;\n};\n\nexport default {\n addGeoreferenceLayer,\n toCertaintyCircle,\n getBoundingBox,\n removeLayer,\n toFeature,\n toFeatureCollection,\n validateBoundingBox,\n validateCoordinates\n};\n"],"names":["MIN_LATITUDE","MAX_LATITUDE","MIN_LONGITUDE","MAX_LONGITUDE","buildCircle","point","radius","circle","toCertaintyCircle","item","children","childFeature","geometry","type","addGeoreferenceLayer","map","layerId","options","warpedMapLayer","WarpedMapLayer","getBoundingBox","data","bufferDistance","box","bbox","validateBoundingBox","polygon","bboxPolygon","polygonBuffer","buffer","removeLayer","toFeature","record","originalProperties","properties","toponym","id","feature","toFeatureCollection","features","featureCollection","bounding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C,MAAgB;AAC3C,MAAIC,IAAQ;AAEZ,MAAID,GAAa;AACf,UAAM,CAACE,GAAUC,CAAS,IAAIH;AAE9B,IAAAC,IAAQC,KAAY9C,KACf8C,KAAY7C,KACZ8C,KAAa7C,KACb6C,KAAa5C;AAAA,EACpB;AAEA,SAAO0C;AACT,GAEAG,KAAe;AAAA,EACb,sBAAAlC;AAAA,EACA,mBAAAN;AAAA,EACA,gBAAAY;AAAA,EACA,aAAAU;AAAA,EACA,WAAAC;AAAA,EACA,qBAAAO;AAAA,EACA,qBAAAb;AAAA,EACA,qBAAAkB;AACF;"}
@@ -1,151 +1,17 @@
1
- function b(e, o, f) {
2
- if (e !== null)
3
- for (var r, i, a, u, c, t, s, y = 0, l = 0, h, p = e.type, C = p === "FeatureCollection", G = p === "Feature", w = C ? e.features.length : 1, P = 0; P < w; P++) {
4
- s = C ? e.features[P].geometry : G ? e.geometry : e, h = s ? s.type === "GeometryCollection" : !1, c = h ? s.geometries.length : 1;
5
- for (var M = 0; M < c; M++) {
6
- var n = 0, g = 0;
7
- if (u = h ? s.geometries[M] : s, u !== null) {
8
- t = u.coordinates;
9
- var v = u.type;
10
- switch (y = 0, v) {
11
- case null:
12
- break;
13
- case "Point":
14
- if (o(
15
- t,
16
- l,
17
- P,
18
- n,
19
- g
20
- ) === !1)
21
- return !1;
22
- l++, n++;
23
- break;
24
- case "LineString":
25
- case "MultiPoint":
26
- for (r = 0; r < t.length; r++) {
27
- if (o(
28
- t[r],
29
- l,
30
- P,
31
- n,
32
- g
33
- ) === !1)
34
- return !1;
35
- l++, v === "MultiPoint" && n++;
36
- }
37
- v === "LineString" && n++;
38
- break;
39
- case "Polygon":
40
- case "MultiLineString":
41
- for (r = 0; r < t.length; r++) {
42
- for (i = 0; i < t[r].length - y; i++) {
43
- if (o(
44
- t[r][i],
45
- l,
46
- P,
47
- n,
48
- g
49
- ) === !1)
50
- return !1;
51
- l++;
52
- }
53
- v === "MultiLineString" && n++, v === "Polygon" && g++;
54
- }
55
- v === "Polygon" && n++;
56
- break;
57
- case "MultiPolygon":
58
- for (r = 0; r < t.length; r++) {
59
- for (g = 0, i = 0; i < t[r].length; i++) {
60
- for (a = 0; a < t[r][i].length - y; a++) {
61
- if (o(
62
- t[r][i][a],
63
- l,
64
- P,
65
- n,
66
- g
67
- ) === !1)
68
- return !1;
69
- l++;
70
- }
71
- g++;
72
- }
73
- n++;
74
- }
75
- break;
76
- case "GeometryCollection":
77
- for (r = 0; r < u.geometries.length; r++)
78
- if (b(u.geometries[r], o) === !1)
79
- return !1;
80
- break;
81
- default:
82
- throw new Error("Unknown Geometry Type");
83
- }
84
- }
85
- }
86
- }
87
- }
88
- function S(e, o) {
89
- if (e.type === "Feature")
90
- o(e, 0);
91
- else if (e.type === "FeatureCollection")
92
- for (var f = 0; f < e.features.length && o(e.features[f], f) !== !1; f++)
93
- ;
94
- }
95
- function k(e, o) {
96
- var f, r, i, a, u, c, t, s, y, l, h = 0, p = e.type === "FeatureCollection", C = e.type === "Feature", G = p ? e.features.length : 1;
97
- for (f = 0; f < G; f++) {
98
- for (c = p ? e.features[f].geometry : C ? e.geometry : e, s = p ? e.features[f].properties : C ? e.properties : {}, y = p ? e.features[f].bbox : C ? e.bbox : void 0, l = p ? e.features[f].id : C ? e.id : void 0, t = c ? c.type === "GeometryCollection" : !1, u = t ? c.geometries.length : 1, i = 0; i < u; i++) {
99
- if (a = t ? c.geometries[i] : c, a === null) {
100
- if (o(
101
- null,
102
- h,
103
- s,
104
- y,
105
- l
106
- ) === !1)
107
- return !1;
108
- continue;
109
- }
110
- switch (a.type) {
111
- case "Point":
112
- case "LineString":
113
- case "MultiPoint":
114
- case "Polygon":
115
- case "MultiLineString":
116
- case "MultiPolygon": {
117
- if (o(
118
- a,
119
- h,
120
- s,
121
- y,
122
- l
123
- ) === !1)
124
- return !1;
125
- break;
126
- }
127
- case "GeometryCollection": {
128
- for (r = 0; r < a.geometries.length; r++)
129
- if (o(
130
- a.geometries[r],
131
- h,
132
- s,
133
- y,
134
- l
135
- ) === !1)
136
- return !1;
137
- break;
138
- }
139
- default:
140
- throw new Error("Unknown Geometry Type");
141
- }
142
- }
143
- h++;
1
+ function e(r) {
2
+ if (!r)
3
+ throw new Error("coord is required");
4
+ if (!Array.isArray(r)) {
5
+ if (r.type === "Feature" && r.geometry !== null && r.geometry.type === "Point")
6
+ return [...r.geometry.coordinates];
7
+ if (r.type === "Point")
8
+ return [...r.coordinates];
144
9
  }
10
+ if (Array.isArray(r) && r.length >= 2 && !Array.isArray(r[0]) && !Array.isArray(r[1]))
11
+ return [...r];
12
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
145
13
  }
146
14
  export {
147
- b as coordEach,
148
- S as featureEach,
149
- k as geomEach
15
+ e as getCoord
150
16
  };
151
17
  //# sourceMappingURL=index.es189.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es189.js","sources":["../../../node_modules/@turf/meta/dist/esm/index.js"],"sourcesContent":["// index.js\nimport { feature, point, lineString, isObject } from \"@turf/helpers\";\nfunction coordEach(geojson, callback, excludeWrapCoord) {\n if (geojson === null) return;\n var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === \"FeatureCollection\", isFeature = type === \"Feature\", stop = isFeatureCollection ? geojson.features.length : 1;\n for (var featureIndex = 0; featureIndex < stop; featureIndex++) {\n geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;\n isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === \"GeometryCollection\" : false;\n stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {\n var multiFeatureIndex = 0;\n var geometryIndex = 0;\n geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;\n if (geometry === null) continue;\n coords = geometry.coordinates;\n var geomType = geometry.type;\n wrapShrink = excludeWrapCoord && (geomType === \"Polygon\" || geomType === \"MultiPolygon\") ? 1 : 0;\n switch (geomType) {\n case null:\n break;\n case \"Point\":\n if (callback(\n coords,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n multiFeatureIndex++;\n break;\n case \"LineString\":\n case \"MultiPoint\":\n for (j = 0; j < coords.length; j++) {\n if (callback(\n coords[j],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n if (geomType === \"MultiPoint\") multiFeatureIndex++;\n }\n if (geomType === \"LineString\") multiFeatureIndex++;\n break;\n case \"Polygon\":\n case \"MultiLineString\":\n for (j = 0; j < coords.length; j++) {\n for (k = 0; k < coords[j].length - wrapShrink; k++) {\n if (callback(\n coords[j][k],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n }\n if (geomType === \"MultiLineString\") multiFeatureIndex++;\n if (geomType === \"Polygon\") geometryIndex++;\n }\n if (geomType === \"Polygon\") multiFeatureIndex++;\n break;\n case \"MultiPolygon\":\n for (j = 0; j < coords.length; j++) {\n geometryIndex = 0;\n for (k = 0; k < coords[j].length; k++) {\n for (l = 0; l < coords[j][k].length - wrapShrink; l++) {\n if (callback(\n coords[j][k][l],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n }\n geometryIndex++;\n }\n multiFeatureIndex++;\n }\n break;\n case \"GeometryCollection\":\n for (j = 0; j < geometry.geometries.length; j++)\n if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)\n return false;\n break;\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n }\n}\nfunction coordReduce(geojson, callback, initialValue, excludeWrapCoord) {\n var previousValue = initialValue;\n coordEach(\n geojson,\n function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n if (coordIndex === 0 && initialValue === void 0)\n previousValue = currentCoord;\n else\n previousValue = callback(\n previousValue,\n currentCoord,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n },\n excludeWrapCoord\n );\n return previousValue;\n}\nfunction propEach(geojson, callback) {\n var i;\n switch (geojson.type) {\n case \"FeatureCollection\":\n for (i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i].properties, i) === false) break;\n }\n break;\n case \"Feature\":\n callback(geojson.properties, 0);\n break;\n }\n}\nfunction propReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n propEach(geojson, function(currentProperties, featureIndex) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentProperties;\n else\n previousValue = callback(previousValue, currentProperties, featureIndex);\n });\n return previousValue;\n}\nfunction featureEach(geojson, callback) {\n if (geojson.type === \"Feature\") {\n callback(geojson, 0);\n } else if (geojson.type === \"FeatureCollection\") {\n for (var i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i], i) === false) break;\n }\n }\n}\nfunction featureReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n featureEach(geojson, function(currentFeature, featureIndex) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentFeature;\n else previousValue = callback(previousValue, currentFeature, featureIndex);\n });\n return previousValue;\n}\nfunction coordAll(geojson) {\n var coords = [];\n coordEach(geojson, function(coord) {\n coords.push(coord);\n });\n return coords;\n}\nfunction geomEach(geojson, callback) {\n var i, j, g, geometry, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === \"FeatureCollection\", isFeature = geojson.type === \"Feature\", stop = isFeatureCollection ? geojson.features.length : 1;\n for (i = 0; i < stop; i++) {\n geometryMaybeCollection = isFeatureCollection ? geojson.features[i].geometry : isFeature ? geojson.geometry : geojson;\n featureProperties = isFeatureCollection ? geojson.features[i].properties : isFeature ? geojson.properties : {};\n featureBBox = isFeatureCollection ? geojson.features[i].bbox : isFeature ? geojson.bbox : void 0;\n featureId = isFeatureCollection ? geojson.features[i].id : isFeature ? geojson.id : void 0;\n isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === \"GeometryCollection\" : false;\n stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n for (g = 0; g < stopG; g++) {\n geometry = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;\n if (geometry === null) {\n if (callback(\n null,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false)\n return false;\n continue;\n }\n switch (geometry.type) {\n case \"Point\":\n case \"LineString\":\n case \"MultiPoint\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\": {\n if (callback(\n geometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false)\n return false;\n break;\n }\n case \"GeometryCollection\": {\n for (j = 0; j < geometry.geometries.length; j++) {\n if (callback(\n geometry.geometries[j],\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false)\n return false;\n }\n break;\n }\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n featureIndex++;\n }\n}\nfunction geomReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n geomEach(\n geojson,\n function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentGeometry;\n else\n previousValue = callback(\n previousValue,\n currentGeometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n );\n }\n );\n return previousValue;\n}\nfunction flattenEach(geojson, callback) {\n geomEach(geojson, function(geometry, featureIndex, properties, bbox, id) {\n var type = geometry === null ? null : geometry.type;\n switch (type) {\n case null:\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n if (callback(\n feature(geometry, properties, { bbox, id }),\n featureIndex,\n 0\n ) === false)\n return false;\n return;\n }\n var geomType;\n switch (type) {\n case \"MultiPoint\":\n geomType = \"Point\";\n break;\n case \"MultiLineString\":\n geomType = \"LineString\";\n break;\n case \"MultiPolygon\":\n geomType = \"Polygon\";\n break;\n }\n for (var multiFeatureIndex = 0; multiFeatureIndex < geometry.coordinates.length; multiFeatureIndex++) {\n var coordinate = geometry.coordinates[multiFeatureIndex];\n var geom = {\n type: geomType,\n coordinates: coordinate\n };\n if (callback(feature(geom, properties), featureIndex, multiFeatureIndex) === false)\n return false;\n }\n });\n}\nfunction flattenReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n flattenEach(\n geojson,\n function(currentFeature, featureIndex, multiFeatureIndex) {\n if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)\n previousValue = currentFeature;\n else\n previousValue = callback(\n previousValue,\n currentFeature,\n featureIndex,\n multiFeatureIndex\n );\n }\n );\n return previousValue;\n}\nfunction segmentEach(geojson, callback) {\n flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {\n var segmentIndex = 0;\n if (!feature2.geometry) return;\n var type = feature2.geometry.type;\n if (type === \"Point\" || type === \"MultiPoint\") return;\n var previousCoords;\n var previousFeatureIndex = 0;\n var previousMultiIndex = 0;\n var prevGeomIndex = 0;\n if (coordEach(\n feature2,\n function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {\n if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {\n previousCoords = currentCoord;\n previousFeatureIndex = featureIndex;\n previousMultiIndex = multiPartIndexCoord;\n prevGeomIndex = geometryIndex;\n segmentIndex = 0;\n return;\n }\n var currentSegment = lineString(\n [previousCoords, currentCoord],\n feature2.properties\n );\n if (callback(\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n ) === false)\n return false;\n segmentIndex++;\n previousCoords = currentCoord;\n }\n ) === false)\n return false;\n });\n}\nfunction segmentReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n var started = false;\n segmentEach(\n geojson,\n function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n if (started === false && initialValue === void 0)\n previousValue = currentSegment;\n else\n previousValue = callback(\n previousValue,\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n );\n started = true;\n }\n );\n return previousValue;\n}\nfunction lineEach(geojson, callback) {\n if (!geojson) throw new Error(\"geojson is required\");\n flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {\n if (feature2.geometry === null) return;\n var type = feature2.geometry.type;\n var coords = feature2.geometry.coordinates;\n switch (type) {\n case \"LineString\":\n if (callback(feature2, featureIndex, multiFeatureIndex, 0, 0) === false)\n return false;\n break;\n case \"Polygon\":\n for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) {\n if (callback(\n lineString(coords[geometryIndex], feature2.properties),\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n }\n break;\n }\n });\n}\nfunction lineReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n lineEach(\n geojson,\n function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentLine;\n else\n previousValue = callback(\n previousValue,\n currentLine,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n }\n );\n return previousValue;\n}\nfunction findSegment(geojson, options) {\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var segmentIndex = options.segmentIndex || 0;\n var properties = options.properties;\n var geometry;\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n if (geometry === null) return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n if (segmentIndex < 0) segmentIndex = coords.length + segmentIndex - 1;\n return lineString(\n [coords[segmentIndex], coords[segmentIndex + 1]],\n properties,\n options\n );\n case \"Polygon\":\n if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[geometryIndex].length + segmentIndex - 1;\n return lineString(\n [\n coords[geometryIndex][segmentIndex],\n coords[geometryIndex][segmentIndex + 1]\n ],\n properties,\n options\n );\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;\n return lineString(\n [\n coords[multiFeatureIndex][segmentIndex],\n coords[multiFeatureIndex][segmentIndex + 1]\n ],\n properties,\n options\n );\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;\n return lineString(\n [\n coords[multiFeatureIndex][geometryIndex][segmentIndex],\n coords[multiFeatureIndex][geometryIndex][segmentIndex + 1]\n ],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n}\nfunction findPoint(geojson, options) {\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var coordIndex = options.coordIndex || 0;\n var properties = options.properties;\n var geometry;\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n if (geometry === null) return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n return point(coords, properties, options);\n case \"MultiPoint\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n return point(coords[multiFeatureIndex], properties, options);\n case \"LineString\":\n if (coordIndex < 0) coordIndex = coords.length + coordIndex;\n return point(coords[coordIndex], properties, options);\n case \"Polygon\":\n if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n if (coordIndex < 0)\n coordIndex = coords[geometryIndex].length + coordIndex;\n return point(coords[geometryIndex][coordIndex], properties, options);\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (coordIndex < 0)\n coordIndex = coords[multiFeatureIndex].length + coordIndex;\n return point(coords[multiFeatureIndex][coordIndex], properties, options);\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (coordIndex < 0)\n coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex;\n return point(\n coords[multiFeatureIndex][geometryIndex][coordIndex],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n}\nexport {\n coordAll,\n coordEach,\n coordReduce,\n featureEach,\n featureReduce,\n findPoint,\n findSegment,\n flattenEach,\n flattenReduce,\n geomEach,\n geomReduce,\n lineEach,\n lineReduce,\n propEach,\n propReduce,\n segmentEach,\n segmentReduce\n};\n//# sourceMappingURL=index.js.map"],"names":["coordEach","geojson","callback","excludeWrapCoord","j","k","l","geometry","stopG","coords","geometryMaybeCollection","wrapShrink","coordIndex","isGeometryCollection","type","isFeatureCollection","isFeature","stop","featureIndex","geomIndex","multiFeatureIndex","geometryIndex","geomType","featureEach","i","geomEach","g","featureProperties","featureBBox","featureId"],"mappings":"AAEA,SAASA,EAAUC,GAASC,GAAUC,GAAkB;AACtD,MAAIF,MAAY;AAEhB,aADIG,GAAGC,GAAGC,GAAGC,GAAUC,GAAOC,GAAQC,GAAyBC,IAAa,GAAGC,IAAa,GAAGC,GAAsBC,IAAOb,EAAQ,MAAMc,IAAsBD,MAAS,qBAAqBE,IAAYF,MAAS,WAAWG,IAAOF,IAAsBd,EAAQ,SAAS,SAAS,GAC5QiB,IAAe,GAAGA,IAAeD,GAAMC,KAAgB;AAC9D,MAAAR,IAA0BK,IAAsBd,EAAQ,SAASiB,CAAY,EAAE,WAAWF,IAAYf,EAAQ,WAAWA,GACzHY,IAAuBH,IAA0BA,EAAwB,SAAS,uBAAuB,IACzGF,IAAQK,IAAuBH,EAAwB,WAAW,SAAS;AAC3E,eAASS,IAAY,GAAGA,IAAYX,GAAOW,KAAa;AACtD,YAAIC,IAAoB,GACpBC,IAAgB;AAEpB,YADAd,IAAWM,IAAuBH,EAAwB,WAAWS,CAAS,IAAIT,GAC9EH,MAAa,MACjB;AAAA,UAAAE,IAASF,EAAS;AAClB,cAAIe,IAAWf,EAAS;AAExB,kBADAI,IAA+F,GACvFW,GAAA;AAAA,YACN,KAAK;AACH;AAAA,YACF,KAAK;AACH,kBAAIpB;AAAA,gBACFO;AAAA,gBACAG;AAAA,gBACAM;AAAA,gBACAE;AAAA,gBACAC;AAAA,cAAA,MACI;AACJ,uBAAO;AACT,cAAAT,KACAQ;AACA;AAAA,YACF,KAAK;AAAA,YACL,KAAK;AACH,mBAAKhB,IAAI,GAAGA,IAAIK,EAAO,QAAQL,KAAK;AAClC,oBAAIF;AAAA,kBACFO,EAAOL,CAAC;AAAA,kBACR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A,MACF;AACA,cAAQtB,EAAS,MAAA;AAAA,QACf,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK,gBAAgB;AACnB,cAAIL;AAAA,YACFK;AAAA,YACAW;AAAA,YACAS;AAAA,YACAC;AAAA,YACAC;AAAA,UAAA,MACI;AACJ,mBAAO;AACT;AAAA,QACF;AAAA,QACA,KAAK,sBAAsB;AACzB,eAAKzB,IAAI,GAAGA,IAAIG,EAAS,WAAW,QAAQH;AAC1C,gBAAIF;AAAA,cACFK,EAAS,WAAWH,CAAC;AAAA,cACrBc;AAAA,cACAS;AAAA,cACAC;AAAA,cACAC;AAAA,YAAA,MACI;AACJ,qBAAO;AAEX;AAAA,QACF;AAAA,QACA;AACE,gBAAM,IAAI,MAAM,uBAAuB;AAAA,MAAA;AAAA,IAE7C;AACA,IAAAX;AAAA,EACF;AACF;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es189.js","sources":["../../../node_modules/@turf/invariant/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { isNumber } from \"@turf/helpers\";\nfunction getCoord(coord) {\n if (!coord) {\n throw new Error(\"coord is required\");\n }\n if (!Array.isArray(coord)) {\n if (coord.type === \"Feature\" && coord.geometry !== null && coord.geometry.type === \"Point\") {\n return [...coord.geometry.coordinates];\n }\n if (coord.type === \"Point\") {\n return [...coord.coordinates];\n }\n }\n if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {\n return [...coord];\n }\n throw new Error(\"coord must be GeoJSON Point or an Array of numbers\");\n}\nfunction getCoords(coords) {\n if (Array.isArray(coords)) {\n return coords;\n }\n if (coords.type === \"Feature\") {\n if (coords.geometry !== null) {\n return coords.geometry.coordinates;\n }\n } else {\n if (coords.coordinates) {\n return coords.coordinates;\n }\n }\n throw new Error(\n \"coords must be GeoJSON Feature, Geometry Object or an Array\"\n );\n}\nfunction containsNumber(coordinates) {\n if (coordinates.length > 1 && isNumber(coordinates[0]) && isNumber(coordinates[1])) {\n return true;\n }\n if (Array.isArray(coordinates[0]) && coordinates[0].length) {\n return containsNumber(coordinates[0]);\n }\n throw new Error(\"coordinates must only contain numbers\");\n}\nfunction geojsonType(value, type, name) {\n if (!type || !name) {\n throw new Error(\"type and name required\");\n }\n if (!value || value.type !== type) {\n throw new Error(\n \"Invalid input to \" + name + \": must be a \" + type + \", given \" + value.type\n );\n }\n}\nfunction featureOf(feature, type, name) {\n if (!feature) {\n throw new Error(\"No feature passed\");\n }\n if (!name) {\n throw new Error(\".featureOf() requires a name\");\n }\n if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n throw new Error(\n \"Invalid input to \" + name + \", Feature with geometry required\"\n );\n }\n if (!feature.geometry || feature.geometry.type !== type) {\n throw new Error(\n \"Invalid input to \" + name + \": must be a \" + type + \", given \" + feature.geometry.type\n );\n }\n}\nfunction collectionOf(featureCollection, type, name) {\n if (!featureCollection) {\n throw new Error(\"No featureCollection passed\");\n }\n if (!name) {\n throw new Error(\".collectionOf() requires a name\");\n }\n if (!featureCollection || featureCollection.type !== \"FeatureCollection\") {\n throw new Error(\n \"Invalid input to \" + name + \", FeatureCollection required\"\n );\n }\n for (const feature of featureCollection.features) {\n if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n throw new Error(\n \"Invalid input to \" + name + \", Feature with geometry required\"\n );\n }\n if (!feature.geometry || feature.geometry.type !== type) {\n throw new Error(\n \"Invalid input to \" + name + \": must be a \" + type + \", given \" + feature.geometry.type\n );\n }\n }\n}\nfunction getGeom(geojson) {\n if (geojson.type === \"Feature\") {\n return geojson.geometry;\n }\n return geojson;\n}\nfunction getType(geojson, _name) {\n if (geojson.type === \"FeatureCollection\") {\n return \"FeatureCollection\";\n }\n if (geojson.type === \"GeometryCollection\") {\n return \"GeometryCollection\";\n }\n if (geojson.type === \"Feature\" && geojson.geometry !== null) {\n return geojson.geometry.type;\n }\n return geojson.type;\n}\nexport {\n collectionOf,\n containsNumber,\n featureOf,\n geojsonType,\n getCoord,\n getCoords,\n getGeom,\n getType\n};\n//# sourceMappingURL=index.js.map"],"names":["getCoord","coord"],"mappings":"AAEA,SAASA,EAASC,GAAO;AACvB,MAAI,CAACA;AACH,UAAM,IAAI,MAAM,mBAAmB;AAErC,MAAI,CAAC,MAAM,QAAQA,CAAK,GAAG;AACzB,QAAIA,EAAM,SAAS,aAAaA,EAAM,aAAa,QAAQA,EAAM,SAAS,SAAS;AACjF,aAAO,CAAC,GAAGA,EAAM,SAAS,WAAW;AAEvC,QAAIA,EAAM,SAAS;AACjB,aAAO,CAAC,GAAGA,EAAM,WAAW;AAAA,EAEhC;AACA,MAAI,MAAM,QAAQA,CAAK,KAAKA,EAAM,UAAU,KAAK,CAAC,MAAM,QAAQA,EAAM,CAAC,CAAC,KAAK,CAAC,MAAM,QAAQA,EAAM,CAAC,CAAC;AAClG,WAAO,CAAC,GAAGA,CAAK;AAElB,QAAM,IAAI,MAAM,oDAAoD;AACtE;","x_google_ignoreList":[0]}
@@ -1,10 +1,151 @@
1
- import { bbox as c } from "./index.es69.js";
2
- import { point as p } from "./index.es67.js";
3
- function x(r, o = {}) {
4
- const t = c(r), e = (t[0] + t[2]) / 2, n = (t[1] + t[3]) / 2;
5
- return p([e, n], o.properties, o);
1
+ function b(e, o, f) {
2
+ if (e !== null)
3
+ for (var r, i, a, u, c, t, s, y = 0, l = 0, h, p = e.type, C = p === "FeatureCollection", G = p === "Feature", w = C ? e.features.length : 1, P = 0; P < w; P++) {
4
+ s = C ? e.features[P].geometry : G ? e.geometry : e, h = s ? s.type === "GeometryCollection" : !1, c = h ? s.geometries.length : 1;
5
+ for (var M = 0; M < c; M++) {
6
+ var n = 0, g = 0;
7
+ if (u = h ? s.geometries[M] : s, u !== null) {
8
+ t = u.coordinates;
9
+ var v = u.type;
10
+ switch (y = 0, v) {
11
+ case null:
12
+ break;
13
+ case "Point":
14
+ if (o(
15
+ t,
16
+ l,
17
+ P,
18
+ n,
19
+ g
20
+ ) === !1)
21
+ return !1;
22
+ l++, n++;
23
+ break;
24
+ case "LineString":
25
+ case "MultiPoint":
26
+ for (r = 0; r < t.length; r++) {
27
+ if (o(
28
+ t[r],
29
+ l,
30
+ P,
31
+ n,
32
+ g
33
+ ) === !1)
34
+ return !1;
35
+ l++, v === "MultiPoint" && n++;
36
+ }
37
+ v === "LineString" && n++;
38
+ break;
39
+ case "Polygon":
40
+ case "MultiLineString":
41
+ for (r = 0; r < t.length; r++) {
42
+ for (i = 0; i < t[r].length - y; i++) {
43
+ if (o(
44
+ t[r][i],
45
+ l,
46
+ P,
47
+ n,
48
+ g
49
+ ) === !1)
50
+ return !1;
51
+ l++;
52
+ }
53
+ v === "MultiLineString" && n++, v === "Polygon" && g++;
54
+ }
55
+ v === "Polygon" && n++;
56
+ break;
57
+ case "MultiPolygon":
58
+ for (r = 0; r < t.length; r++) {
59
+ for (g = 0, i = 0; i < t[r].length; i++) {
60
+ for (a = 0; a < t[r][i].length - y; a++) {
61
+ if (o(
62
+ t[r][i][a],
63
+ l,
64
+ P,
65
+ n,
66
+ g
67
+ ) === !1)
68
+ return !1;
69
+ l++;
70
+ }
71
+ g++;
72
+ }
73
+ n++;
74
+ }
75
+ break;
76
+ case "GeometryCollection":
77
+ for (r = 0; r < u.geometries.length; r++)
78
+ if (b(u.geometries[r], o) === !1)
79
+ return !1;
80
+ break;
81
+ default:
82
+ throw new Error("Unknown Geometry Type");
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+ function S(e, o) {
89
+ if (e.type === "Feature")
90
+ o(e, 0);
91
+ else if (e.type === "FeatureCollection")
92
+ for (var f = 0; f < e.features.length && o(e.features[f], f) !== !1; f++)
93
+ ;
94
+ }
95
+ function k(e, o) {
96
+ var f, r, i, a, u, c, t, s, y, l, h = 0, p = e.type === "FeatureCollection", C = e.type === "Feature", G = p ? e.features.length : 1;
97
+ for (f = 0; f < G; f++) {
98
+ for (c = p ? e.features[f].geometry : C ? e.geometry : e, s = p ? e.features[f].properties : C ? e.properties : {}, y = p ? e.features[f].bbox : C ? e.bbox : void 0, l = p ? e.features[f].id : C ? e.id : void 0, t = c ? c.type === "GeometryCollection" : !1, u = t ? c.geometries.length : 1, i = 0; i < u; i++) {
99
+ if (a = t ? c.geometries[i] : c, a === null) {
100
+ if (o(
101
+ null,
102
+ h,
103
+ s,
104
+ y,
105
+ l
106
+ ) === !1)
107
+ return !1;
108
+ continue;
109
+ }
110
+ switch (a.type) {
111
+ case "Point":
112
+ case "LineString":
113
+ case "MultiPoint":
114
+ case "Polygon":
115
+ case "MultiLineString":
116
+ case "MultiPolygon": {
117
+ if (o(
118
+ a,
119
+ h,
120
+ s,
121
+ y,
122
+ l
123
+ ) === !1)
124
+ return !1;
125
+ break;
126
+ }
127
+ case "GeometryCollection": {
128
+ for (r = 0; r < a.geometries.length; r++)
129
+ if (o(
130
+ a.geometries[r],
131
+ h,
132
+ s,
133
+ y,
134
+ l
135
+ ) === !1)
136
+ return !1;
137
+ break;
138
+ }
139
+ default:
140
+ throw new Error("Unknown Geometry Type");
141
+ }
142
+ }
143
+ h++;
144
+ }
6
145
  }
7
146
  export {
8
- x as center
147
+ b as coordEach,
148
+ S as featureEach,
149
+ k as geomEach
9
150
  };
10
151
  //# sourceMappingURL=index.es190.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es190.js","sources":["../node_modules/@turf/center/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport { bbox } from \"@turf/bbox\";\nimport { point } from \"@turf/helpers\";\nfunction center(geojson, options = {}) {\n const ext = bbox(geojson);\n const x = (ext[0] + ext[2]) / 2;\n const y = (ext[1] + ext[3]) / 2;\n return point([x, y], options.properties, options);\n}\nvar turf_center_default = center;\nexport {\n center,\n turf_center_default as default\n};\n//# sourceMappingURL=index.js.map"],"names":["center","geojson","options","ext","bbox","x","y","point"],"mappings":";;AAGA,SAASA,EAAOC,GAASC,IAAU,IAAI;AACrC,QAAMC,IAAMC,EAAKH,CAAO,GAClBI,KAAKF,EAAI,CAAC,IAAIA,EAAI,CAAC,KAAK,GACxBG,KAAKH,EAAI,CAAC,IAAIA,EAAI,CAAC,KAAK;AAC9B,SAAOI,EAAM,CAACF,GAAGC,CAAC,GAAGJ,EAAQ,YAAYA,CAAO;AAClD;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es190.js","sources":["../../../node_modules/@turf/meta/dist/esm/index.js"],"sourcesContent":["// index.js\nimport { feature, point, lineString, isObject } from \"@turf/helpers\";\nfunction coordEach(geojson, callback, excludeWrapCoord) {\n if (geojson === null) return;\n var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === \"FeatureCollection\", isFeature = type === \"Feature\", stop = isFeatureCollection ? geojson.features.length : 1;\n for (var featureIndex = 0; featureIndex < stop; featureIndex++) {\n geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;\n isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === \"GeometryCollection\" : false;\n stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {\n var multiFeatureIndex = 0;\n var geometryIndex = 0;\n geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;\n if (geometry === null) continue;\n coords = geometry.coordinates;\n var geomType = geometry.type;\n wrapShrink = excludeWrapCoord && (geomType === \"Polygon\" || geomType === \"MultiPolygon\") ? 1 : 0;\n switch (geomType) {\n case null:\n break;\n case \"Point\":\n if (callback(\n coords,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n multiFeatureIndex++;\n break;\n case \"LineString\":\n case \"MultiPoint\":\n for (j = 0; j < coords.length; j++) {\n if (callback(\n coords[j],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n if (geomType === \"MultiPoint\") multiFeatureIndex++;\n }\n if (geomType === \"LineString\") multiFeatureIndex++;\n break;\n case \"Polygon\":\n case \"MultiLineString\":\n for (j = 0; j < coords.length; j++) {\n for (k = 0; k < coords[j].length - wrapShrink; k++) {\n if (callback(\n coords[j][k],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n }\n if (geomType === \"MultiLineString\") multiFeatureIndex++;\n if (geomType === \"Polygon\") geometryIndex++;\n }\n if (geomType === \"Polygon\") multiFeatureIndex++;\n break;\n case \"MultiPolygon\":\n for (j = 0; j < coords.length; j++) {\n geometryIndex = 0;\n for (k = 0; k < coords[j].length; k++) {\n for (l = 0; l < coords[j][k].length - wrapShrink; l++) {\n if (callback(\n coords[j][k][l],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n }\n geometryIndex++;\n }\n multiFeatureIndex++;\n }\n break;\n case \"GeometryCollection\":\n for (j = 0; j < geometry.geometries.length; j++)\n if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)\n return false;\n break;\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n }\n}\nfunction coordReduce(geojson, callback, initialValue, excludeWrapCoord) {\n var previousValue = initialValue;\n coordEach(\n geojson,\n function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n if (coordIndex === 0 && initialValue === void 0)\n previousValue = currentCoord;\n else\n previousValue = callback(\n previousValue,\n currentCoord,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n },\n excludeWrapCoord\n );\n return previousValue;\n}\nfunction propEach(geojson, callback) {\n var i;\n switch (geojson.type) {\n case \"FeatureCollection\":\n for (i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i].properties, i) === false) break;\n }\n break;\n case \"Feature\":\n callback(geojson.properties, 0);\n break;\n }\n}\nfunction propReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n propEach(geojson, function(currentProperties, featureIndex) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentProperties;\n else\n previousValue = callback(previousValue, currentProperties, featureIndex);\n });\n return previousValue;\n}\nfunction featureEach(geojson, callback) {\n if (geojson.type === \"Feature\") {\n callback(geojson, 0);\n } else if (geojson.type === \"FeatureCollection\") {\n for (var i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i], i) === false) break;\n }\n }\n}\nfunction featureReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n featureEach(geojson, function(currentFeature, featureIndex) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentFeature;\n else previousValue = callback(previousValue, currentFeature, featureIndex);\n });\n return previousValue;\n}\nfunction coordAll(geojson) {\n var coords = [];\n coordEach(geojson, function(coord) {\n coords.push(coord);\n });\n return coords;\n}\nfunction geomEach(geojson, callback) {\n var i, j, g, geometry, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === \"FeatureCollection\", isFeature = geojson.type === \"Feature\", stop = isFeatureCollection ? geojson.features.length : 1;\n for (i = 0; i < stop; i++) {\n geometryMaybeCollection = isFeatureCollection ? geojson.features[i].geometry : isFeature ? geojson.geometry : geojson;\n featureProperties = isFeatureCollection ? geojson.features[i].properties : isFeature ? geojson.properties : {};\n featureBBox = isFeatureCollection ? geojson.features[i].bbox : isFeature ? geojson.bbox : void 0;\n featureId = isFeatureCollection ? geojson.features[i].id : isFeature ? geojson.id : void 0;\n isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === \"GeometryCollection\" : false;\n stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n for (g = 0; g < stopG; g++) {\n geometry = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;\n if (geometry === null) {\n if (callback(\n null,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false)\n return false;\n continue;\n }\n switch (geometry.type) {\n case \"Point\":\n case \"LineString\":\n case \"MultiPoint\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\": {\n if (callback(\n geometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false)\n return false;\n break;\n }\n case \"GeometryCollection\": {\n for (j = 0; j < geometry.geometries.length; j++) {\n if (callback(\n geometry.geometries[j],\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false)\n return false;\n }\n break;\n }\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n featureIndex++;\n }\n}\nfunction geomReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n geomEach(\n geojson,\n function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentGeometry;\n else\n previousValue = callback(\n previousValue,\n currentGeometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n );\n }\n );\n return previousValue;\n}\nfunction flattenEach(geojson, callback) {\n geomEach(geojson, function(geometry, featureIndex, properties, bbox, id) {\n var type = geometry === null ? null : geometry.type;\n switch (type) {\n case null:\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n if (callback(\n feature(geometry, properties, { bbox, id }),\n featureIndex,\n 0\n ) === false)\n return false;\n return;\n }\n var geomType;\n switch (type) {\n case \"MultiPoint\":\n geomType = \"Point\";\n break;\n case \"MultiLineString\":\n geomType = \"LineString\";\n break;\n case \"MultiPolygon\":\n geomType = \"Polygon\";\n break;\n }\n for (var multiFeatureIndex = 0; multiFeatureIndex < geometry.coordinates.length; multiFeatureIndex++) {\n var coordinate = geometry.coordinates[multiFeatureIndex];\n var geom = {\n type: geomType,\n coordinates: coordinate\n };\n if (callback(feature(geom, properties), featureIndex, multiFeatureIndex) === false)\n return false;\n }\n });\n}\nfunction flattenReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n flattenEach(\n geojson,\n function(currentFeature, featureIndex, multiFeatureIndex) {\n if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)\n previousValue = currentFeature;\n else\n previousValue = callback(\n previousValue,\n currentFeature,\n featureIndex,\n multiFeatureIndex\n );\n }\n );\n return previousValue;\n}\nfunction segmentEach(geojson, callback) {\n flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {\n var segmentIndex = 0;\n if (!feature2.geometry) return;\n var type = feature2.geometry.type;\n if (type === \"Point\" || type === \"MultiPoint\") return;\n var previousCoords;\n var previousFeatureIndex = 0;\n var previousMultiIndex = 0;\n var prevGeomIndex = 0;\n if (coordEach(\n feature2,\n function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {\n if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {\n previousCoords = currentCoord;\n previousFeatureIndex = featureIndex;\n previousMultiIndex = multiPartIndexCoord;\n prevGeomIndex = geometryIndex;\n segmentIndex = 0;\n return;\n }\n var currentSegment = lineString(\n [previousCoords, currentCoord],\n feature2.properties\n );\n if (callback(\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n ) === false)\n return false;\n segmentIndex++;\n previousCoords = currentCoord;\n }\n ) === false)\n return false;\n });\n}\nfunction segmentReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n var started = false;\n segmentEach(\n geojson,\n function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n if (started === false && initialValue === void 0)\n previousValue = currentSegment;\n else\n previousValue = callback(\n previousValue,\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n );\n started = true;\n }\n );\n return previousValue;\n}\nfunction lineEach(geojson, callback) {\n if (!geojson) throw new Error(\"geojson is required\");\n flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {\n if (feature2.geometry === null) return;\n var type = feature2.geometry.type;\n var coords = feature2.geometry.coordinates;\n switch (type) {\n case \"LineString\":\n if (callback(feature2, featureIndex, multiFeatureIndex, 0, 0) === false)\n return false;\n break;\n case \"Polygon\":\n for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) {\n if (callback(\n lineString(coords[geometryIndex], feature2.properties),\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n }\n break;\n }\n });\n}\nfunction lineReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n lineEach(\n geojson,\n function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentLine;\n else\n previousValue = callback(\n previousValue,\n currentLine,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n }\n );\n return previousValue;\n}\nfunction findSegment(geojson, options) {\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var segmentIndex = options.segmentIndex || 0;\n var properties = options.properties;\n var geometry;\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n if (geometry === null) return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n if (segmentIndex < 0) segmentIndex = coords.length + segmentIndex - 1;\n return lineString(\n [coords[segmentIndex], coords[segmentIndex + 1]],\n properties,\n options\n );\n case \"Polygon\":\n if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[geometryIndex].length + segmentIndex - 1;\n return lineString(\n [\n coords[geometryIndex][segmentIndex],\n coords[geometryIndex][segmentIndex + 1]\n ],\n properties,\n options\n );\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;\n return lineString(\n [\n coords[multiFeatureIndex][segmentIndex],\n coords[multiFeatureIndex][segmentIndex + 1]\n ],\n properties,\n options\n );\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;\n return lineString(\n [\n coords[multiFeatureIndex][geometryIndex][segmentIndex],\n coords[multiFeatureIndex][geometryIndex][segmentIndex + 1]\n ],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n}\nfunction findPoint(geojson, options) {\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var coordIndex = options.coordIndex || 0;\n var properties = options.properties;\n var geometry;\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n if (geometry === null) return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n return point(coords, properties, options);\n case \"MultiPoint\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n return point(coords[multiFeatureIndex], properties, options);\n case \"LineString\":\n if (coordIndex < 0) coordIndex = coords.length + coordIndex;\n return point(coords[coordIndex], properties, options);\n case \"Polygon\":\n if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n if (coordIndex < 0)\n coordIndex = coords[geometryIndex].length + coordIndex;\n return point(coords[geometryIndex][coordIndex], properties, options);\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (coordIndex < 0)\n coordIndex = coords[multiFeatureIndex].length + coordIndex;\n return point(coords[multiFeatureIndex][coordIndex], properties, options);\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (coordIndex < 0)\n coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex;\n return point(\n coords[multiFeatureIndex][geometryIndex][coordIndex],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n}\nexport {\n coordAll,\n coordEach,\n coordReduce,\n featureEach,\n featureReduce,\n findPoint,\n findSegment,\n flattenEach,\n flattenReduce,\n geomEach,\n geomReduce,\n lineEach,\n lineReduce,\n propEach,\n propReduce,\n segmentEach,\n segmentReduce\n};\n//# sourceMappingURL=index.js.map"],"names":["coordEach","geojson","callback","excludeWrapCoord","j","k","l","geometry","stopG","coords","geometryMaybeCollection","wrapShrink","coordIndex","isGeometryCollection","type","isFeatureCollection","isFeature","stop","featureIndex","geomIndex","multiFeatureIndex","geometryIndex","geomType","featureEach","i","geomEach","g","featureProperties","featureBBox","featureId"],"mappings":"AAEA,SAASA,EAAUC,GAASC,GAAUC,GAAkB;AACtD,MAAIF,MAAY;AAEhB,aADIG,GAAGC,GAAGC,GAAGC,GAAUC,GAAOC,GAAQC,G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