Region Menu
The Xweather WeatherBlox library includes several built-in regions that can be used with any of the map components and/or views to adjust the visible bounds displayed by a weather map. You can use one of the built-in regions or add your custom regions to use throughout the library.
Built-In Regions
Code | Description |
---|---|
world | World/Global |
nam | North America |
sam | South America |
eur | Europe |
afr | Africa |
mide | Middle East |
aus | Australia |
nas | Northern Asia |
sas | Southern Asia |
asia | Asia |
us | United States |
ca | Canada |
mx | Mexico |
crb | Caribbean |
usne | US - Northeast |
usce | US - Central Plains |
usse | US - Southeast |
usnc | US - Northern Plains |
usov | US - Lower Ohio Valley |
ussc | US - Southern Plains |
usnw | US - Pacific Northwest |
uswc | US - West Coast |
ussw | US - Southwest |
usah | US - Alaska |
ushi | US - Hawaii |
Adding Custom Regions
In addition the above built-in regions, you can also add your own custom regions to use with any maps component. To define a region, you will either need the region's bounding rectangle (northwest and southeast coordinates) or a center coordinate and zoom level.
Each region has the following object format:
{
name: undefined,
center: undefined,
bounds: undefined
}
To add a custom region using a bounding box, pass the four coordinate elements in an object and your unique key to associate with the region:
aeris.utils.regions.set('myregion', {
name: 'My New Region',
bounds: {
north: 56.26,
west: -131.39,
south: 15.45,
east: -61.17
}
});
To add a custom region centered on a coordinate, provide the coordinate as an object containing the latitude and longitude coordinate values and the zoom level (if desired):
aeris.utils.regions.set('myregion', {
name: 'My New Region',
center: {
lat: xxxx,
lon: xxx,
zoom: 7
}
});
You can retrieve a saved region at any time as well:
const region = aeris.utils.regions.get('myregion');