@dra2020/baseclient 1.0.149 → 1.0.151

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.
@@ -2639,6 +2639,8 @@ function isValidId(col) {
2639
2639
  let set = new Set();
2640
2640
  for (let i = 0; i < col.features.length; i++) {
2641
2641
  let f = col.features[i];
2642
+ if (typeof f.properties.id === 'number')
2643
+ f.properties.id = String(f.properties.id); // Fix old 2016_BG collections
2642
2644
  if (typeof f.properties.id !== 'string')
2643
2645
  return false; // id must be string
2644
2646
  if (set.has(f.properties.id))
@@ -3297,7 +3299,7 @@ class MultiBlockMapping {
3297
3299
  return this.entries.length ? this.entries[0].bm[blockid] : undefined;
3298
3300
  }
3299
3301
  rev(geoid) {
3300
- for (let i = 0; i < this.entries.length; i++) {
3302
+ for (let i = this.entries.length - 1; i >= 0; i--) {
3301
3303
  let e = this.entries[i];
3302
3304
  if (!e.rbm)
3303
3305
  e.rbm = reverseBlockMapping(e.bm);
@@ -3311,13 +3313,19 @@ class MultiBlockMapping {
3311
3313
  if (this.entries.length)
3312
3314
  Object.keys(this.entries[0].bm).forEach(blockid => cb(blockid));
3313
3315
  }
3314
- // Just walks first map
3316
+ // Walk maps in reverse order, careful to not invoke on same geoid
3315
3317
  forEachRev(cb) {
3316
- for (let i = 0; i < this.entries.length; i++) {
3318
+ let seen = new Set();
3319
+ for (let i = this.entries.length - 1; i >= 0; i--) {
3317
3320
  let e = this.entries[i];
3318
3321
  if (!e.rbm)
3319
3322
  e.rbm = reverseBlockMapping(e.bm);
3320
- Object.keys(e.rbm).forEach(geoid => cb(geoid, e.rbm[geoid]));
3323
+ Object.keys(e.rbm).forEach(geoid => {
3324
+ if (!seen.has(geoid)) {
3325
+ seen.add(geoid);
3326
+ cb(geoid, e.rbm[geoid]);
3327
+ }
3328
+ });
3321
3329
  }
3322
3330
  }
3323
3331
  }