@dra2020/baseclient 1.0.91 → 1.0.92
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 +12 -3
- package/dist/baseclient.js.map +1 -1
- package/lib/geo/geo.ts +10 -2
- package/package.json +1 -1
package/lib/geo/geo.ts
CHANGED
|
@@ -146,7 +146,6 @@ export function geoNormalizeCollection(col: GeoFeatureCollection, options?: Norm
|
|
|
146
146
|
export function geoCollectionToMap(col: GeoFeatureCollection): GeoFeatureMap
|
|
147
147
|
{
|
|
148
148
|
if (col == null) return null;
|
|
149
|
-
record('coltomap', col.features.length);
|
|
150
149
|
let map: GeoFeatureMap = {};
|
|
151
150
|
col.features.forEach((f: GeoFeature) => { map[String(f.properties.id)] = f; });
|
|
152
151
|
return map;
|
|
@@ -163,7 +162,6 @@ export function geoMapToCollectionNonNull(map: GeoFeatureMap): GeoFeatureCollect
|
|
|
163
162
|
if (map == null) return null;
|
|
164
163
|
let col: GeoFeatureCollection = { type: 'FeatureCollection', features: [] };
|
|
165
164
|
Object.keys(map).forEach((geoid: string) => { col.features.push(map[geoid]) });
|
|
166
|
-
record('maptocol', col.features.length);
|
|
167
165
|
return col;
|
|
168
166
|
}
|
|
169
167
|
|
|
@@ -172,6 +170,7 @@ export function geoCollectionToTopo(col: GeoFeatureCollection): Poly.Topo
|
|
|
172
170
|
let topo = Poly.topoFromCollection(col);
|
|
173
171
|
Poly.topoPack(topo);
|
|
174
172
|
record('coltotopo', col.features.length);
|
|
173
|
+
if ((col as any).datasets) (topo as any).datasets = (col as any).datasets;
|
|
175
174
|
return topo;
|
|
176
175
|
}
|
|
177
176
|
|
|
@@ -185,6 +184,7 @@ export function geoTopoToCollection(topo: Poly.Topo): GeoFeatureCollection
|
|
|
185
184
|
let col = Poly.topoToCollection(topo);
|
|
186
185
|
Poly.featurePack(col);
|
|
187
186
|
record('topotocol', col.features.length);
|
|
187
|
+
if ((topo as any).datasets) (col as any).datasets = (topo as any).datasets;
|
|
188
188
|
return col;
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -376,8 +376,16 @@ export class GeoMultiCollection
|
|
|
376
376
|
if (n == 1)
|
|
377
377
|
this.all.col = this._col(this.nthEntry(0));
|
|
378
378
|
else
|
|
379
|
+
{
|
|
379
380
|
// Going from map to collection guarantees that any duplicates are removed
|
|
380
381
|
this.all.col = geoMapToCollectionNonNull(this.allMap());
|
|
382
|
+
this.forEachEntry(e => {
|
|
383
|
+
if (e.col && (e.col as any).datasets)
|
|
384
|
+
(this.all.col as any).datasets = (e.col as any).datasets;
|
|
385
|
+
if (e.topo && (e.topo as any).datasets)
|
|
386
|
+
(this.all.col as any).datasets = (e.topo as any).datasets;
|
|
387
|
+
});
|
|
388
|
+
}
|
|
381
389
|
}
|
|
382
390
|
return this.all.col;
|
|
383
391
|
}
|