# wmlimits

Set or obtain web map limits

## Syntax

``wmlimits(latitudeLimits,longitudeLimits)``
``wmlimits(wm,latitudeLimits,longitudeLimits)``
``````[latlim,lonlim] = wmlimits()``````
``````[latlim,lonlim] = wmlimits(wm)``````

## 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. NoteThe 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.

`[latitudeLimits,longitudeLimits] = wmlimits()`
```latitudeLimits = 1×2 34.7311 44.0468 ```
```longitudeLimits = 1×2 -113.0397 -96.5603 ```

Create two web maps, specifying different base layers.

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

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`

## Version History

Introduced in R2013b