@windy/map
Already initialized instance of Leaflet map and other map related functions and stuff
Instance of Leaflet map is available as map in this module.
Windy.com uses Leaflet version 1.4.0 that is well documented here and contains plenty of plugins that you can use.
Table of contents
Variables
Functions
Variables
map
• Const map: Map
Already initialized instance of Leaflet L.Map
Example
import { map } from '@windy/map';
map.on('zoomend', () => {
console.log('Map was zoomed');
});mapLibre
• Const mapLibre: Object
Following object (singleton) contains all the stuff required for integration of mapLibre Gl into the client.
Type declaration
| Name | Type | Description |
|---|---|---|
wrapper | MapLibreMap | null | Instance of our own mapLibre map wrapper Class |
markers
• Const markers: Record<string, L.DivIcon>
Already initialized reusable set of minimalistic Leaflet markers
icon Pulsating icon
pulsatingIcon Pulsating icon forever
myLocationIcon Blue icon of user's location
Example
import { map, markers } from '@windy/map';
const myPulsatingMarker = L.marker([ 50, 14 ], {
icon: markers.pulsatingIcon
}).addTo( map );Functions
fitBounds
▸ fitBounds(boundsArray, options?): void
fitBounds either in Leaflet or in mapLibre using [ W, S, E, N ] coordinates.
Parameters
| Name | Type |
|---|---|
boundsArray | [number, number, number, number] |
options? | SimplifiedGetBoundsOptions |
Returns
void
isGlobeActive
▸ isGlobeActive(): boolean
Just handy shortcut to detect that globe is active
Returns
boolean
toggleLandMask
▸ toggleLandMask(landOnly): void
Parameters
| Name | Type |
|---|---|
landOnly | boolean |
Returns
void
toggleSeaMask
▸ toggleSeaMask(hasSea): void
Parameters
| Name | Type |
|---|---|
hasSea | boolean |
Returns
void