Skip to Main Content Skip to Search
Product Documentation

setltln - Convert data grid rows and columns to latitude-longitude

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 spatialref.GeoRasterReference object, a referencing vector, or a referencing matrix.

If R is a spatialref.GeoRasterReference 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

Find the coordinates of row 45, column 65 of topo:

load topo
[lat,lon,indxPointOutsideGrid] = setltln(topo,topolegend,45,65)

lat =
  -45.5000
lon =
   64.5000
indxPointOutsideGrid = [] % Empty because the point is valid

See Also

ltln2val | pix2latlon | setpostn

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS