Skip to main content

FlatGeobuf source loader

Query an indexed vector file from the browser.

FlatGeobufLoader uses the FlatGeobuf spatial index and HTTP range requests to return only the features needed for a query. It can expose GeoJSON-style, binary, or Arrow table results.

The indexed query path

Read the header. Select the index ranges. Return matching features.

A FlatGeobuf source keeps the file remote and lets the spatial index narrow the bytes before geometry decoding.

Open

Remote `.fgb` URL or supported loaded data

Filter

Bounding box, layers, and output format

Transport

Coalesced byte ranges for selected index nodes

Output

GeoJSON table, binary features, or Arrow table

From-v5.0range requests from v5.0

Cloud-native reads

Ask for the data. Fetch only the bytes behind it.

Range-aware sources translate a logical request into scheduled byte ranges. Metadata, caching, and cancellation stay in the transport layer while the application works with a normal decoded result.

Range scheduler

mergecacheabort

offsets · limits · HTTP Range

Useful bytes

Header bytesdiscover the layout
Selected intervalsfetch only what is needed
Decoded resulttable, tile, or raster data

The same access pattern powers tiled scenes, columnar files, point clouds, and windowed rasters without making the whole object a prerequisite.

Detailed guide

Source behavior and output contracts

The reference below covers construction, query results, metadata, CRS handling, range requirements, and empty-result behavior.

The FlatGeobufLoader creates an indexed vector source for remote .fgb datasets and serves viewport-sized feature subsets through HTTP range requests.

Usage​

import {createDataSource} from '@loaders.gl/core';
import {FlatGeobufLoader} from '@loaders.gl/geospatial/flatgeobuf';

const source = await createDataSource(url, [FlatGeobufLoader]);

const arrowTable = await source.getFeatures({
layers: 'dataset',
boundingBox: [
[-12, 35],
[30, 60]
],
format: 'arrow'
});

Outputs​

  • format: 'geojson' returns a GeoJSONTable.
  • format: 'binary' returns a binary feature collection.
  • format: 'arrow' returns an Arrow table with FlatGeobuf property columns plus a WKB geometry column annotated with geospatial schema metadata.

Metadata​

getMetadata() returns one logical source layer for the dataset, including:

  • dataset name and title when available
  • source bounds from the FlatGeobuf header envelope
  • CRS identifiers from the FlatGeobuf header
  • optional formatSpecificMetadata when requested

Notes​

  • FlatGeobufLoader is optimized for remote URL access and expects byte-range fetches.
  • Bounding box requests use the FlatGeobuf spatial index when present and return empty valid tables when nothing matches.
  • Source-level reprojection matches FlatGeobufLoader behavior.