Main Content

geographicToIntrinsic

Transform geographic to intrinsic coordinates

Description

[xIntrinsic,yIntrinsic] = geographicToIntrinsic(R,lat,lon) returns the intrinsic coordinates corresponding to geographic coordinates lat and lon in geographic raster R.

example

Examples

collapse all

Find the intrinsic coordinates of a cell within a raster by specifying a raster reference object and geographic coordinates.

First, load a geographic cells reference object for the Korean peninsula. To do this, load the korea5cR variable from the korea5c MAT-file. Then, specify the geographic coordinates of Seoul.

load korea5c korea5cR
lat = 37.57;
lon = 126.98;

Find the intrinsic coordinates.

[xIntrinsic,yIntrinsic] = geographicToIntrinsic(korea5cR,lat,lon)
xIntrinsic = 
144.2600
yIntrinsic = 
91.3400

The result means that the geographic coordinates are in the cell in column 144 and row 91 of the raster.

You can reverse the operation by using the intrinsicToGeographic function.

[lat,lon] = intrinsicToGeographic(korea5cR,xIntrinsic,yIntrinsic)
lat = 
37.5700
lon = 
126.9800

Input Arguments

collapse all

Geographic raster, specified as a GeographicCellsReference or GeographicPostingsReference object.

Latitude coordinates, specified as a numeric array. Valid values of lat are in the range [-90, 90] degrees or are NaN. lat coordinates can be outside the bounds of the raster R.

Data Types: single | double

Longitude coordinates, specified as a numeric array. lon is the same size as lat. lon coordinates can be outside the bounds of the raster R.

Data Types: single | double

Output Arguments

collapse all

x-coordinates in intrinsic coordinate system, returned as a numeric array. xIntrinsic is the same size as lat.

When lon(k) is outside the bounds of raster R, xIntrinsic(k) is extrapolated in the intrinsic coordinate system.

Data Types: double

y-coordinates in intrinsic coordinate system, returned as a numeric array. yIntrinsic is the same size as lat.

When lat(k) is valid and outside the bounds of raster R, yIntrinsic(k) is extrapolated in the intrinsic coordinate system.

Data Types: double

Version History

Introduced in R2013b