referenceEllipsoid
参考椭球体
说明
referenceEllipsoid 对象封装了一个参考椭球体,该椭球体被建模为一个扁球体,并具有三个附加属性:名称、长轴和短轴的长度单位,以及一个数值 EPSG 代码。
创建对象
创建参考椭球体对象有多种方法,包括:
创建一个
geocrs对象,然后查询其Spheroid属性。创建一个
projcrs对象,访问其GeographicCRS属性中包含的geocrs对象,然后查询geocrs的Spheroid属性。使用
wgs84Ellipsoid函数为 1984 年世界大地测量系统 (WGS84) 创建一个参考椭球体。使用
referenceEllipsoid函数(详见此处说明)。
语法
描述
E = referenceEllipsoid 创建了一个名为 referenceEllipsoid 的对象,该对象表示单位球体。
E = referenceEllipsoid( 会创建一个与 name)name 对应的 referenceEllipsoid 对象。name 不区分大小写。SemimajorAxis 和 SemiminorAxis 属性的值单位为米。
E = referenceEllipsoid( 会创建一个与数值 EPSG 代码 code)code 对应的 referenceEllipsoid 对象。SemimajorAxis 和 SemiminorAxis 属性所使用的长度单位取决于所选椭球体,并在 LengthUnit 属性中予以标明。
E = referenceEllipsoid( 和name,lengthUnit)
E = referenceEllipsoid( 创建一个 code,lengthUnit)referenceEllipsoid 对象,其 SemimajorAxis 和 SemiminorAxis 属性以指定的长度单位 LengthUnit 为单位。长度单位可以是 validateLengthUnit 函数支持的任何长度单位。
输入参量
参考椭球体的名称,指定为EPSG 椭球体的名称表中的某个值。
数据类型: char | string
数值 EPSG 代码,指定为空向量或 7000 到 8000 之间的整数,但该范围内的并非所有整数都是有效的数值 EPSG 代码。有关有效 EPSG 代码的信息,请参阅 EPSG 主页。
数据类型: double
长度单位,指定为字符向量或字符串标量。您可以指定 validateLengthUnit 函数支持的任何长度单位。
| 值 | 单位名称 |
|---|---|
"m", "meter", "meters", "metre", "metres" | 米 |
"cm", "centimeter", "centimeters", "centimetre", "centimetres" | 厘米 |
"mm", "millimeter", "millimeters", "millimetre", "millimetres" | 毫米 |
"micron", "microns" | 微米 |
"km", "kilometer", "kilometers", "kilometre", "kilometers" | 公里 |
"nm", "naut mi", "nautical mile", "nautical miles" | 海里 |
"ft", "international ft", "foot", "international foot", "feet", "international feet" | 英尺 |
"in", "inch", "inches" | 英寸 |
"yd", "yds", "yard", "yards" | 码 |
"mi", "mile", "miles", "international mile", "international miles" | 英里 |
"sf", "survey ft", "US survey ft", "U.S. survey ft", "survey foot", "US survey foot", "U.S. survey foot", "survey feet", "US survey feet", "U.S. survey feet" | 美国测量英尺 |
"sm", "survey mile", "survey miles", "statute mile", "statute miles", "US survey mile", "US survey miles", "U.S. survey mile(s)", "U.S. survey miles" | 美国测量英里(法定英里) |
"Clarke's foot", "Clarkes foot" | 克拉克英尺 |
"German legal metre", "German legal meter" | 德国法定米制 |
"Indian foot" | 印度英尺 |
数据类型: char | string
属性
数值 EPSG 代码,指定为空向量或 7000 到 8000 之间的整数,但该范围内的并非所有整数都是有效的数值 EPSG 代码。有关有效 EPSG 代码的信息,请参阅 EPSG 主页。
当参考椭球体表示单位球面或自定义椭球体时,Code 是一个空向量 ([])。
示例: 7030
数据类型: double
参考椭球体的名称,指定为字符向量或字符串标量。通过指定名称来创建参考椭球体时,请使用EPSG 椭球体的名称表中的某个值。
当参考椭球表示单位球时,Name 即为特征向量 'Unit Sphere'。
示例: 'World Geodetic System 1984'
数据类型: char | string
椭球体轴的长度单位,指定为字符向量。该字符向量可以为空,也可以是 validateLengthUnit 函数所接受的任何长度单位。
当参考椭球体表示单位球面时,LengthUnit 即为空字符向量 ''。
示例: 'km'
数据类型: char | string
椭球体的赤道半径,指定为一个正的、有限的标量。SemimajorAxis 属性以 LengthUnit 指定的长度单位表示。
当 SemimajorAxis 属性发生变化时,SemiminorAxis 属性会根据需要进行缩放,以保持椭球体的形状以及包括 InverseFlattening 和 Eccentricity 在内的与形状相关的属性的值不变。修改 SemimajorAxis 属性的唯一方法是使用点表示法直接设置该属性。
示例: 6378137
数据类型: double
从椭球中心到极点的距离,指定为一个非负的、有限的标量。SemiminorAxis 的值始终小于或等于 SemimajorAxis,并以 LengthUnit 指定的长度单位表示。
当 SemiminorAxis 属性发生变化时,SemimajorAxis 属性保持不变,但椭球体的形状会发生变化,这体现在 InverseFlattening、Eccentricity 以及其他与形状相关的属性的值发生变化上。
示例: 6356752
数据类型: double
平滑度的倒数,指定为取值范围在 [1, Inf] 内的正标量。
反平滑的值 1/f 是根据 1/f = a/(a-b),利用 SemimajorAxis 的值 a 和 SemiminorAxis 的值 b 计算得出的。Inf 的值 1/f 表示一个完美的球体。当 1/f 趋近于 1 时,参考椭球体趋近于一个扁平的圆盘。
当 InverseFlattening 属性发生变化时,其他与形状相关的属性也会随之更新,包括 Eccentricity。SemimajorAxis 属性保持不变,但 SemiminorAxis 的值会随之调整,以反映新的形状。
示例: 300
数据类型: double
椭球的第一偏心率,指定为取值范围在 [0, 1] 内的非负标量。
偏心率值 ecc 是根据 SemimajorAxis 的值 a 和 SemiminorAxis 的值 b,按照 ecc = sqrt(a2 - b2)/a 的规定计算得出的。值 ecc 为 0 表示一个完美的球体。
当 Eccentricity 属性发生变化时,其他与形状相关的属性也会随之更新,包括 InverseFlattening。SemimajorAxis 属性保持不变,但 SemiminorAxis 的值会随之调整,以反映新的形状。
示例: 0.08
数据类型: double
此 属性 为只读。
椭球体的扁率,指定为取值范围在 [0, 1] 内的非负标量。
平滑值 f 是根据 f = (a-b)/a,利用 SemimajorAxis 的值 a 和 SemiminorAxis 的值 b 计算得出的。
数据类型: double
此 属性 为只读。
椭球体的第三个扁率,指定为取值范围在 [0, 1] 内的非负标量。
第三次展平的值 n 是根据 n = (a-b)/(a+b),利用 SemimajorAxis 的值 a 和 SemiminorAxis 的值 b 计算得出的。
数据类型: double
此 属性 为只读。
椭球体的平均半径,指定为正的、有限的标量。MeanRadius 属性以 LengthUnit 指定的长度单位表示。
椭球体的平均半径 r 是根据 SemimajorAxis 的值 a 和 SemiminorAxis 的值 b,按照 r = (2a+b)/3 的方法计算得出的。
数据类型: double
此 属性 为只读。
椭球体的表面积,指定为正的、有限的标量。SurfaceArea 属性单位的单位与 LengthUnit 属性指定的长度单位保持一致。
数据类型: double
此 属性 为只读。
椭球体的体积,指定为正的、有限的标量。Volume 属性以与 LengthUnit 属性指定的长度单位相一致的体积单位表示。
数据类型: double
示例
通过指定椭球体的名称来创建一个参考椭球体对象。
e = referenceEllipsoid('GRS 1980')e =
referenceEllipsoid with defining properties:
Code: 7019
Name: 'GRS 1980'
LengthUnit: 'meter'
SemimajorAxis: 6378137
SemiminorAxis: 6356752.31414036
InverseFlattening: 298.257222101
Eccentricity: 0.0818191910428158
and additional properties:
Flattening
ThirdFlattening
MeanRadius
SurfaceArea
Volume
通过指定 EPSG 代码 7019 来创建相同的参考椭球体对象。
e = referenceEllipsoid(7019)
e =
referenceEllipsoid with defining properties:
Code: 7019
Name: 'GRS 1980'
LengthUnit: 'meter'
SemimajorAxis: 6378137
SemiminorAxis: 6356752.31414036
InverseFlattening: 298.257222101
Eccentricity: 0.0818191910428158
and additional properties:
Flattening
ThirdFlattening
MeanRadius
SurfaceArea
Volume
创建一个参考椭球体对象,并指定单位。对于长度单位,您可以指定 validateLengthUnit 函数支持的任何长度单位。
e = referenceEllipsoid('GRS80','km')
e =
referenceEllipsoid with defining properties:
Code: 7019
Name: 'GRS 1980'
LengthUnit: 'kilometer'
SemimajorAxis: 6378.137
SemiminorAxis: 6356.75231414036
InverseFlattening: 298.257222101
Eccentricity: 0.0818191910428158
and additional properties:
Flattening
ThirdFlattening
MeanRadius
SurfaceArea
Volume
创建一个参考椭球体,并从文件中指定 GeoTIFFCodes.Ellipsoid 字段。
info = geotiffinfo('boston.tif');
e = referenceEllipsoid(info.GeoTIFFCodes.Ellipsoid)e =
referenceEllipsoid with defining properties:
Code: 7019
Name: 'GRS 1980'
LengthUnit: 'meter'
SemimajorAxis: 6378137
SemiminorAxis: 6356752.31414036
InverseFlattening: 298.257222101
Eccentricity: 0.0818191910428158
and additional properties:
Flattening
ThirdFlattening
MeanRadius
SurfaceArea
Volume
通过修改默认参考椭球的属性,创建一个自定义参考椭球。
customPlanet = referenceEllipsoid; customPlanet.Name = 'Tiny Planet'; customPlanet.LengthUnit = 'meter'; customPlanet.SemimajorAxis = 8000; customPlanet.SemiminorAxis = 7900
customPlanet =
referenceEllipsoid with defining properties:
Code: []
Name: 'Tiny Planet'
LengthUnit: 'meter'
SemimajorAxis: 8000
SemiminorAxis: 7900
InverseFlattening: 80
Eccentricity: 0.157619002661481
and additional properties:
Flattening
ThirdFlattening
MeanRadius
SurfaceArea
Volume
您可以从地理坐标参考系 (CRS) 或投影坐标参考系 (CRS) 中获取参考椭球体。
从地理坐标参考系统获取椭球体
将一个包含世界各城市数据的 shapefile 文件作为地理空间表导入工作区。该表格通过形状对象以地理坐标形式展示了各城市的位置。
GT = readgeotable("worldcities.shp");通过查询 GeographicCRS 属性,从形状对象中获取地理坐标参考系统 (CRS)。然后,通过查询坐标参考系统 (CRS) 的 Spheroid 属性来获取参考椭球体。
gcrs1 = GT.Shape.GeographicCRS; E1 = gcrs1.Spheroid
E1 =
referenceEllipsoid with defining properties:
Code: 7030
Name: 'WGS 84'
LengthUnit: 'meter'
SemimajorAxis: 6378137
SemiminorAxis: 6356752.31424518
InverseFlattening: 298.257223563
Eccentricity: 0.0818191908426215
and additional properties:
Flattening
ThirdFlattening
MeanRadius
SurfaceArea
Volume
从投影坐标系获取椭球体
使用 georasterinfo 函数获取波士顿 GeoTIFF 图像的相关信息。该文件包含投影坐标系下的栅格数据。
info = georasterinfo("boston.tif");通过查询 CoordinateReferenceSystem 属性,从返回的 RasterInfo 对象中获取预估的 CRS。通过查询 GeographicCRS 属性,从投影坐标参考系统中获取地理坐标参考系统。然后,通过查询地理坐标参考系统 (CRS) 的 Spheroid 属性来获取参考椭球体。
pcrs = info.CoordinateReferenceSystem; gcrs2 = pcrs.GeographicCRS; E2 = gcrs2.Spheroid
E2 =
referenceEllipsoid with defining properties:
Code: 7019
Name: 'GRS 1980'
LengthUnit: 'meter'
SemimajorAxis: 6378137
SemiminorAxis: 6356752.31414036
InverseFlattening: 298.257222101
Eccentricity: 0.0818191910428158
and additional properties:
Flattening
ThirdFlattening
MeanRadius
SurfaceArea
Volume
详细信息
EPSG 椭球体表中近 60 个代码均受支持。可以通过指定名称来创建这些椭球体中的一组子集。这些椭球体的短名和长名及其对应的代码均列于下表中。您可以通过指定其代码、简称或全称来创建一个参考椭球体。
| EPSG 代码 | 简称 | 长名称 |
|---|---|---|
| — | 'unitsphere' | 'Unit Sphere' |
| 7035 | 'sphere' | 'Sphere' |
| 7019 | 'grs80' | 'GRS 1980' |
| 7030 | 'wgs84' | 'WGS 84' |
| 7015 | 'everest' | 'Everest 1830 (1837 Adjustment)' |
| 7004 | 'bessel' | 'Bessel 1841' |
| 7001 | 'airy1830' | 'Airy 1830' |
| 7002 | 'airy1849' | 'Airy Modified 1849' |
| 7008 | 'clarke66' | 'Clarke 1866' |
| 7012 | 'clarke80' | 'Clarke 1880 (RGS)' |
| 7022 | 'international' | 'International 1924' |
| 7024 | 'krasovsky' | 'Krassowsky 1940' |
| 7043 | 'wgs72' | 'WGS 72' |
| — | 'wgs60' | 'World Geodetic System 1960' |
| — | 'iau65' | 'International Astronomical Union 1965' |
| — | 'wgs66' | 'World Geodetic System 1966' |
| — | 'iau68' | 'International Astronomical Union 1968' |
| 7030 | 'earth' | 'WGS 84' |
| — | 'sun' | 'Sun' |
| — | 'moon' | 'Moon' |
| — | 'mercury' | 'Mercury' |
| — | 'venus' | 'Venus' |
| — | 'mars' | 'Mars' |
| — | 'jupiter' | 'Jupiter' |
| — | 'saturn' | 'Saturn' |
| — | 'uranus' | 'Uranus' |
| — | 'neptune' | 'Neptune' |
| — | 'pluto' | 'Pluto' |
提示
当您通过长半轴和短半轴来定义椭球体时(而非通过长半轴和扁率倒数,或长半轴和偏心率),
Flattening、Eccentricity和ThirdFlattening的最后几位数字可能会出现轻微的精度损失。这是不可避免的,但不会影响实际计算的结果。
版本历史记录
在 R2012a 中推出从 R2020b 版本开始,referenceEllipsoid 对象的 Name 属性始终包含椭球体在 EPSG 大地测量数据库中的名称。在 R2020a 及更早版本中,Name 属性的值取决于您用于创建该对象的名称或代码。
例如,使用 WGS84 参考系统创建两个 referenceEllipsoid 对象。通过指定其 EPSG 代码来创建第一个对象,并通过指定其名称来创建第二个对象。在 R2020b 及后续版本中,两个 referenceEllipsoid 对象的 Name 属性值相同。在 R2020a 及更早版本中,Name 属性的值并不相同。
r1 = referenceEllipsoid(7030);
r2 = referenceEllipsoid('World Geodetic System 1984');
r1.Name
r2.Name| R2020b 及更高版本 | R2020a 及更早版本 |
|---|---|
ans =
'WGS 84'
ans =
'WGS 84'
|
ans =
'WGS 84'
ans =
'World Geodetic System 1984'
|
如果您现有的代码中是通过向 referenceEllipsoid 创建函数指定名称来创建参考椭球体对象的,则无需更新代码以使其与 EPSG 大地测量数据库中的名称相对应。
有关 EPSG 大地测量数据库的更多信息,请参阅 EPSG 主页。
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)