Reference
Regions

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

CodeDescription
worldWorld/Global
namNorth America
samSouth America
eurEurope
afrAfrica
mideMiddle East
ausAustralia
nasNorthern Asia
sasSouthern Asia
asiaAsia
us United States
ca Canada
mx Mexico
crbCaribbean
usneUS - Northeast
usceUS - Central Plains
usseUS - Southeast
usncUS - Northern Plains
usovUS - Lower Ohio Valley
usscUS - Southern Plains
usnwUS - Pacific Northwest
uswcUS - West Coast
usswUS - Southwest
usahUS - Alaska
ushiUS - 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');