@dra2020/baseclient 1.0.11 → 1.0.12

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.
@@ -6939,7 +6939,9 @@ function polyPack(coords, prepack) {
6939
6939
  coords = coords.geometry.coordinates;
6940
6940
  // Transparently handle polygon or multi-polygon
6941
6941
  let depth = Util.depthof(coords);
6942
- if (depth == 3)
6942
+ if (depth == 2)
6943
+ coords = [[[coords]]];
6944
+ else if (depth == 3)
6943
6945
  coords = [[coords]];
6944
6946
  else if (depth == 4)
6945
6947
  coords = [coords];
@@ -7066,9 +7068,16 @@ exports.featurePack = featurePack;
7066
7068
  function featureUnpack(f) {
7067
7069
  if (f && f.geometry && f.geometry.packed !== undefined) {
7068
7070
  f.geometry.coordinates = polyUnpack(f.geometry.packed);
7071
+ let depth = Util.depthof(f.geometry.coordinates);
7069
7072
  // Check for oops, optimized away the multipolygon in polyUnpack
7070
- if (f.geometry.type === 'MultiPolygon' && Util.depthof(f.geometry.coordinates) === 4)
7073
+ if (f.geometry.type === 'MultiPolygon' && depth === 4)
7071
7074
  f.geometry.coordinates = [f.geometry.coordinates];
7075
+ else if (f.geometry.type === 'Point' && depth != 2) {
7076
+ while (depth > 2) {
7077
+ f.geometry.coordinates = f.geometry.coordinates[0];
7078
+ depth = Util.depthof(f.geometry.coordinates);
7079
+ }
7080
+ }
7072
7081
  delete f.geometry.packed;
7073
7082
  }
7074
7083
  else if (f.type && f.type === 'FeatureCollection' && f.features) {