Sources
The source types FATOS GL JS can handle in addition to the ones described in th FATOS Style Specification
setSource
Adds a source to the map's style.
map.setSource(id, geoJson, cluster, maxZoom, radius)
Required Parameter
Description
Type
id
The ID of the source to add. Must not conflict with existing sources.
String
geoJson
A source containing GeoJSON.
Object
Optional Parameter
Description
Type
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
Example
map.setSource('some id', {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [ 126.896038, 37.482901]
}
}]
},
//If you want to use the cluster
true, //cluster
15, // maxZoom to cluster
50 // radius
);
Last updated