• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / loaders.gl / 24139120841

08 Apr 2026 01:53PM UTC coverage: 65.319% (+30.2%) from 35.137%
24139120841

push

github

web-flow
chore: Replace puppeteer with playwright (#3350)

14216 of 18890 branches covered (75.26%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

3248 existing lines in 369 files now uncovered.

73509 of 115413 relevant lines covered (63.69%)

5763.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.33
/modules/gis/src/lib/binary-geometry-api/binary-geometry-info.ts
UNCOV
1
// loaders.gl
×
UNCOV
2
// SPDX-License-Identifier: MIT
×
UNCOV
3
// Copyright (c) vis.gl contributors
×
UNCOV
4

×
UNCOV
5
import type {BinaryGeometry} from '@loaders.gl/schema';
×
UNCOV
6

×
UNCOV
7
/**
×
UNCOV
8
 * Information about a binary geometry
×
UNCOV
9
 */
×
UNCOV
10
export type BinaryGeometryInfo = {
×
UNCOV
11
  /** The GeoJSON style geometry type corresponding to this particular binary geometry */
×
UNCOV
12
  multiGeometryType:
×
UNCOV
13
    | 'Point'
×
UNCOV
14
    | 'LineString'
×
UNCOV
15
    | 'Polygon'
×
UNCOV
16
    | 'MultiPoint'
×
UNCOV
17
    | 'MultiLineString'
×
UNCOV
18
    | 'MultiPolygon';
×
UNCOV
19
  /** Is this a "Multi" version of the binary geometry? */
×
UNCOV
20
  isMultiGeometry: boolean;
×
UNCOV
21
  /** How many dimensions are the coordinates? */
×
UNCOV
22
  dimension: number;
×
UNCOV
23
  /** How many points does this geometry have? */
×
UNCOV
24
  pointCount: number;
×
UNCOV
25
  /** How many coordinates does this geometry have? */
×
UNCOV
26
  coordinateCount: number;
×
UNCOV
27
};
×
UNCOV
28

×
UNCOV
29
/**
×
UNCOV
30
 * @returns information about a binary geometry
×
UNCOV
31
 */
×
UNCOV
32
export function getBinaryGeometryInfo(geometry: BinaryGeometry): BinaryGeometryInfo {
×
33
  return {
×
34
    isMultiGeometry: isMultiGeometryType(geometry),
×
35
    multiGeometryType: getMultiGeometryType(geometry),
×
36
    dimension: geometry.positions.size,
×
37
    pointCount: geometry.positions.value.length / geometry.positions.size,
×
38
    coordinateCount: geometry.positions.value.length
×
39
  };
×
40
}
×
UNCOV
41

×
UNCOV
42
/** @returns true if a binary geometry corresponds to a MultiPoint, MultiLineString or MultiPolygon */
×
43
function isMultiGeometryType(geometry: BinaryGeometry) {
×
44
  switch (geometry.type) {
×
45
    case 'Point':
×
46
      const {positions} = geometry;
×
47
      return positions.value.length / positions.size > 1;
×
48
    case 'LineString':
×
49
      const {pathIndices} = geometry;
×
50
      return pathIndices.value.length > 1;
×
51
    case 'Polygon':
×
52
      const {polygonIndices} = geometry;
×
53
      return polygonIndices.value.length > 1;
×
54
    default:
×
55
      return false;
×
56
  }
×
57
}
×
58

1✔
59
/**
1✔
60
 * @returns geometry type of binary geometry, including MultiPoint, MultiLineString or MultiPolygon
1✔
61
 */
1✔
62
function getMultiGeometryType(geometry: BinaryGeometry) {
×
63
  const isMulti = isMultiGeometryType(geometry);
×
64
  switch (geometry.type) {
×
65
    case 'Point':
×
66
      return isMulti ? 'MultiPoint' : 'Point';
×
67
    case 'LineString':
×
68
      return isMulti ? 'MultiLineString' : 'LineString';
×
69
    case 'Polygon':
×
70
      return isMulti ? 'MultiPolygon' : 'Polygon';
×
71
    default:
×
72
      // @ts-expect-error
×
73
      throw new Error(`Illegal geometry type: ${type}`);
×
74
  }
×
75
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc