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).
Usage (JS)
constiter = parseGeoJsonLazy(hugeGeoJsonStr); letfeature; 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();
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).
Usage (JS)