Main Content

pix2latlon

(Removed) Convert pixel coordinates to latitude-longitude coordinates

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

Syntax

[lat, lon] = pix2latlon(R,row,col)

Description

[lat, lon] = pix2latlon(R,row,col) calculates latitude-longitude coordinates lat, lon from pixel coordinates row, col. R is either a 3-by-2 referencing matrix that transforms intrinsic pixel coordinates to geographic coordinates, or a geographic raster reference object. row and col are vectors or arrays of matching size. The outputs lat and lon have the same size as row and col.

Examples

Find the latitude and longitude of the upper left outer corner of a gridded data set.

load korea5c
[UL_lat,UL_lon] = pix2latlon(korea5cR,0.5,0.5)

The output appears as follows:

UL_lat =

    30


UL_lon =

   115

Version History

Introduced before R2006a

expand all

R2024b: Removed

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

  • Unlike referencing 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 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 matrix to a reference object using the refmatToGeoRasterReference function.

Then, replace uses of the pix2latlon function with the intrinsicToGeographic function according to this pattern.

RemovedRecommended
[lat,lon] = pix2latlon(R,row,col);
[lat,lon] = intrinsicToGeographic(R,col,row);