@map-colonies/mc-utils 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +67 -67
  2. package/dist/arrays/index.d.ts +1 -1
  3. package/dist/arrays/index.d.ts.map +0 -0
  4. package/dist/arrays/index.js +17 -17
  5. package/dist/arrays/index.js.map +0 -0
  6. package/dist/arrays/subGroups.d.ts +8 -8
  7. package/dist/arrays/subGroups.d.ts.map +0 -0
  8. package/dist/arrays/subGroups.js +33 -138
  9. package/dist/arrays/subGroups.js.map +1 -1
  10. package/dist/communication/http/httpClient.d.ts +29 -29
  11. package/dist/communication/http/httpClient.d.ts.map +0 -0
  12. package/dist/communication/http/httpClient.js +317 -434
  13. package/dist/communication/http/httpClient.js.map +1 -1
  14. package/dist/communication/http/index.d.ts +1 -1
  15. package/dist/communication/http/index.d.ts.map +0 -0
  16. package/dist/communication/http/index.js +17 -17
  17. package/dist/communication/http/index.js.map +0 -0
  18. package/dist/communication/index.d.ts +1 -1
  19. package/dist/communication/index.d.ts.map +0 -0
  20. package/dist/communication/index.js +17 -17
  21. package/dist/communication/index.js.map +0 -0
  22. package/dist/dateTime/getUTCDate.d.ts +1 -1
  23. package/dist/dateTime/getUTCDate.d.ts.map +0 -0
  24. package/dist/dateTime/getUTCDate.js +10 -10
  25. package/dist/dateTime/getUTCDate.js.map +1 -1
  26. package/dist/dateTime/index.d.ts +1 -1
  27. package/dist/dateTime/index.d.ts.map +0 -0
  28. package/dist/dateTime/index.js +17 -17
  29. package/dist/dateTime/index.js.map +0 -0
  30. package/dist/geo/bboxUtils.d.ts +23 -23
  31. package/dist/geo/bboxUtils.d.ts.map +0 -0
  32. package/dist/geo/bboxUtils.js +89 -89
  33. package/dist/geo/bboxUtils.js.map +1 -1
  34. package/dist/geo/geoConvertor.d.ts +18 -18
  35. package/dist/geo/geoConvertor.d.ts.map +0 -0
  36. package/dist/geo/geoConvertor.js +49 -51
  37. package/dist/geo/geoConvertor.js.map +1 -1
  38. package/dist/geo/geoHash.d.ts +24 -24
  39. package/dist/geo/geoHash.d.ts.map +0 -0
  40. package/dist/geo/geoHash.js +134 -274
  41. package/dist/geo/geoHash.js.map +1 -1
  42. package/dist/geo/geoIntersection.d.ts +19 -19
  43. package/dist/geo/geoIntersection.d.ts.map +0 -0
  44. package/dist/geo/geoIntersection.js +70 -70
  45. package/dist/geo/geoIntersection.js.map +1 -1
  46. package/dist/geo/index.d.ts +8 -8
  47. package/dist/geo/index.d.ts.map +0 -0
  48. package/dist/geo/index.js +24 -24
  49. package/dist/geo/index.js.map +0 -0
  50. package/dist/geo/tileBatcher.d.ts +8 -8
  51. package/dist/geo/tileBatcher.d.ts.map +0 -0
  52. package/dist/geo/tileBatcher.js +97 -193
  53. package/dist/geo/tileBatcher.js.map +1 -1
  54. package/dist/geo/tileRanger.d.ts +46 -46
  55. package/dist/geo/tileRanger.d.ts.map +0 -0
  56. package/dist/geo/tileRanger.js +232 -383
  57. package/dist/geo/tileRanger.js.map +1 -1
  58. package/dist/geo/tiles.d.ts +82 -82
  59. package/dist/geo/tiles.d.ts.map +0 -0
  60. package/dist/geo/tiles.js +219 -246
  61. package/dist/geo/tiles.js.map +1 -1
  62. package/dist/geo/tilesGenerator.d.ts +2 -2
  63. package/dist/geo/tilesGenerator.d.ts.map +0 -0
  64. package/dist/geo/tilesGenerator.js +17 -111
  65. package/dist/geo/tilesGenerator.js.map +1 -1
  66. package/dist/index.d.ts +6 -5
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +22 -21
  69. package/dist/index.js.map +1 -1
  70. package/dist/models/enums/gdal/dataType.d.ts +16 -16
  71. package/dist/models/enums/gdal/dataType.d.ts.map +0 -0
  72. package/dist/models/enums/gdal/dataType.js +20 -20
  73. package/dist/models/enums/gdal/dataType.js.map +0 -0
  74. package/dist/models/enums/gdal/index.d.ts +2 -2
  75. package/dist/models/enums/gdal/index.d.ts.map +0 -0
  76. package/dist/models/enums/gdal/index.js +18 -18
  77. package/dist/models/enums/gdal/index.js.map +0 -0
  78. package/dist/models/enums/gdal/resamplingMethod.d.ts +16 -16
  79. package/dist/models/enums/gdal/resamplingMethod.d.ts.map +0 -0
  80. package/dist/models/enums/gdal/resamplingMethod.js +20 -20
  81. package/dist/models/enums/gdal/resamplingMethod.js.map +0 -0
  82. package/dist/models/enums/geo/index.d.ts +1 -1
  83. package/dist/models/enums/geo/index.d.ts.map +0 -0
  84. package/dist/models/enums/geo/index.js +17 -17
  85. package/dist/models/enums/geo/index.js.map +0 -0
  86. package/dist/models/enums/geo/tileOrigin.d.ts +7 -7
  87. package/dist/models/enums/geo/tileOrigin.d.ts.map +0 -0
  88. package/dist/models/enums/geo/tileOrigin.js +11 -11
  89. package/dist/models/enums/geo/tileOrigin.js.map +0 -0
  90. package/dist/models/enums/index.d.ts +2 -2
  91. package/dist/models/enums/index.d.ts.map +0 -0
  92. package/dist/models/enums/index.js +18 -18
  93. package/dist/models/enums/index.js.map +0 -0
  94. package/dist/models/index.d.ts +2 -2
  95. package/dist/models/index.d.ts.map +0 -0
  96. package/dist/models/index.js +18 -18
  97. package/dist/models/index.js.map +0 -0
  98. package/dist/models/interfaces/geo/iPoint.d.ts +7 -7
  99. package/dist/models/interfaces/geo/iPoint.d.ts.map +0 -0
  100. package/dist/models/interfaces/geo/iPoint.js +2 -2
  101. package/dist/models/interfaces/geo/iPoint.js.map +0 -0
  102. package/dist/models/interfaces/geo/iTile.d.ts +15 -15
  103. package/dist/models/interfaces/geo/iTile.d.ts.map +0 -0
  104. package/dist/models/interfaces/geo/iTile.js +2 -2
  105. package/dist/models/interfaces/geo/iTile.js.map +0 -0
  106. package/dist/models/interfaces/geo/index.d.ts +2 -2
  107. package/dist/models/interfaces/geo/index.d.ts.map +0 -0
  108. package/dist/models/interfaces/geo/index.js +18 -18
  109. package/dist/models/interfaces/geo/index.js.map +0 -0
  110. package/dist/models/interfaces/index.d.ts +1 -1
  111. package/dist/models/interfaces/index.d.ts.map +0 -0
  112. package/dist/models/interfaces/index.js +17 -17
  113. package/dist/models/interfaces/index.js.map +0 -0
  114. package/dist/utils/index.d.ts +2 -0
  115. package/dist/utils/index.d.ts.map +1 -0
  116. package/dist/utils/index.js +18 -0
  117. package/dist/utils/index.js.map +1 -0
  118. package/dist/utils/timeout.d.ts +4 -1
  119. package/dist/utils/timeout.d.ts.map +1 -1
  120. package/dist/utils/timeout.js +22 -47
  121. package/dist/utils/timeout.js.map +1 -1
  122. package/package.json +79 -79
