Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

geodetic2ecef

Transform geodetic to geocentric (ECEF) coordinates

Syntax

[X,Y,z] = geodetic2ecef(spheroid,lat,lon,h)
[X,Y,Z] = geodetic2ecef(___,angleUnit)
[X,Y,Z] = geodetic2ecef(lat,lon,h,spheroid)

Description

example

[X,Y,z] = geodetic2ecef(spheroid,lat,lon,h) transforms geodetic point locations specified by the geodetic coordinate arrays lat (geodetic latitude), lon (longitude), and h (ellipsoidal height) to geocentric Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates x, y, and z. The geodetic coordinates refer to the reference body specified by the spheroid object, spheroid.

[X,Y,Z] = geodetic2ecef(___,angleUnit) where angleUnit specifies the units of the latitude and longitude coordinates, either 'degrees' or 'radians'.

[X,Y,Z] = geodetic2ecef(lat,lon,h,spheroid) This syntax is supported but not recommended. lat and lon must be in radians. spheroid can be either a spheroid or an ellipsoid vector of the form: [semimajor_axis, eccentricity]. In this case, h must use the same units as the semimajor axis. X, Y, and Z will be expressed in these units also.

Examples

collapse all

Convert the geodetic coordinates for Paris, France (48 degrees 51 minutes 24 seconds North, 2 degrees 21 minutes 03 seconds East) to geocentric Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates.

lat = dms2degrees([48 51 24])
lat = 48.8567
lon = dms2degrees([2 21 03])
lon = 2.3508
h = 80;
wgs84 = wgs84Ellipsoid('meters');
[x,y,z] = geodetic2ecef(wgs84,lat,lon,h)
x = 4.2010e+06
y = 1.7246e+05
z = 4.7801e+06

Input Arguments

collapse all

Reference spheroid, specified as a referenceEllipsoid, oblateSpheroid, or referenceSphere object. To create a spheroid object, use the creation function specific to the object, or the wgs84Ellipsoid function.

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

Geodetic latitudes of one or more points, specified as a scalar value, vector, matrix, or N-D array. Values must be in units that match the input argument angleUnit, if supplied, and in degrees, otherwise.

Data Types: single | double

Longitudes of one or more points, specified as a scalar value, vector, matrix, or N-D array. Values must be in units that match the input argument angleUnit, if supplied, and in degrees, otherwise.

Data Types: single | double

Ellipsoidal height, specified as a scalar. h must be expressed in the same length unit as the spheroid.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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

Data Types: char

Output Arguments

collapse all

x-coordinates of one or more points in the spheroid-centric ECEF system, returned as a scalar value, vector, matrix, or N-D array. Units are determined by the LengthUnit property of the spheroid object.

y-coordinates of one or more points in the spheroid-centric ECEF system, returned as a scalar value, vector, matrix, or N-D array. Units are determined by the LengthUnit property of the spheroid object.

z-coordinates of one or more points in the spheroid-centric ECEF system, returned as a scalar value, vector, matrix, or N-D array. Units are determined by the LengthUnit property of the spheroid object.

Tips

  • The geocentric Cartesian (ECEF) coordinate system is fixed with respect to the Earth, with its origin at the center of the spheroid and its positive X-, Y-, and Z axes intersecting the surface at the following points:

     LatitudeLongitude Notes
    X-axis00Equator at the Prime Meridian
    Y-axis090Equator at 90-degrees East
    Z-zxis900North Pole

Introduced in R2012b

Was this topic helpful?