GeoJSONSourceSchema
constGeoJSONSourceSchema:ZodEffects<ZodObject<{attribution:ZodOptional<ZodString>;buffer:ZodOptional<ZodNumber>;cache:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;ttl:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {enabled:boolean;ttl?:number; }, {enabled?:boolean;ttl?:number; }>>;cluster:ZodOptional<ZodBoolean>;clusterMaxZoom:ZodOptional<ZodNumber>;clusterMinPoints:ZodOptional<ZodNumber>;clusterProperties:ZodOptional<ZodRecord<ZodString,ZodAny>>;clusterRadius:ZodOptional<ZodNumber>;data:ZodOptional<ZodAny>;fetchStrategy:ZodDefault<ZodEnum<["runtime","build","hybrid"]>>;generateId:ZodOptional<ZodBoolean>;lineMetrics:ZodOptional<ZodBoolean>;loading:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;message:ZodOptional<ZodString>;showErrorOverlay:ZodDefault<ZodBoolean>; },"strip",ZodTypeAny, {enabled:boolean;message?:string;showErrorOverlay:boolean; }, {enabled?:boolean;message?:string;showErrorOverlay?:boolean; }>>;prefetchedData:ZodOptional<ZodAny>;promoteId:ZodOptional<ZodUnion<[ZodString,ZodRecord<ZodString,ZodString>]>>;refresh:ZodOptional<ZodEffects<ZodObject<{refreshInterval:ZodOptional<ZodNumber>;timestampField:ZodOptional<ZodString>;updateKey:ZodOptional<ZodString>;updateStrategy:ZodDefault<ZodEnum<["replace","merge","append-window"]>>;windowDuration:ZodOptional<ZodNumber>;windowSize:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>>;refreshInterval:ZodOptional<ZodNumber>;stream:ZodOptional<ZodObject<{eventTypes:ZodOptional<ZodArray<ZodString,"many">>;protocols:ZodOptional<ZodUnion<[ZodString,ZodArray<ZodString,"many">]>>;reconnect:ZodDefault<ZodBoolean>;reconnectDelay:ZodDefault<ZodNumber>;reconnectMaxAttempts:ZodDefault<ZodNumber>;reconnectMaxDelay:ZodDefault<ZodNumber>;type:ZodEnum<["websocket","sse"]>;url:ZodOptional<ZodString>; },"strip",ZodTypeAny, {eventTypes?:string[];protocols?:string|string[];reconnect:boolean;reconnectDelay:number;reconnectMaxAttempts:number;reconnectMaxDelay:number;type:"websocket"|"sse";url?:string; }, {eventTypes?:string[];protocols?:string|string[];reconnect?:boolean;reconnectDelay?:number;reconnectMaxAttempts?:number;reconnectMaxDelay?:number;type:"websocket"|"sse";url?:string; }>>;tolerance:ZodOptional<ZodNumber>;type:ZodLiteral<"geojson">;updateKey:ZodOptional<ZodString>;updateStrategy:ZodOptional<ZodEnum<["replace","merge","append-window"]>>;url:ZodOptional<ZodString>; },"passthrough",ZodTypeAny,objectOutputType<{attribution:ZodOptional<ZodString>;buffer:ZodOptional<ZodNumber>;cache:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;ttl:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {enabled:boolean;ttl?:number; }, {enabled?:boolean;ttl?:number; }>>;cluster:ZodOptional<ZodBoolean>;clusterMaxZoom:ZodOptional<ZodNumber>;clusterMinPoints:ZodOptional<ZodNumber>;clusterProperties:ZodOptional<ZodRecord<ZodString,ZodAny>>;clusterRadius:ZodOptional<ZodNumber>;data:ZodOptional<ZodAny>;fetchStrategy:ZodDefault<ZodEnum<["runtime","build","hybrid"]>>;generateId:ZodOptional<ZodBoolean>;lineMetrics:ZodOptional<ZodBoolean>;loading:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;message:ZodOptional<ZodString>;showErrorOverlay:ZodDefault<ZodBoolean>; },"strip",ZodTypeAny, {enabled:boolean;message?:string;showErrorOverlay:boolean; }, {enabled?:boolean;message?:string;showErrorOverlay?:boolean; }>>;prefetchedData:ZodOptional<ZodAny>;promoteId:ZodOptional<ZodUnion<[ZodString,ZodRecord<ZodString,ZodString>]>>;refresh:ZodOptional<ZodEffects<ZodObject<{refreshInterval:ZodOptional<ZodNumber>;timestampField:ZodOptional<ZodString>;updateKey:ZodOptional<ZodString>;updateStrategy:ZodDefault<ZodEnum<[…, …, …]>>;windowDuration:ZodOptional<ZodNumber>;windowSize:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>>;refreshInterval:ZodOptional<ZodNumber>;stream:ZodOptional<ZodObject<{eventTypes:ZodOptional<ZodArray<ZodString,"many">>;protocols:ZodOptional<ZodUnion<[ZodString,ZodArray<…, …>]>>;reconnect:ZodDefault<ZodBoolean>;reconnectDelay:ZodDefault<ZodNumber>;reconnectMaxAttempts:ZodDefault<ZodNumber>;reconnectMaxDelay:ZodDefault<ZodNumber>;type:ZodEnum<["websocket","sse"]>;url:ZodOptional<ZodString>; },"strip",ZodTypeAny, {eventTypes?:string[];protocols?:string|string[];reconnect:boolean;reconnectDelay:number;reconnectMaxAttempts:number;reconnectMaxDelay:number;type:"websocket"|"sse";url?:string; }, {eventTypes?:string[];protocols?:string|string[];reconnect?:boolean;reconnectDelay?:number;reconnectMaxAttempts?:number;reconnectMaxDelay?:number;type:"websocket"|"sse";url?:string; }>>;tolerance:ZodOptional<ZodNumber>;type:ZodLiteral<"geojson">;updateKey:ZodOptional<ZodString>;updateStrategy:ZodOptional<ZodEnum<["replace","merge","append-window"]>>;url:ZodOptional<ZodString>; },ZodTypeAny,"passthrough">,objectInputType<{attribution:ZodOptional<ZodString>;buffer:ZodOptional<ZodNumber>;cache:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;ttl:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {enabled:boolean;ttl?:number; }, {enabled?:boolean;ttl?:number; }>>;cluster:ZodOptional<ZodBoolean>;clusterMaxZoom:ZodOptional<ZodNumber>;clusterMinPoints:ZodOptional<ZodNumber>;clusterProperties:ZodOptional<ZodRecord<ZodString,ZodAny>>;clusterRadius:ZodOptional<ZodNumber>;data:ZodOptional<ZodAny>;fetchStrategy:ZodDefault<ZodEnum<["runtime","build","hybrid"]>>;generateId:ZodOptional<ZodBoolean>;lineMetrics:ZodOptional<ZodBoolean>;loading:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;message:ZodOptional<ZodString>;showErrorOverlay:ZodDefault<ZodBoolean>; },"strip",ZodTypeAny, {enabled:boolean;message?:string;showErrorOverlay:boolean; }, {enabled?:boolean;message?:string;showErrorOverlay?:boolean; }>>;prefetchedData:ZodOptional<ZodAny>;promoteId:ZodOptional<ZodUnion<[ZodString,ZodRecord<ZodString,ZodString>]>>;refresh:ZodOptional<ZodEffects<ZodObject<{refreshInterval:ZodOptional<ZodNumber>;timestampField:ZodOptional<ZodString>;updateKey:ZodOptional<ZodString>;updateStrategy:ZodDefault<ZodEnum<[…, …, …]>>;windowDuration:ZodOptional<ZodNumber>;windowSize:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>>;refreshInterval:ZodOptional<ZodNumber>;stream:ZodOptional<ZodObject<{eventTypes:ZodOptional<ZodArray<ZodString,"many">>;protocols:ZodOptional<ZodUnion<[ZodString,ZodArray<…, …>]>>;reconnect:ZodDefault<ZodBoolean>;reconnectDelay:ZodDefault<ZodNumber>;reconnectMaxAttempts:ZodDefault<ZodNumber>;reconnectMaxDelay:ZodDefault<ZodNumber>;type:ZodEnum<["websocket","sse"]>;url:ZodOptional<ZodString>; },"strip",ZodTypeAny, {eventTypes?:string[];protocols?:string|string[];reconnect:boolean;reconnectDelay:number;reconnectMaxAttempts:number;reconnectMaxDelay:number;type:"websocket"|"sse";url?:string; }, {eventTypes?:string[];protocols?:string|string[];reconnect?:boolean;reconnectDelay?:number;reconnectMaxAttempts?:number;reconnectMaxDelay?:number;type:"websocket"|"sse";url?:string; }>>;tolerance:ZodOptional<ZodNumber>;type:ZodLiteral<"geojson">;updateKey:ZodOptional<ZodString>;updateStrategy:ZodOptional<ZodEnum<["replace","merge","append-window"]>>;url:ZodOptional<ZodString>; },ZodTypeAny,"passthrough">>,objectOutputType<{attribution:ZodOptional<ZodString>;buffer:ZodOptional<ZodNumber>;cache:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;ttl:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {enabled:boolean;ttl?:number; }, {enabled?:boolean;ttl?:number; }>>;cluster:ZodOptional<ZodBoolean>;clusterMaxZoom:ZodOptional<ZodNumber>;clusterMinPoints:ZodOptional<ZodNumber>;clusterProperties:ZodOptional<ZodRecord<ZodString,ZodAny>>;clusterRadius:ZodOptional<ZodNumber>;data:ZodOptional<ZodAny>;fetchStrategy:ZodDefault<ZodEnum<["runtime","build","hybrid"]>>;generateId:ZodOptional<ZodBoolean>;lineMetrics:ZodOptional<ZodBoolean>;loading:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;message:ZodOptional<ZodString>;showErrorOverlay:ZodDefault<ZodBoolean>; },"strip",ZodTypeAny, {enabled:boolean;message?:string;showErrorOverlay:boolean; }, {enabled?:boolean;message?:string;showErrorOverlay?:boolean; }>>;prefetchedData:ZodOptional<ZodAny>;promoteId:ZodOptional<ZodUnion<[ZodString,ZodRecord<ZodString,ZodString>]>>;refresh:ZodOptional<ZodEffects<ZodObject<{refreshInterval:ZodOptional<ZodNumber>;timestampField:ZodOptional<ZodString>;updateKey:ZodOptional<ZodString>;updateStrategy:ZodDefault<ZodEnum<["replace","merge","append-window"]>>;windowDuration:ZodOptional<ZodNumber>;windowSize:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>>;refreshInterval:ZodOptional<ZodNumber>;stream:ZodOptional<ZodObject<{eventTypes:ZodOptional<ZodArray<ZodString,"many">>;protocols:ZodOptional<ZodUnion<[ZodString,ZodArray<ZodString,"many">]>>;reconnect:ZodDefault<ZodBoolean>;reconnectDelay:ZodDefault<ZodNumber>;reconnectMaxAttempts:ZodDefault<ZodNumber>;reconnectMaxDelay:ZodDefault<ZodNumber>;type:ZodEnum<["websocket","sse"]>;url:ZodOptional<ZodString>; },"strip",ZodTypeAny, {eventTypes?:string[];protocols?:string|string[];reconnect:boolean;reconnectDelay:number;reconnectMaxAttempts:number;reconnectMaxDelay:number;type:"websocket"|"sse";url?:string; }, {eventTypes?:string[];protocols?:string|string[];reconnect?:boolean;reconnectDelay?:number;reconnectMaxAttempts?:number;reconnectMaxDelay?:number;type:"websocket"|"sse";url?:string; }>>;tolerance:ZodOptional<ZodNumber>;type:ZodLiteral<"geojson">;updateKey:ZodOptional<ZodString>;updateStrategy:ZodOptional<ZodEnum<["replace","merge","append-window"]>>;url:ZodOptional<ZodString>; },ZodTypeAny,"passthrough">,objectInputType<{attribution:ZodOptional<ZodString>;buffer:ZodOptional<ZodNumber>;cache:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;ttl:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {enabled:boolean;ttl?:number; }, {enabled?:boolean;ttl?:number; }>>;cluster:ZodOptional<ZodBoolean>;clusterMaxZoom:ZodOptional<ZodNumber>;clusterMinPoints:ZodOptional<ZodNumber>;clusterProperties:ZodOptional<ZodRecord<ZodString,ZodAny>>;clusterRadius:ZodOptional<ZodNumber>;data:ZodOptional<ZodAny>;fetchStrategy:ZodDefault<ZodEnum<["runtime","build","hybrid"]>>;generateId:ZodOptional<ZodBoolean>;lineMetrics:ZodOptional<ZodBoolean>;loading:ZodOptional<ZodObject<{enabled:ZodDefault<ZodBoolean>;message:ZodOptional<ZodString>;showErrorOverlay:ZodDefault<ZodBoolean>; },"strip",ZodTypeAny, {enabled:boolean;message?:string;showErrorOverlay:boolean; }, {enabled?:boolean;message?:string;showErrorOverlay?:boolean; }>>;prefetchedData:ZodOptional<ZodAny>;promoteId:ZodOptional<ZodUnion<[ZodString,ZodRecord<ZodString,ZodString>]>>;refresh:ZodOptional<ZodEffects<ZodObject<{refreshInterval:ZodOptional<ZodNumber>;timestampField:ZodOptional<ZodString>;updateKey:ZodOptional<ZodString>;updateStrategy:ZodDefault<ZodEnum<["replace","merge","append-window"]>>;windowDuration:ZodOptional<ZodNumber>;windowSize:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }, {refreshInterval?:number;timestampField?:string;updateKey?:string;updateStrategy?:"replace"|"merge"|"append-window";windowDuration?:number;windowSize?:number; }>>;refreshInterval:ZodOptional<ZodNumber>;stream:ZodOptional<ZodObject<{eventTypes:ZodOptional<ZodArray<ZodString,"many">>;protocols:ZodOptional<ZodUnion<[ZodString,ZodArray<ZodString,"many">]>>;reconnect:ZodDefault<ZodBoolean>;reconnectDelay:ZodDefault<ZodNumber>;reconnectMaxAttempts:ZodDefault<ZodNumber>;reconnectMaxDelay:ZodDefault<ZodNumber>;type:ZodEnum<["websocket","sse"]>;url:ZodOptional<ZodString>; },"strip",ZodTypeAny, {eventTypes?:string[];protocols?:string|string[];reconnect:boolean;reconnectDelay:number;reconnectMaxAttempts:number;reconnectMaxDelay:number;type:"websocket"|"sse";url?:string; }, {eventTypes?:string[];protocols?:string|string[];reconnect?:boolean;reconnectDelay?:number;reconnectMaxAttempts?:number;reconnectMaxDelay?:number;type:"websocket"|"sse";url?:string; }>>;tolerance:ZodOptional<ZodNumber>;type:ZodLiteral<"geojson">;updateKey:ZodOptional<ZodString>;updateStrategy:ZodOptional<ZodEnum<["replace","merge","append-window"]>>;url:ZodOptional<ZodString>; },ZodTypeAny,"passthrough">>
Defined in: packages/core/src/schemas/source.schema.ts:334
GeoJSON data source configuration.
Remarks
Section titled “Remarks”The primary data source type for maplibre-yaml. Supports multiple data loading strategies:
Data Sources (one required):
url- Fetch GeoJSON from URL at runtimedata- Inline GeoJSON objectstream- Real-time WebSocket or SSE connection
Fetch Strategy:
runtime(default) - Fetch when map loads, keeps bundle smallbuild- Fetch at build time, bundle with apphybrid- Build-time with runtime refresh
Real-time Updates:
- Use
refreshIntervalfor polling (minimum 1000ms) - Use
streamfor WebSocket/SSE - Configure
updateStrategyfor merge vs replace
Examples
Section titled “Examples”Basic URL Source
source: type: geojson url: "https://example.com/data.geojson"Inline Data
source: type: geojson data: type: FeatureCollection features: - type: Feature geometry: type: Point coordinates: [-74.006, 40.7128] properties: name: "New York"Polling Updates
source: type: geojson url: "https://api.example.com/live-data" refreshInterval: 15000 loading: message: "Loading live data..."WebSocket Streaming
source: type: geojson stream: type: websocket url: "wss://api.example.com/stream" updateStrategy: merge updateKey: "id"Clustered Points
source: type: geojson url: "https://example.com/points.geojson" cluster: true clusterRadius: 50 clusterMaxZoom: 14- StreamConfigSchema for streaming options
- LoadingConfigSchema for loading UI options
- MapLibre GeoJSON Source