Methods
(static) leafletMap(opts) → {module:slippyMap~api}
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
Object | Initialisation options.
Properties
|
- Source:
Returns:
Returns an API for the map.
- Type
- module:slippyMap~api
(inner) addBasemapLayer(config)
This function is exposed as a method on the API returned from the leafletMap function.
Provides a method to add a basemap layer after the map is created.
Parameters:
Name | Type | Description |
---|---|---|
config |
basemapConfig | a configuration object to define the new layer. |
- Source:
(inner) addGeojsonLayer(config)
This function is exposed as a method on the API returned from the leafletMap function.
Provides a method to add a geojson layer after the map is created.
Parameters:
Name | Type | Description |
---|---|---|
config |
geojsonConfig | a configuration object to define the new layer. |
- Source:
(inner) changeClusterThreshold(clusterZoomThreshold)
This function allows you to change the clustering threshold zoom level for point maps.
Parameters:
Name | Type | Description |
---|---|---|
clusterZoomThreshold |
number | The leaflet zoom level above which clustering will be turned off. |
- Source:
(inner) clearMap()
This function is exposed as a method on the API returned from the leafletMap function.
Clear the map of dots and legend.
- Source:
(inner) downloadData(asGeojson)
This function is exposed as a method on the API returned from the leafletMap function.
Parameters:
Name | Type | Description |
---|---|---|
asGeojson |
boolean | a boolean value that indicates whether to generate GeoJson (if false, generates CSV). |
- Source:
(inner) invalidateSize()
This function is exposed as a method on the API returned from the leafletMap function.
Expose the leaflet map invalidate size method.
- Source:
(inner) redrawMap()
This function is exposed as a method on the API returned from the leafletMap function.
Redraw the map, e.g. after changing map accessor function or map identifier.
- Source:
(inner) removeBasemapLayer(mapName)
This function is exposed as a method on the API returned from the leafletMap function.
Provides a method to remove a basemap layer after the map is created.
Parameters:
Name | Type | Description |
---|---|---|
mapName |
string | the name by which the map layer is identified (appears in layer selection). |
- Source:
(inner) removeGeojsonLayer(mapName)
This function is exposed as a method on the API returned from the leafletMap function.
Provides a method to remove a geojson layer after the map is created.
Parameters:
Name | Type | Description |
---|---|---|
mapName |
string | the name by which the map layer is identified. |
- Source:
(inner) setIdentfier(identifier)
This function is exposed as a method on the API returned from the leafletMap function.
The data accessor function, specified elsewhere, will use this identifier to access
the correct data.
Parameters:
Name | Type | Description |
---|---|---|
identifier |
string | A string which identifies some data to a data accessor function. |
- Source:
(inner) setLegendOpts(lo)
This function is exposed as a method on the API returned from the leafletMap function.
The legend options object can be used to specify properties of a legend and even the content
of the legend itself.
Parameters:
Name | Type | Description |
---|---|---|
lo |
legendOpts | a legend options object. |
- Source:
(inner) setMapType(newMapTypesKey)
This function is exposed as a method on the API returned from the leafletMap function.
The data accessor is stored in the mapTypesSel object and referenced by this key.
Parameters:
Name | Type | Description |
---|---|---|
newMapTypesKey |
string | A string which a key used to identify a data accessor function. |
- Source:
(inner) setShowCountries(show)
This function allows you to change whether or not Country boundaries are displayed..
Parameters:
Name | Type | Description |
---|---|---|
show |
boolean | Indicates whether or not to display Countries. |
- Source:
(inner) setShowVcs(show)
This function allows you to change whether or not Vice County boundaries are displayed..
Parameters:
Name | Type | Description |
---|---|---|
show |
boolean | Indicates whether or not to display VCs. |
- Source:
(inner) setSize(width, height)
This function is exposed as a method on the API returned from the leafletMap function.
Change the size of the leaflet map.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | Width of the map. |
height |
number | Height of the map. |
- Source:
(inner) showOverlay(show)
This function allows you to show/hide the leaflet overlay layer (atlas layer).
Provides a method to show/hide the leaflet overlay layer used to display atlas data.
Parameters:
Name | Type | Description |
---|---|---|
show |
boolean | Set to true to display the layer, or false to hide it. |
- Source:
Type Definitions
api
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
setIdentfier |
module:slippyMap~setIdentfier | Identifies data to the data accessor function. |
setMapType |
module:slippyMap~setMapType | Set the key of the data accessor function. |
setLegendOpts |
module:slippyMap~setLegendOpts | Sets options for the legend. |
redrawMap |
module:slippyMap~redrawMap | Redraw the map. |
clearMap |
module:slippyMap~clearMap | Clear the map. |
setSize |
module:slippyMap~setSize | Reset the size of the leaflet map. |
invalidateSize |
module:slippyMap~invalidateSize | Access Leaflet's invalidateSize method. |
addBasemapLayer |
module:slippyMap~addBasemapLayer | Add a basemap to the map. |
removeBasemapLayer |
module:slippyMap~removeBasemapLayer | Remove a basemap from the map. |
addGeojsonLayer |
module:slippyMap~addGeojsonLayer | Add a geojson layer to the map. |
removeGeojsonLayer |
module:slippyMap~removeGeojsonLayer | Remove a geojson layer from the map. |
showOverlay |
module:slippyMap~showOverlay | Show/hide the overlay layer. |
changeClusterThreshold |
module:slippyMap~changeClusterThreshold | Change the zoom cluster threshold for points. |
setShowVcs |
module:slippyMap~setShowVcs | Set the boolean flag which indicates whether or not to display VCs. |
setShowCountries |
module:slippyMap~setShowCountries | Set the boolean flag which indicates whether or not to display Countries. |
downloadData |
module:slippyMap~downloadData | Download a the map data as a CSV or GeoJson file. |
lmap |
module:slippyMap~map | Returns a reference to the leaflet map object. |
- Source:
basemapConfig
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
name |
string | name of layer to be displayer in layer control. |
type |
string | either 'tileLayer' or 'wms'. |
selected |
boolean | indicate whether or not this is to be the layer initially selected. |
url |
string | the standard leaflet formatted URL for the layer. |
opts |
Object | standard leaflet layer options. |
- Source: