# setltln

(Removed) Convert data grid rows and columns to latitude-longitude

The setltln function has been removed. Use the intrinsicToGeographic function instead. For more information, see Version History.

## Syntax

[lat, lon] = setltln(Z, R, row, col)
[lat, lon, indxPointOutsideGrid] = setltln(Z, R, row, col)
latlon = setltln(Z, R, row, col)

## Description

[lat, lon] = setltln(Z, R, row, col) returns the latitude and longitudes associated with the input row and column coordinates of the regular data grid Z. 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 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. Points falling outside the grid are ignored in row and col. All input angles are in degrees.

[lat, lon, indxPointOutsideGrid] = setltln(Z, R, row, col) returns the indices of the elements of the row and col vectors that lie outside the input grid. The outputs lat and lon always ignore these points; the third output accounts for them.

latlon = setltln(Z, R, row, col) returns the coordinates in a single two-column matrix of the form [latitude longitude].

## Examples

Load elevation raster data and a geographic cells reference object. Then, find the coordinates of row 45 and column 65.

[lat,lon,indxPointOutsideGrid] = setltln(topo60c,topo60cR,45,65)
lat =

-45.5000

lon =

64.5000

indxPointOutsideGrid =

[]

The third output argument is empty because the point is valid.

## Version History

Introduced before R2006a

expand all

### R2024a: Errors

Some functions that accept referencing vectors or referencing matrices as input have been removed, including the setltln function. Use a geographic raster reference object and the intrinsicToGeographic function instead. Reference objects have several advantages over referencing vectors and matrices.

• Unlike referencing vectors and matrices, reference objects have properties that document the size of the associated raster, its geographic limits, and the direction of its rows and columns. For more information about reference object properties, see the GeographicCellsReference and GeographicPostingsReference objects.

• You can manipulate the limits of rasters associated with reference objects using the geocrop function.

• You can manipulate the size and resolution of rasters associated with reference objects using the georesize function.

• Most functions that accept referencing vectors or matrices as inputs also accept reference objects.

To update your code, first create a reference object for either a raster of cells using the georefcells function or a raster of regularly posted samples using the georefpostings function. Alternatively, convert from a referencing vector or a referencing matrix to a reference object using the refvecToGeoRasterReference or refmatToGeoRasterReference function, respectively.

Then, replace uses of the setltln function with the intrinsicToGeographic function according to these patterns. Note that the intrinsicToGeographic function does not round the row and column coordinates. Additionally, the intrinsicToGeographic function extrapolates points outside the raster limits instead of discarding them.

RemovedRecommended
[lat,lon] = setltln(A,R,row,col);
[lat,lon] = intrinsicToGeographic(R, ...
round(col),round(row));
lat(~contains(R,lat,lon)) = [];
lon(~contains(R,lat,lon)) = [];
[lat,lon,indxPointOutsideGrid] = setltln(A,R,row,col);
[lat,lon] = intrinsicToGeographic(R, ...
round(col),round(row));
lat(~contains(R,lat,lon)) = [];
lon(~contains(R,lat,lon)) = [];
indxPointOutsideGrid = find(~contains(R,lat,lon));
latlon = setltln(A,R,row,col);
[lat,lon] = intrinsicToGeographic(R, ...
round(col),round(row));
lat(~contains(R,lat,lon)) = [];
lon(~contains(R,lat,lon)) = [];
latlon = [lat(:) lon(:)];