@@ -1 +1 @@
1
- {"version":3,"file":"geoConvertor.js","sourceRoot":"","sources":["../../src/geo/geoConvertor.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAG5D,iCAAyC;AAEzC;;;;;;GAMG;AACI,IAAM,aAAa,GAAG,UAAC,KAAa,EAAE,SAAiB,EAAE,MAA0C;IAA1C,uBAAA,EAAA,SAAqB,uBAAU,CAAC,UAAU;IACxG,IAAM,UAAU,GAAG,IAAA,sBAAc,EAAC,SAAS,CAAC,CAAC;IAC7C,IAAI,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC;IACzB,IAAI,MAAM,KAAK,uBAAU,CAAC,UAAU,EAAE;QACpC,GAAG,GAAG,CAAC,GAAG,CAAC;KACZ;IAED,IAAM,KAAK,GAAG,KAAK,CAAC,SAAS,GAAG,UAAU,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC;IAC9D,+DAA+D;IAC/D,IAAM,KAAK,GAAG,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC;IAElG,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QACpB,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QACpB,IAAI,EAAE,SAAS;KACh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,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC;IAElG,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QACpB,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QACpB,IAAI,EAAE,SAAS;KAChB,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,aAAa,iBAgBxB;AAEF;;;;;GAKG;AACI,MAAM,aAAa,GAAG,CAAC,IAAW,EAAE,SAAqB,uBAAU,CAAC,UAAU,EAAU,EAAE;IAC/F,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,MAAM,UAAU,GAAG,IAAA,sBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,UAAU,GAAG,MAAM,CAAC;IACzC,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,UAAU,GAAG,MAAM,CAAC;IAEvC,IAAI,MAAM,KAAK,uBAAU,CAAC,UAAU,EAAE;QACpC,GAAG,GAAG,CAAC,GAAG,CAAC;KACZ;IAED,OAAO;QACL,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,GAAG;KACf,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,aAAa,iBAexB"}
@@ -1,25 +1,25 @@
1
- import { Feature, MultiPolygon, Polygon } from '@turf/turf';
2
- import { BBox2d } from '@turf/helpers/dist/js/lib/geojson';
3
- import { ITile } from '../models/interfaces/geo/iTile';
4
- import { TileOrigin } from '../models/enums/geo/tileOrigin';
5
- /**
6
- * converts geohash string to its bbox in wgs84 degrees
7
- * @param geohash geohash string
8
- * @returns bbox of the supplied geohash
9
- */
10
- export declare const decodeGeoHash: (geohash: string) => BBox2d;
11
- /**
12
- * generates optimized geohash iterator for given polygon and target zoom level
13
- * @param polygon polygon to cover with geohashes
14
- * @param maxTileZoom target zoom level
15
- * @returns generator that yields the matching geohashes
16
- */
17
- export declare const createGeoHashGenerator: (polygon: Polygon | Feature<Polygon | MultiPolygon>, maxTileZoom?: number) => Generator<string>;
18
- /**
19
- * generate all tiles in supplied polygon
20
- * @param polygon polygon to cover with tiles
21
- * @param tileZoom target tiles zoom level
22
- * @param origin target tiles grid origin location (default ll)
23
- */
24
- export declare function tileGenerator(polygon: Polygon | Feature<Polygon | MultiPolygon>, tileZoom: number, origin?: TileOrigin): AsyncGenerator<ITile>;
1
+ import { Feature, MultiPolygon, Polygon } from '@turf/turf';
2
+ import { BBox2d } from '@turf/helpers/dist/js/lib/geojson';
3
+ import { ITile } from '../models/interfaces/geo/iTile';
4
+ import { TileOrigin } from '../models/enums/geo/tileOrigin';
5
+ /**
6
+ * converts geohash string to its bbox in wgs84 degrees
7
+ * @param geohash geohash string
8
+ * @returns bbox of the supplied geohash
9
+ */
10
+ export declare const decodeGeoHash: (geohash: string) => BBox2d;
11
+ /**
12
+ * generates optimized geohash iterator for given polygon and target zoom level
13
+ * @param polygon polygon to cover with geohashes
14
+ * @param maxTileZoom target zoom level
15
+ * @returns generator that yields the matching geohashes
16
+ */
17
+ export declare const createGeoHashGenerator: (polygon: Polygon | Feature<Polygon | MultiPolygon>, maxTileZoom?: number) => Generator<string>;
18
+ /**
19
+ * generate all tiles in supplied polygon
20
+ * @param polygon polygon to cover with tiles
21
+ * @param tileZoom target tiles zoom level
22
+ * @param origin target tiles grid origin location (default ll)
23
+ */
24
+ export declare function tileGenerator(polygon: Polygon | Feature<Polygon | MultiPolygon>, tileZoom: number, origin?: TileOrigin): AsyncGenerator<ITile>;
25
25
  //# sourceMappingURL=geoHash.d.ts.map
File without changes
@@ -1,275 +1,135 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __generator = (this && this.__generator) || function (thisArg, body) {
26
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
27
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
- function verb(n) { return function (v) { return step([n, v]); }; }
29
- function step(op) {
30
- if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
32
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
- if (y = 0, t) op = [op[0] & 2, t.value];
34
- switch (op[0]) {
35
- case 0: case 1: t = op; break;
36
- case 4: _.label++; return { value: op[1], done: false };
37
- case 5: _.label++; y = op[1]; op = [0]; continue;
38
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
- default:
40
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
- if (t[2]) _.ops.pop();
45
- _.trys.pop(); continue;
46
- }
47
- op = body.call(thisArg, _);
48
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
- }
51
- };
52
- var __asyncValues = (this && this.__asyncValues) || function (o) {
53
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
54
- var m = o[Symbol.asyncIterator], i;
55
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
56
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
57
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
58
- };
59
- var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
60
- var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
61
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
62
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
63
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
64
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
65
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
66
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
67
- function fulfill(value) { resume("next", value); }
68
- function reject(value) { resume("throw", value); }
69
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
70
- };
71
- var __values = (this && this.__values) || function(o) {
72
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
73
- if (m) return m.call(o);
74
- if (o && typeof o.length === "number") return {
75
- next: function () {
76
- if (o && i >= o.length) o = void 0;
77
- return { value: o && o[i++], done: !o };
78
- }
79
- };
80
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
81
- };
82
- Object.defineProperty(exports, "__esModule", { value: true });
83
- exports.tileGenerator = exports.createGeoHashGenerator = exports.decodeGeoHash = void 0;
84
- var turf_1 = require("@turf/turf");
85
- var ngeohash = __importStar(require("ngeohash"));
86
- var tileOrigin_1 = require("../models/enums/geo/tileOrigin");
87
- var geoConvertor_1 = require("./geoConvertor");
88
- var bboxUtils_1 = require("./bboxUtils");
89
- var MAX_STANDARD_ZOOM = 21;
90
- var bboxIntersection = function (bbox1, bbox2) {
91
- var minLon = Math.max(bbox1[0], bbox2[0]);
92
- var minLat = Math.max(bbox1[1], bbox2[1]);
93
- var maxLon = Math.min(bbox1[2], bbox2[2]);
94
- var maxLat = Math.min(bbox1[3], bbox2[3]);
95
- return [minLon, minLat, maxLon, maxLat];
96
- };
97
- var isSubHash = function (hash, parent) {
98
- return hash.startsWith(parent);
99
- };
100
- function geoHash(precision, maxPrecision, polygon, bbox, parentHash) {
101
- var hashes, hashes_1, hashes_1_1, hash, hashBbox, hashPoly, intersection, intArea, hashArea, subBbox, e_1_1;
102
- var e_1, _a;
103
- if (parentHash === void 0) { parentHash = ''; }
104
- return __generator(this, function (_b) {
105
- switch (_b.label) {
106
- case 0:
107
- hashes = ngeohash.bboxes(bbox[1], bbox[0], bbox[3], bbox[2], precision);
108
- if (!(hashes.length > 0)) return [3 /*break*/, 10];
109
- _b.label = 1;
110
- case 1:
111
- _b.trys.push([1, 8, 9, 10]);
112
- hashes_1 = __values(hashes), hashes_1_1 = hashes_1.next();
113
- _b.label = 2;
114
- case 2:
115
- if (!!hashes_1_1.done) return [3 /*break*/, 7];
116
- hash = hashes_1_1.value;
117
- hashBbox = (0, exports.decodeGeoHash)(hash);
118
- hashPoly = (0, turf_1.bboxPolygon)(hashBbox);
119
- intersection = (0, turf_1.intersect)(polygon, hashPoly);
120
- if (intersection === null || !isSubHash(hash, parentHash)) {
121
- return [3 /*break*/, 6];
122
- }
123
- intArea = (0, turf_1.area)(intersection);
124
- hashArea = (0, turf_1.area)(hashPoly);
125
- if (!(intArea == hashArea || precision == maxPrecision)) return [3 /*break*/, 4];
126
- return [4 /*yield*/, hash];
127
- case 3:
128
- _b.sent();
129
- return [3 /*break*/, 6];
130
- case 4:
131
- subBbox = bboxIntersection(hashBbox, bbox);
132
- return [5 /*yield**/, __values(geoHash(precision + 1, maxPrecision, polygon, subBbox, hash))];
133
- case 5:
134
- _b.sent();
135
- _b.label = 6;
136
- case 6:
137
- hashes_1_1 = hashes_1.next();
138
- return [3 /*break*/, 2];
139
- case 7: return [3 /*break*/, 10];
140
- case 8:
141
- e_1_1 = _b.sent();
142
- e_1 = { error: e_1_1 };
143
- return [3 /*break*/, 10];
144
- case 9:
145
- try {
146
- if (hashes_1_1 && !hashes_1_1.done && (_a = hashes_1.return)) _a.call(hashes_1);
147
- }
148
- finally { if (e_1) throw e_1.error; }
149
- return [7 /*endfinally*/];
150
- case 10: return [2 /*return*/];
151
- }
152
- });
153
- }
154
- /**
155
- * converts geohash string to its bbox in wgs84 degrees
156
- * @param geohash geohash string
157
- * @returns bbox of the supplied geohash
158
- */
159
- var decodeGeoHash = function (geohash) {
160
- var bboxFromGeohash = ngeohash.decode_bbox(geohash);
161
- // ngeohash.decode_bbox gives a lat-lon array. we change it to lon-lat so @turf can use it.
162
- var lonLatBbox = [bboxFromGeohash[1], bboxFromGeohash[0], bboxFromGeohash[3], bboxFromGeohash[2]];
163
- return lonLatBbox;
164
- };
165
- exports.decodeGeoHash = decodeGeoHash;
166
- /**
167
- * generates optimized geohash iterator for given polygon and target zoom level
168
- * @param polygon polygon to cover with geohashes
169
- * @param maxTileZoom target zoom level
170
- * @returns generator that yields the matching geohashes
171
- */
172
- var createGeoHashGenerator = function (polygon, maxTileZoom) {
173
- if (maxTileZoom === void 0) { maxTileZoom = MAX_STANDARD_ZOOM; }
174
- var bbox = (0, turf_1.bbox)(polygon);
175
- bbox = (0, bboxUtils_1.snapBBoxToTileGrid)(bbox, maxTileZoom);
176
- //at this precision ea geo hash is a tile or smaller
177
- /* eslint-disable @typescript-eslint/no-magic-numbers */
178
- var zoomPrecision = Math.floor((2 / 5) * (maxTileZoom + 1));
179
- var precisionMod = maxTileZoom % 5;
180
- if (precisionMod > 0 && precisionMod <= 3) {
181
- zoomPrecision++;
182
- }
183
- else if (precisionMod > 3) {
184
- zoomPrecision += 2;
185
- }
186
- /* eslint-enable @typescript-eslint/no-magic-numbers */
187
- return geoHash(1, zoomPrecision, polygon, bbox);
188
- };
189
- exports.createGeoHashGenerator = createGeoHashGenerator;
190
- /**
191
- * generate all tiles in supplied polygon
192
- * @param polygon polygon to cover with tiles
193
- * @param tileZoom target tiles zoom level
194
- * @param origin target tiles grid origin location (default ll)
195
- */
196
- function tileGenerator(polygon, tileZoom, origin) {
197
- if (origin === void 0) { origin = tileOrigin_1.TileOrigin.LOWER_LEFT; }
198
- return __asyncGenerator(this, arguments, function tileGenerator_1() {
199
- var hashGen, hashGen_1, hashGen_1_1, hash, bbox, minTile, maxTile, minX, maxX, minY, maxY, x, y, e_2_1;
200
- var e_2, _a;
201
- return __generator(this, function (_b) {
202
- switch (_b.label) {
203
- case 0:
204
- hashGen = (0, exports.createGeoHashGenerator)(polygon, tileZoom);
205
- _b.label = 1;
206
- case 1:
207
- _b.trys.push([1, 13, 14, 19]);
208
- hashGen_1 = __asyncValues(hashGen);
209
- _b.label = 2;
210
- case 2: return [4 /*yield*/, __await(hashGen_1.next())];
211
- case 3:
212
- if (!(hashGen_1_1 = _b.sent(), !hashGen_1_1.done)) return [3 /*break*/, 12];
213
- hash = hashGen_1_1.value;
214
- bbox = (0, exports.decodeGeoHash)(hash);
215
- minTile = (0, geoConvertor_1.degreesToTile)({
216
- longitude: bbox[0],
217
- latitude: bbox[1],
218
- }, tileZoom, origin);
219
- maxTile = (0, geoConvertor_1.degreesToTile)({
220
- longitude: bbox[2],
221
- latitude: bbox[3],
222
- }, tileZoom, origin);
223
- minX = Math.min(minTile.x, maxTile.x);
224
- maxX = minTile.x + maxTile.x - minX;
225
- minY = Math.min(minTile.y, maxTile.y);
226
- maxY = minTile.y + maxTile.y - minY;
227
- x = minX;
228
- _b.label = 4;
229
- case 4:
230
- if (!(x < maxX)) return [3 /*break*/, 11];
231
- y = minY;
232
- _b.label = 5;
233
- case 5:
234
- if (!(y < maxY)) return [3 /*break*/, 10];
235
- return [4 /*yield*/, __await(Promise.resolve({
236
- x: x,
237
- y: y,
238
- zoom: tileZoom,
239
- }))];
240
- case 6: return [4 /*yield*/, __await.apply(void 0, [_b.sent()])];
241
- case 7: return [4 /*yield*/, _b.sent()];
242
- case 8:
243
- _b.sent();
244
- _b.label = 9;
245
- case 9:
246
- y++;
247
- return [3 /*break*/, 5];
248
- case 10:
249
- x++;
250
- return [3 /*break*/, 4];
251
- case 11: return [3 /*break*/, 2];
252
- case 12: return [3 /*break*/, 19];
253
- case 13:
254
- e_2_1 = _b.sent();
255
- e_2 = { error: e_2_1 };
256
- return [3 /*break*/, 19];
257
- case 14:
258
- _b.trys.push([14, , 17, 18]);
259
- if (!(hashGen_1_1 && !hashGen_1_1.done && (_a = hashGen_1.return))) return [3 /*break*/, 16];
260
- return [4 /*yield*/, __await(_a.call(hashGen_1))];
261
- case 15:
262
- _b.sent();
263
- _b.label = 16;
264
- case 16: return [3 /*break*/, 18];
265
- case 17:
266
- if (e_2) throw e_2.error;
267
- return [7 /*endfinally*/];
268
- case 18: return [7 /*endfinally*/];
269
- case 19: return [2 /*return*/];
270
- }
271
- });
272
- });
273
- }
274
- exports.tileGenerator = tileGenerator;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.tileGenerator = exports.createGeoHashGenerator = exports.decodeGeoHash = void 0;
27
+ const turf_1 = require("@turf/turf");
28
+ const ngeohash = __importStar(require("ngeohash"));
29
+ const tileOrigin_1 = require("../models/enums/geo/tileOrigin");
30
+ const geoConvertor_1 = require("./geoConvertor");
31
+ const bboxUtils_1 = require("./bboxUtils");
32
+ const MAX_STANDARD_ZOOM = 21;
33
+ const bboxIntersection = (bbox1, bbox2) => {
34
+ const minLon = Math.max(bbox1[0], bbox2[0]);
35
+ const minLat = Math.max(bbox1[1], bbox2[1]);
36
+ const maxLon = Math.min(bbox1[2], bbox2[2]);
37
+ const maxLat = Math.min(bbox1[3], bbox2[3]);
38
+ return [minLon, minLat, maxLon, maxLat];
39
+ };
40
+ const isSubHash = (hash, parent) => {
41
+ return hash.startsWith(parent);
42
+ };
43
+ function* geoHash(precision, maxPrecision, polygon, bbox, parentHash = '') {
44
+ // ngeohash bbox is a lat-lon array. we change turf bbox to it so it can be used.
45
+ const hashes = ngeohash.bboxes(bbox[1], bbox[0], bbox[3], bbox[2], precision);
46
+ if (hashes.length > 0) {
47
+ for (const hash of hashes) {
48
+ const hashBbox = (0, exports.decodeGeoHash)(hash);
49
+ const hashPoly = (0, turf_1.bboxPolygon)(hashBbox);
50
+ const intersection = (0, turf_1.intersect)(polygon, hashPoly);
51
+ if (intersection === null || !isSubHash(hash, parentHash)) {
52
+ continue;
53
+ }
54
+ const intArea = (0, turf_1.area)(intersection);
55
+ const hashArea = (0, turf_1.area)(hashPoly);
56
+ if (intArea == hashArea || precision == maxPrecision) {
57
+ yield hash;
58
+ }
59
+ else {
60
+ const subBbox = bboxIntersection(hashBbox, bbox);
61
+ yield* geoHash(precision + 1, maxPrecision, polygon, subBbox, hash);
62
+ }
63
+ }
64
+ }
65
+ }
66
+ /**
67
+ * converts geohash string to its bbox in wgs84 degrees
68
+ * @param geohash geohash string
69
+ * @returns bbox of the supplied geohash
70
+ */
71
+ const decodeGeoHash = (geohash) => {
72
+ const bboxFromGeohash = ngeohash.decode_bbox(geohash);
73
+ // ngeohash.decode_bbox gives a lat-lon array. we change it to lon-lat so @turf can use it.
74
+ const lonLatBbox = [bboxFromGeohash[1], bboxFromGeohash[0], bboxFromGeohash[3], bboxFromGeohash[2]];
75
+ return lonLatBbox;
76
+ };
77
+ exports.decodeGeoHash = decodeGeoHash;
78
+ /**
79
+ * generates optimized geohash iterator for given polygon and target zoom level
80
+ * @param polygon polygon to cover with geohashes
81
+ * @param maxTileZoom target zoom level
82
+ * @returns generator that yields the matching geohashes
83
+ */
84
+ const createGeoHashGenerator = (polygon, maxTileZoom = MAX_STANDARD_ZOOM) => {
85
+ let bbox = (0, turf_1.bbox)(polygon);
86
+ bbox = (0, bboxUtils_1.snapBBoxToTileGrid)(bbox, maxTileZoom);
87
+ //at this precision ea geo hash is a tile or smaller
88
+ /* eslint-disable @typescript-eslint/no-magic-numbers */
89
+ let zoomPrecision = Math.floor((2 / 5) * (maxTileZoom + 1));
90
+ const precisionMod = maxTileZoom % 5;
91
+ if (precisionMod > 0 && precisionMod <= 3) {
92
+ zoomPrecision++;
93
+ }
94
+ else if (precisionMod > 3) {
95
+ zoomPrecision += 2;
96
+ }
97
+ /* eslint-enable @typescript-eslint/no-magic-numbers */
98
+ return geoHash(1, zoomPrecision, polygon, bbox);
99
+ };
100
+ exports.createGeoHashGenerator = createGeoHashGenerator;
101
+ /**
102
+ * generate all tiles in supplied polygon
103
+ * @param polygon polygon to cover with tiles
104
+ * @param tileZoom target tiles zoom level
105
+ * @param origin target tiles grid origin location (default ll)
106
+ */
107
+ async function* tileGenerator(polygon, tileZoom, origin = tileOrigin_1.TileOrigin.LOWER_LEFT) {
108
+ const hashGen = (0, exports.createGeoHashGenerator)(polygon, tileZoom);
109
+ for await (const hash of hashGen) {
110
+ const bbox = (0, exports.decodeGeoHash)(hash);
111
+ const minTile = (0, geoConvertor_1.degreesToTile)({
112
+ longitude: bbox[0],
113
+ latitude: bbox[1],
114
+ }, tileZoom, origin);
115
+ const maxTile = (0, geoConvertor_1.degreesToTile)({
116
+ longitude: bbox[2],
117
+ latitude: bbox[3],
118
+ }, tileZoom, origin);
119
+ const minX = Math.min(minTile.x, maxTile.x);
120
+ const maxX = minTile.x + maxTile.x - minX;
121
+ const minY = Math.min(minTile.y, maxTile.y);
122
+ const maxY = minTile.y + maxTile.y - minY;
123
+ for (let x = minX; x < maxX; x++) {
124
+ for (let y = minY; y < maxY; y++) {
125
+ yield await Promise.resolve({
126
+ x,
127
+ y,
128
+ zoom: tileZoom,
129
+ });
130
+ }
131
+ }
132
+ }
133
+ }
134
+ exports.tileGenerator = tileGenerator;
275
135
  //# sourceMappingURL=geoHash.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geoHash.js","sourceRoot":"","sources":["../../src/geo/geoHash.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;QAE1C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;QAC1C,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAChC,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAChC,MAAM,MAAM,OAAO,CAAC,OAAO,CAAC;oBAC1B,CAAC;oBACD,CAAC;oBACD,IAAI,EAAE,QAAQ;iBACf,CAAC,CAAC;aACJ;SACF;KACF;AACH,CAAC;AAvCD,sCAuCC"}
@@ -1,20 +1,20 @@
1
- import { Feature, FeatureCollection, MultiPolygon, Polygon } from '@turf/turf';
2
- /**
3
- * tuft intersect supported footprint types
4
- */
5
- declare type Footprint = Polygon | MultiPolygon | Feature<Polygon | MultiPolygon>;
6
- /**
7
- * return the intersection footprint of all specified footprints or null when there is no intersection
8
- * @param footprints footprint list to intersect
9
- * @returns intersection footprint or null
10
- */
11
- declare const multiIntersect: (footprints: Footprint[]) => Footprint | null;
12
- /**
13
- * indicates if 2 object of type FeatureCollection are equal by validating properties and features array (order not important)
14
- * @param fc1 first featureCollection to compare equal
15
- * @param fc2 second featureCollection to compare equal
16
- * @returns true if same featureCollection, false if not
17
- */
18
- declare const featureCollectionBooleanEqual: (fc1: FeatureCollection, fc2: FeatureCollection) => boolean;
19
- export { multiIntersect, featureCollectionBooleanEqual, Footprint };
1
+ import { Feature, FeatureCollection, MultiPolygon, Polygon } from '@turf/turf';
2
+ /**
3
+ * tuft intersect supported footprint types
4
+ */
5
+ declare type Footprint = Polygon | MultiPolygon | Feature<Polygon | MultiPolygon>;
6
+ /**
7
+ * return the intersection footprint of all specified footprints or null when there is no intersection
8
+ * @param footprints footprint list to intersect
9
+ * @returns intersection footprint or null
10
+ */
11
+ declare const multiIntersect: (footprints: Footprint[]) => Footprint | null;
12
+ /**
13
+ * indicates if 2 object of type FeatureCollection are equal by validating properties and features array (order not important)
14
+ * @param fc1 first featureCollection to compare equal
15
+ * @param fc2 second featureCollection to compare equal
16
+ * @returns true if same featureCollection, false if not
17
+ */
18
+ declare const featureCollectionBooleanEqual: (fc1: FeatureCollection, fc2: FeatureCollection) => boolean;
19
+ export { multiIntersect, featureCollectionBooleanEqual, Footprint };
20
20
  //# sourceMappingURL=geoIntersection.d.ts.map
File without changes