Main Content

wmlimits

Set or obtain web map limits

Description

example

wmlimits(latitudeLimits,longitudeLimits) center the current web map within the specified latitude limits and the longitude limits. If there is no current web map, wmlimits creates one.

Note

The resulting limits often do not match the specified limits because the zoom level is quantized to discrete integer values and the longitude limits may be constrained if the map was constructed with the WrapAround property equal to false.

example

wmlimits(wm,latitudeLimits,longitudeLimits) centers the web map specified by the web map handle wm within the specified latitude limits and longitude limits.

example

[latlim,lonlim] = wmlimits() returns the latitude and longitude limits of the current web map.

[latlim,lonlim] = wmlimits(wm) returns the latitude and longitude limits of the web map specified by wm.

Examples

collapse all

Specify latitude and longitude limits. wmlimits creates the web map.

wmlimits([37 42],[-108.9 -100.7])

Get the latitude and longitude limits of the current web map. The limits returned by wmlimits depend on the size of the web map browser and the zoom level. Therefore, your results may differ from the results shown here.

[latitudeLimits,longitudeLimits] = wmlimits()
latitudeLimits =

   34.8844   43.9124


longitudeLimits =

 -112.9738  -96.6262

Create two web maps, specifying different base layers.

wm1 = webmap('OpenStreetMap');
wm2 = webmap('USGSImagery');

View both maps at the same time by clicking the tile vertically button in the web map toolbar.

Specify latitude and longitude limits and apply to both maps to get two different views of the same region.

latitudeLimits = [37, 42];
longitudeLimits = [-108.9, -100.7];
wmlimits(wm1, latitudeLimits, longitudeLimits)
wmlimits(wm2, latitudeLimits, longitudeLimits)

Input Arguments

collapse all

Latitude limits in degrees, specified as a 1-by-2 row vector of type double of the form [southern-limit northern-limit].

Example: [37, 42]

Data Types: double

Longitude limits in degrees, specified as a 1-by-2 row vector of type double of the form [western-limit eastern-limit].

Example: [-108.9, -100.7]

Data Types: double

Web map, specified as a scalar web map handle.[1]

Output Arguments

collapse all

Latitude limits in degrees, returned as a 1-by-2 row vector of type double.

Example: [37, 42]

Data Types: double

Longitude limits in degrees, returned as a 1-by-2 row vector of type double.

Example: [-108.9, -100.7]

Data Types: double

Introduced in R2013b

[1] Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.