--- title: selectSource description: Choose the best source loader from a supplied list using URLs, MIME types, and format signatures. hide_title: true page_style: designed --- import {DocPageHeader} from '@site/src/components/docs/doc-page-header'; import {DocOrientation, ReferenceBoundary} from '@site/src/components/docs/designed-doc';

From v4.2

`_selectSource` is an experimental synchronous source-loader selector exported from `@loaders.gl/core`. Most applications should use [`createDataSource`](./create-data-source), which selects and constructs the runtime source. There is no public `selectSourceSync` or `createDataSourceSync` export. ## Usage ```typescript import {_selectSource} from '@loaders.gl/core'; import {PMTilesLoader} from '@loaders.gl/tiles/pmtiles'; import {MVTLoader} from '@loaders.gl/tiles/mvt'; const sourceLoader = _selectSource('filename.pmtiles', [PMTilesLoader, MVTLoader]); ``` ## Signature ```typescript _selectSource(data: string | Blob, sources: SourceLoader[], options?): SourceLoader | null ``` - `data`: a URL or blob used for best-effort format matching. - `sources`: the candidate source loaders. This API does not maintain a source registry. - `options.type`: selects a supplied source by its `type`; the default `'auto'` uses loader selection heuristics. - `options.nothrow`: returns `null` when selection fails if set to `true`; otherwise selection failure throws. Selection returns a loader, not a runtime source, and does not fetch remote data. `createDataSource` accepts the corresponding selection override in `core.type`.