A record describing each source name and the
FeatureCollection type it carries. When omitted, every source defaults to
FeatureCollection.
OptionalbeforeLayerConfig?: CustomGeoJSONBeforeLayerConfigWhere the layers that set no beforeLayerConfig of their own go in the map's layer stack.
Optionalimages?: Record<string, CustomGeoJSONImageSpec>Custom images to register on the map by ID. The module adds each image during
setup, before any source or layer is created, and re-adds every image after every
style change — so symbol layers referencing an image via icon-image: '<id>'
survive setStyle calls automatically.
map.hasImage(id) is already true.applyConfig re-runs image registration additively: new IDs are added,
already-present IDs are skipped, and removing an entry from images does
not unregister it from the map (other layers may still reference it).The sources, keyed by an arbitrary user-defined name, that this module manages.
Optionalvisible?: booleanWhether the module draws anything: every layer of every source.
A shown source draws its layers while it holds features. show() and clear() never change
this — a hidden module keeps its data until CustomGeoJSONModule.setVisible shows it again.
type MySources = {
buildings: FeatureCollection<Point, { name: string }>;
parks: FeatureCollection<Polygon>;
};
const config: CustomGeoJSONModuleConfig<MySources> = {
sources: {
buildings: { layers: [{ type: 'circle', paint: { 'circle-radius': 4 } }] },
parks: { layers: [{ type: 'fill', paint: { 'fill-color': '#5a5' } }] },
},
};
CustomGeoJSONModuleSerializableConfig for the part that survives JSON.
Configuration for the CustomGeoJSONModule.