# limitm

Determine latitude and longitude limits of regular data grid

## Syntax

```[latlim,lonlim] = limitm(Z,R) latlonlim = limitm(Z,R) ```

## Description

`[latlim,lonlim] = limitm(Z,R)` computes the latitude and longitude limits of the geographic quadrangle bounding the regular data grid `Z` spatially referenced by `R`. `R` can be a geographic raster reference object, a referencing vector, or a referencing matrix.

If `R` is a geographic raster reference object, its `RasterSize` property must be consistent with `size(Z)`.

If `R` is a referencing vector, it must be 1-by-3 with elements:

`[cells/degree northern_latitude_limit western_longitude_limit]`
If `R` is a referencing matrix, it must be 3-by-2 and transform raster row and column indices to/from geographic coordinates according to:
`[lon lat] = [row col 1] * R`
If `R` is a referencing matrix, it must also define a (non-rotational, non-skewed) relationship in which each column of the data grid falls along a meridian and each row falls along a parallel. The output `latlim` is a vector of the form `[southern_limit northern_limit]` and `lonlim` is a vector of the form `[western_limit eastern_limit]`. All angles are in units of degrees.

`latlonlim = limitm(Z,R)` concatenates `latlim` and `lonlim` into a 1-by-4 row vector of the form:

`[southern_limit northern_limit western_limit eastern_limit]`

## Examples

Use a familiar data grid:

```load topo [latlimits,lonlimits] = limitm(topo,topolegend) latlimits = -90 90 lonlimits = 0 360```

The result is expected, because `topo` covers the whole globe. 