Sources
setSource
Parameters
id
The ID of the source to add. Must not conflict with existing sources.
String
geoJson
A source containing GeoJSON.
Object
cluster
Cluster enabled or disabled
Boolean
maxZoom
Max zoom to cluster points on (defaults to 14)
Numeric
radius
Radius of each cluster when clustering points
Int
Returns
Example
getSource
Parameters
id
The ID of the source to get.
String
Returns
style source
The style source with the specified ID or undefined if the ID corresponds to no existing sources.
Object
Example
setData
Parameters
data
A GeoJSON data object or a URL to one. The latter is preferable in the case of large GeoJSON files.
Object | string
Returns
Example
isSourceLoaded
Parameters
id
The ID of the source to be checked.
String
Returns
value
A Boolean indicating whether the source is loaded.
Boolean
Example
removeSource
Parameters
id
The ID of the source to remove.
String
Returns
Returns itself to allow for method chaining.
Example
Last updated