GeoLeaf Core API - v3.19.0
    Preparing search index...
    • Takes up to size features, evenly spread over the collection — one every ⌈n / size⌉. Evenly rather than the first ones: the cost is the same, and a collection sorted by some column would otherwise show only one end of itself.

      Type Parameters

      • T

      Parameters

      • features: readonly T[]

        The layer's features, as converted.

      • size: number = FIELD_SAMPLE_SIZE

        The most features to keep — 1 000 by default.

      Returns T[]

      The sample — the whole collection (a copy) when it holds no more than size.

      sampleFeatures(Array.from({ length: 5 }, (_, i) => i), 2); // [0, 3]