@dra2020/baseclient 1.0.90 → 1.0.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseclient.js +19 -1
- package/dist/baseclient.js.map +1 -1
- package/dist/geo/geo.d.ts +1 -0
- package/lib/geo/geo.ts +22 -0
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -2347,9 +2347,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
2347
2347
|
return result;
|
|
2348
2348
|
};
|
|
2349
2349
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2350
|
-
exports.geoIntersect = exports.geoIntersectOptions = exports.GeoMultiCollection = exports.geoMapEqual = exports.geoEqual = exports.geoTopoToCollectionNonNull = exports.geoTopoToCollection = exports.geoCollectionToTopoNonNull = exports.geoCollectionToTopo = exports.geoMapToCollectionNonNull = exports.geoMapToCollection = exports.geoCollectionToMap = exports.geoNormalizeCollection = exports.geoNormalizeFeature = exports.geoEnsureID = void 0;
|
|
2350
|
+
exports.geoIntersect = exports.geoIntersectOptions = exports.GeoMultiCollection = exports.geoMapEqual = exports.geoEqual = exports.geoTopoToCollectionNonNull = exports.geoTopoToCollection = exports.geoCollectionToTopoNonNull = exports.geoCollectionToTopo = exports.geoMapToCollectionNonNull = exports.geoMapToCollection = exports.geoCollectionToMap = exports.geoNormalizeCollection = exports.geoNormalizeFeature = exports.geoEnsureID = exports.dumpMetrics = void 0;
|
|
2351
2351
|
const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
|
|
2352
2352
|
const Poly = __importStar(__webpack_require__(/*! ../poly/all */ "./lib/poly/all.ts"));
|
|
2353
|
+
// Tracing/debugging aid
|
|
2354
|
+
let metrics = {};
|
|
2355
|
+
function record(action, total) {
|
|
2356
|
+
if (metrics[action] === undefined)
|
|
2357
|
+
metrics[action] = { count: 0, total: 0 };
|
|
2358
|
+
metrics[action].count++;
|
|
2359
|
+
metrics[action].total += total;
|
|
2360
|
+
}
|
|
2361
|
+
function dumpMetrics() {
|
|
2362
|
+
Object.keys(metrics).forEach(action => {
|
|
2363
|
+
console.log(`G.${action}: count: ${metrics[action].count}, total: ${metrics[action].total}`);
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
exports.dumpMetrics = dumpMetrics;
|
|
2353
2367
|
const NormalizeAll = { joinPolygons: true, checkRewind: true, ensureID: true };
|
|
2354
2368
|
// set the canonical 'id' property from the best property value.
|
|
2355
2369
|
// if joinPolygons is true, we do not enforce uniqueness.
|
|
@@ -2443,6 +2457,7 @@ exports.geoNormalizeCollection = geoNormalizeCollection;
|
|
|
2443
2457
|
function geoCollectionToMap(col) {
|
|
2444
2458
|
if (col == null)
|
|
2445
2459
|
return null;
|
|
2460
|
+
record('coltomap', col.features.length);
|
|
2446
2461
|
let map = {};
|
|
2447
2462
|
col.features.forEach((f) => { map[String(f.properties.id)] = f; });
|
|
2448
2463
|
return map;
|
|
@@ -2459,12 +2474,14 @@ function geoMapToCollectionNonNull(map) {
|
|
|
2459
2474
|
return null;
|
|
2460
2475
|
let col = { type: 'FeatureCollection', features: [] };
|
|
2461
2476
|
Object.keys(map).forEach((geoid) => { col.features.push(map[geoid]); });
|
|
2477
|
+
record('maptocol', col.features.length);
|
|
2462
2478
|
return col;
|
|
2463
2479
|
}
|
|
2464
2480
|
exports.geoMapToCollectionNonNull = geoMapToCollectionNonNull;
|
|
2465
2481
|
function geoCollectionToTopo(col) {
|
|
2466
2482
|
let topo = Poly.topoFromCollection(col);
|
|
2467
2483
|
Poly.topoPack(topo);
|
|
2484
|
+
record('coltotopo', col.features.length);
|
|
2468
2485
|
return topo;
|
|
2469
2486
|
}
|
|
2470
2487
|
exports.geoCollectionToTopo = geoCollectionToTopo;
|
|
@@ -2475,6 +2492,7 @@ exports.geoCollectionToTopoNonNull = geoCollectionToTopoNonNull;
|
|
|
2475
2492
|
function geoTopoToCollection(topo) {
|
|
2476
2493
|
let col = Poly.topoToCollection(topo);
|
|
2477
2494
|
Poly.featurePack(col);
|
|
2495
|
+
record('topotocol', col.features.length);
|
|
2478
2496
|
return col;
|
|
2479
2497
|
}
|
|
2480
2498
|
exports.geoTopoToCollection = geoTopoToCollection;
|