Cloud datasets
Fetch the part that matters.
Treat remote files, tiled archives, and services as datasets: inspect metadata, plan a request, and read only the bytes needed for the current result.
Multi-resource data
Using sources
Sources model datasets that need discovery, metadata, tiles, ranges, or repeated requests rather than a single parse call.
Loaders
Runtime API
Manage loading
Loaded data
Render with deck.gl (optional)
The source path
Discover first. Request only what the view needs.
A source owns the extra steps around a dataset: metadata discovery, spatial or tile selection, range requests, caching, and repeated refreshes.
Discover
Identify layers, fields, bounds, and service capabilities
Select
Use a viewport, tile, query, or application request
Fetch
Load only the resources needed for that request
Return
Expose a shared source result or a format-specific data object
Loaders can open a reusable data source for metadata, selective reads, and repeated requests.
Use createDataSource() to open a source through the loader for the format or service.
Detailed guide
Source interfaces and implementations
The reference below covers SourceLoader and DataSource contracts, metadata, adapters, auto-selection, raster sources, and source-specific options.
Data sources support the following data access models:
| Data Access Model | Description |
|---|---|
| *web service | Interact with a web service that returns data assets for different regions etc. |
| cloud storage | Read static assets as-needed from large cloud-native file formats |
| archive files | Read individual assets from a (very large) multi-asset archive files. |
| dynamic data generation | Generate data (tiles, images etc) dynamically based on application requests. |
Format loaders with source support
Use the same format loader for parsing and source creation. For example, load(url, PMTilesLoader)
reads archive metadata, and createDataSource(url, PMTilesLoader) opens an archive for repeated tile
requests. The same pattern applies to Arrow IPC, FlatGeobuf, GeoPackage, GeoTIFF, KMZ, Lance, MLT,
MVT, NetCDF, ORC, Parquet, and RAD.
import {createDataSource, load} from '@loaders.gl/core';
import {PMTilesLoader} from '@loaders.gl/tiles/pmtiles';
const metadata = await load(url, PMTilesLoader);
const source = await createDataSource(url, PMTilesLoader);
Source-only loaders
Source-only loaders such as ArcGISFeatureServerLoader, WMSLoader, and STACLoader use the same
Loader suffix and the same createDataSource() API. The Data source row in a loader's API
reference names the runtime type returned by the factory.
import {createDataSource} from '@loaders.gl/core';
import {ArcGISFeatureServerLoader} from '@loaders.gl/arcgis/feature-service';
const source = await createDataSource(url, ArcGISFeatureServerLoader);
const metadata = await source.getMetadata();
DataSource
A DataSource instance provides methods to query metadata and to query data for specific geospatial areas or views.
A DataSource can (and sometimes must) expose a completely unique API. However a big advantage comes when a DataSource conforms to an existing *Source interface. DataSource is the implementation base class; the *Source interfaces are type-only capability contracts.
This means that applications written against that interface can now support the new source without any changes to existing logic.
| Source Interface | Data access model | Examples |
|---|---|---|
ImageSource | Loads image covering a region | WMSLoader, ArcGISImageServerLoader |
RasterSource | Loads typed raster samples for a viewport | GeoTIFFLoader, OMETiffLoader |
VectorSource | Load "features" in a region | WFS (N/A), ArcGIS FeatureServer |
TableScanSource | Streams ordered table batches | CSV, Arrow IPC, Parquet |
TableSourceCollection | Resolves tables by name | GeoPackage |
ImageTileSource | Load image covering a specific tile index | WMTS (N/A) |
VectorTileSource | Load "features" in a specific tile index | Mapbox Vector Tiles, PMTilesLoader |
Querying named tables
Table sources can be queried through the optional @loaders.gl/core/query APIs. Assign
core.name when creating a source, register it in sources, and select it with from.
Multi-table sources expose getTable(name) for qualified lookup. See
Querying tables for examples and ownership rules.
Metadata
A DataSource instance provides methods to query metadata: await dataSource.getMetadata().
Composing source capabilities
One runtime object can implement several source capabilities while sharing the input, options,
authentication, caches, and lifecycle supplied by DataSource:
import {DataSource} from '@loaders.gl/core/loader-utils';
import type {
DataSourceOptions,
ImageSource,
ImageSourceMetadata,
ImageType,
GetImageParameters,
RasterData,
RasterSource,
RasterSourceMetadata,
GetRasterParameters
} from '@loaders.gl/core/loader-utils';
type CompositeMetadata = ImageSourceMetadata & RasterSourceMetadata;
class CompositeSource
extends DataSource<string, DataSourceOptions>
implements ImageSource, RasterSource
{
async getMetadata(): Promise<CompositeMetadata> {
throw new Error('Return one source-level metadata object rich enough for both capabilities.');
}
async getImage(parameters: GetImageParameters): Promise<ImageType> {
throw new Error('Return rendered pixels for the requested extent.');
}
async getRaster(parameters: GetRasterParameters): Promise<RasterData> {
throw new Error('Return typed samples for the requested viewport.');
}
}
Existing composite runtimes include MVT and PMTiles sources that implement image- and vector-tile capabilities, COPC sources that implement tile and point-cloud scan capabilities, and GeoTIFF sources that implement raster and scan-discovery capabilities. Distinct source loaders may still be appropriate when endpoints, initialization, or output semantics differ.
Automatic consumers still choose one view at a time. For example, SourceLayer classifies a
multi-capability object into the first matching rendering family: 3D tile, point cloud, raster,
image, vector, then 2D tile. This classification does not add an implicit capability-selection API;
callers that need another view should use the corresponding specialized source consumer or adapter.
Adapter Sources
While most SourceLoader implementations provide an interface for interacting with a specific web service or cloud archive file format (e.g. PMTilesLoader), it is also possible to create adapters:
- that provide a
SourceLoaderinterface to local data (ArrowTableTileLoader) - that adapt one type of source to another (e.g.
ImageTileSourcecalling anImageSourceto generate each tile).
Source auto-selection
Pass one or more source-capable loaders to createDataSource() or
createDataSourceSync(). Multiple candidates are matched using URL patterns,
extensions, MIME types, or content tests.
Creating new Sources
Just like applications can create their own loaders, apps can also create (and potentially contribute) their own source loaders and use them with loaders.gl, as long as they follow the required interfaces (for example, runtime source instances extend DataSource and implement one or more source capability interfaces).
Raster sources
RasterSource is a sibling abstraction to ImageSource and TileSource.
Use it when a source needs to:
- accept a viewport request instead of a tile index
- return typed raster values rather than browser image objects
- select named non-spatial dimensions such as time or vertical level
- preserve band count, dtype, bounds, and CRS metadata for styling or texture upload
GeoTIFFLoader and GeoZarrLoader are built-in RasterSource implementations. Both
accept a RasterViewport and return RasterData. GeoTIFF requests can select numeric bands, while
GeoZarr requests can use the common selection map for named dimensions declared by the source.
RasterSource is generic over its raster data, request parameters, and metadata. Higher-level
managers such as RasterSet preserve those source-specific types while retaining defaults for
applications that only need the common raster contract.
Options
Sources and their internal parsers share one options object:
corecontains shared loading controls and source selection.- Source-specific settings live in the source namespace, such as
pmtiles. - Parser settings live in their usual namespaces, such as
mvt,mlt, orimagebitmap.
For a single source and parser, use the same namespace for both:
import {createDataSource} from '@loaders.gl/core';
import {MVTLoader} from '@loaders.gl/tiles/mvt';
const source = await createDataSource(url, [MVTLoader], {
core: {worker: false},
mvt: {
metadataUrl: null, // Source setting
layerProperty: 'sourceLayer' // Parser setting
}
});
For multiple candidate sources or multiple internal parsers, add their namespaces side by side:
import {PMTilesLoader} from '@loaders.gl/tiles/pmtiles';
const source = await createDataSource(url, [PMTilesLoader, MVTLoader], {
core: {worker: false, fetch: {headers: {Authorization: 'Bearer …'}}},
pmtiles: {shape: 'arrow'},
mvt: {layerProperty: 'sourceLayer', layers: ['roads']},
mlt: {layers: ['roads']}
});
Shared controls
| Option | Purpose |
|---|---|
core.type | Select a candidate source by its type. Defaults to 'auto'. |
core.fetch | A custom fetch function or RequestInit settings, such as HTTP headers. |
core.credentials | Scoped credentials for authenticated requests. |
core.worker | Control worker use by internal parsers: true, false, or 'auto'. |
core.loaders | Additional loaders for sources that support dynamic parser selection. |
core.attributions | Attribution text for the source. |
core.onError | Callback for source initialization or metadata errors. |
Forwarding and precedence
core.fetch and core.credentials apply to source requests and parser subresources. A source
forwards parser namespaces unchanged unless it must supply request-specific settings such as tile
coordinates. Explicit source output settings, such as pmtiles.shape, take precedence over parser
settings. When a source and its parser use the same namespace (for example mvt), their options
are combined there. Source selection still uses core.type.
This convention also applies to direct source constructors.
The core.loadOptions and top-level source loadOptions wrappers are no longer accepted.
Known parser namespaces are typed; additional namespaces remain extensible for dynamically chosen
loaders. An unknown namespace is therefore not guaranteed to produce a TypeScript error.
Source-backed layer options
When using ImageSourceLayer or Tile2DSourceLayer, put this flat options object in the layer's
sourceOptions prop. This is the sole entry point for source configuration, including its internal
parser settings. The inherited deck.gl loadOptions prop does not supply or override source options.
Additional parsers can be provided through sourceOptions.core.loaders or the layer's loaders prop.
Example
An advanced source loader is ArrowTableTileLoader, which dynamically generates clipped,
simplified GeoArrow WKB tiles from an Arrow table. GeoJSONLoader returns Arrow by default in 5.0.
These are Arrow tables, not encoded MVT bytes; the separate TableTileLoader retains its
GeoJSON interface.
import {createDataSource} from '@loaders.gl/core';
import {ArrowTableTileLoader} from '@loaders.gl/tiles/mvt';
import {GeoJSONLoader} from '@loaders.gl/tables/geojson/bundled';
// build an initial index of tiles.
const tileSource = await createDataSource(url, ArrowTableTileLoader, {
core: {
loaders: [GeoJSONLoader]
},
table: {coordinates: 'wgs84'}
});
// request a particular tile
const tile = await tileSource.getTile({z: 5, x: 10, y: 12});
const geometry = tile?.data.getChild('geometry'); // Arrow Binary vector containing WKB