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.
Parameter
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
getSource
Returns the source with the specified ID in the map's style.
Parameter
Required Parameter | Description | Type |
---|---|---|
id | The ID of the source to get. | String |
Returns
Object : The style source with the specified ID or undefined
if the ID corresponds to no existing sources.
Example
setData
Sets the GeoJSON data and re-renders the map.
Parameter
Required Parameter | Description | Type |
---|---|---|
data | A GeoJSON data object or a URL to one. The latter is preferable in the case of large GeoJSON files. | Object | string |
Example
isSourceLoaded
Returns a Boolean indicating whether the source is loaded. Returns true
if the source with the given ID in the map's style has no outstanding network requests, otherwise false
.
Parameter
Required Parameter | Description | Type |
---|---|---|
id | The ID of the source to be checked. | String |
Returns
boolean : A Boolean indicating whether the source is loaded.
Example
removeSource
Removes a source from the map's style.
Parameter
Required Parameter | Description | Type |
---|---|---|
id | The ID of the source to remove. | String |
Returns
Map : Returns itself to allow for method chaining.
Example
Last updated