wasm-spatial-core
    Preparing search index...

    Class LazyGeoJsonIter

    A lazy GeoJSON FeatureCollection iterator.

    Parses features one at a time using a manual JSON state machine, without building the full DOM. Memory peak is O(single feature) instead of O(all features).

    const iter = parseGeoJsonLazy(hugeGeoJsonStr);
    let feature;
    while ((feature = iter.nextFeature()) !== null) {
    // feature is a Float64Array of [lng0, lat0, lng1, lat1, ...]
    gl.bufferSubData(gl.ARRAY_BUFFER, offset, feature);
    offset += feature.byteLength;
    }
    console.log(`Processed ${iter.remaining()} features`);
    iter.free();
    Index
    total: number

    Get the total feature count.

    • Advance to the next feature and return its coordinates as a Float64Array.

      Returns null (JS undefined) when all features have been consumed.

      Returns Float64Array<ArrayBufferLike> | undefined