geodetic2enu

Transform geodetic coordinates to local east-north-up

Description

example

[xEast,yNorth,zUp] = geodetic2enu(lat,lon,h,lat0,lon0,h0,spheroid) transforms the geodetic coordinates specified by lat, lon, and h to the local east-north-up (ENU) Cartesian coordinates specified by xEast, yNorth, and zDown. Specify the origin of the local ENU system with the geodetic coordinates lat0, lon0, and h0. Each coordinate input argument must match the others in size or be scalar. Specify spheroid as the reference spheroid for the geodetic coordinates.

[xEast,yNorth,zUp] = geodetic2enu(___,angleUnit) specifies the units for latitude and longitude. Specify angleUnit as 'degrees' (the default) or 'radians'.

Examples

collapse all

Find the ENU coordinates of the Matterhorn with respect to Zermatt, Switzerland, using their geodetic coordinates.

First, specify the reference spheroid as WGS84. For more information about WGS84, see Reference Spheroids. The units for ellipsoidal height and ENU coordinates must match the units specified by the LengthUnit property of the reference spheroid. The default length unit for the reference spheroid created by wgs84Ellipsoid is 'meter'.

wgs84 = wgs84Ellipsoid;

Specify the geodetic coordinates of the local origin. In this example, the local origin is Zermatt, Switzerland. Specify h0 as ellipsoidal height in meters.

lat0 = 46.017;
lon0 = 7.750;
h0 = 1673;

Specify the geodetic coordinates of the point of interest. In this example, the point of interest is the Matterhorn. Specify h as ellipsoidal height in meters.

lat = 45.976;
lon = 7.658;
h = 4531;

Then, calculate the ENU coordinates of the Matterhorn with respect to Zermatt. View the results in standard notation by specifying the display format as shortG.

format shortG
[xEast,yNorth,zUp] = geodetic2enu(lat,lon,h,lat0,lon0,h0,wgs84)
xEast = 
      -7134.8

yNorth = 
      -4556.3

zUp = 
       2852.4

Reverse the transformation using the enu2geodetic function.

[lat,lon,h] = enu2geodetic(xEast,yNorth,zUp,lat0,lon0,h0,wgs84)
lat = 
       45.976

lon = 
        7.658

h = 
        4531

Input Arguments

collapse all

Geodetic latitude of one or more points, specified as a scalar, vector, matrix, or N-D array. Specify the values in degrees. To use values in radians, specify the angleUnit argument as 'radians'.

Data Types: single | double

Geodetic longitude of one or more points, specified as a scalar, vector, matrix, or N-D array. Specify the values in degrees. To use values in radians, specify the angleUnit argument as 'radians'.

Data Types: single | double

Ellipsoidal height of one or more points, specified as a scalar, vector, matrix, or N-D array. Specify values in units that match the LengthUnit property of the spheroid object. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

Data Types: single | double

Geodetic latitude of the local origin, specified as a scalar, vector, matrix, or N-D array. The local origin can refer to one point or a series of points (for example, a moving platform). Specify the values in degrees. To use values in radians, specify the angleUnit argument as 'radians'.

Data Types: single | double

Geodetic longitude of the local origin, specified as a scalar, vector, matrix, or N-D array. The local origin can refer to one point or a series of points (for example, a moving platform). Specify the values in degrees. To use values in radians, specify the angleUnit argument as 'radians'.

Data Types: single | double

Ellipsoidal height of the local origin, specified as a scalar, vector, matrix, or N-D array. The local origin can refer to one point or a series of points (for example, a moving platform). Specify values in units that match the LengthUnit property of the spheroid object. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

Data Types: single | double

Reference spheroid, specified as a referenceEllipsoid object, oblateSpheroid object, or referenceSphere object. The term reference spheroid is used synonymously with reference ellipsoid. To create a reference spheroid, use the creation function for the object. To specify the reference ellipsoid for WGS84, use the wgs84Ellipsoid function.

For more information about reference spheroids, see Reference Spheroids.

Example: spheroid = referenceEllipsoid('GRS 80');

Units of angles, specified as 'degrees' (the default) or 'radians'.

Data Types: char | string

Output Arguments

collapse all

ENU x-coordinates of one or more points in the local ENU system, returned as a scalar, vector, matrix, or N-D array. Units are specified by the LengthUnit property of the spheroid argument. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

ENU y-coordinates of one or more points in the local ENU system, returned as a scalar, vector, matrix, or N-D array. Units are specified by the LengthUnit property of the spheroid argument. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

ENU z-coordinates of one or more points in the local ENU system, returned as a scalar, vector, matrix, or N-D array. Units are specified by the LengthUnit property of the spheroid argument. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

Introduced in R2012b