latlon2pix
(Removed) Convert latitude-longitude coordinates to pixel coordinates
The latlon2pix function has been removed. Use the geographicToIntrinsic
function instead. For more information, see Version History.
Syntax
[row, col ] = latlon2pix(R,lat,lon)
Description
[row, col ] = latlon2pix(R,lat,lon) calculates pixel
coordinates row, col from latitude-longitude coordinates
lat, lon. R is either a 3-by-2
referencing matrix that transforms intrinsic pixel coordinates to geographic coordinates, or a
geographic raster reference object. lat and lon are vectors
or arrays of matching size. The outputs row and col have
the same size as lat and lon. lat and
lon must be in degrees.
Longitude wrapping is handled in the following way: Results are invariant under the
substitution lon = lon +/- n * 360 where n is an integer.
Any point on the Earth that is included in the image or gridded data set corresponding to
r will yield row/column values between 0.5 and 0.5 + the image height/width,
regardless of what longitude convention is used.
Examples
Find the pixel coordinates of the upper left and lower right outer corners of a 2-by-2 degree gridded data set.
R = georefcells([-90 90],[0 360],2,2,'ColumnsStartFrom','north') [UL_row, UL_col] = latlon2pix(R, 90, 0) % Upper left [LR_row, LR_col] = latlon2pix(R, -90, 360) % Lower right