osgEarth的Rex引擎原理分析(三十五)osgEarth地球椭球体ellipsoid 大地基准面datum 地图投影Projection详解

osgEarth地球椭球体、基准面与投影详解
本文深入解析osgEarth中地球椭球体、大地基准面和地图投影的概念,包括Horizontal Datum、Vertical Datum的差异,以及常用坐标系统如WGS84、NAD83等。此外,探讨了地图投影的种类,如Spherical Mercator投影在Google Maps中的应用,并详述了osgEarth内置的垂直基准面,如EGM84、EGM96和EGM2008。文章还提及了不同测量系统对地理位置坐标的影响。

目标:(二十九)中的问题83

地球椭球体的中心为地心,形状为椭球体

大地基准面是适应某一区域的椭球体,球体中心不一定在地心

地图投影是球面和平面映射关系的方法

 

Horizontal Datum

A datum is a reference point (or set of points) against which geospatial measurements are made. The same location on earth can have different coordinates depending on which datum is in use. There are two classes of datum:

A horizontal datum measures positions on the earth. Since the earth is not a perfect sphere or even a perfect ellipsoid, particular datums are usually designed to approximate the shape of the earth in a particular region. Common datums include WGS84 and NAD83 in North America, and ETR89 in Europe.

Vertical Datum

A vertical datum measures elevation. There are several classes of vertical datum; osgEarth supports geodetic (based on an ellipsoid) and geoid (based on a sample set of elevation points around the planet).

osgEarth has the following vertical datums built in:

  • Geodetic - the default; osgEarth uses the Horizontal datum ellipsoid as a reference
  • EGM84 geoid
  • EGM96 geoid - commonly called MSL; used in DTED and KML
  • EGM2008 geoid

By default, SRS’s in osgEarth use a geodetic vertical datum; i.e., altitude is measured as “height above ellipsoid (HAE)”.

 

地理坐标系一般是指由经度、纬度和高度组成的坐标系,能够标示地球上的任何一个位置。前面提到了,不同地区可能会使用不同的参考椭球体,即使是使用相同的椭球体,也可能会为了让椭球体更好地吻合当地的大地水准面,而调整椭球体的方位,甚至大小。这就需要使用不同的大地测量系统(Geodetic datum)来标识。因此,对于地球上某一个位置来说,使用不同的测量系统,得到的坐标是不一样的。我们在处理地理数据时,必须先确认数据所用的测量系统。事实上,随着我们对地球形状测量的越来越精确,北美使用的 NAD83 基准和欧洲使用的 ETRS89 基准,与 WGS 84 基准是基本一致的,甚至我国的 CGCS2000 与WGS84之间的差异也是非常小的。但是差异非常小,不代表完全一致,以 NAD83 为例,因为它要保证北美地区的恒定,所以它与 WGS84 之间的差异在不断变化,对于美国大部分地区来说,每年有1-2cm的差异。

 

rex支持的投影见

osgEarth/SpatialReference.cpp
SpatialReference*
SpatialReference::create(const Key& key)
{
    // now try to resolve the horizontal SRS:
    osg::ref_ptr<SpatialReference> srs;

    // shortcut for spherical-mercator:
    if (key.horizLower == "spherical-mercator" || 
        key.hori
osgEarth 中配置自定义投影类型,主要依赖于 `<map>` 配置文件中的 `<profile>` 元素,它用于指定地图的投影方式和空间参考系统。osgEarth 支持多种内置投影配置,包括 `global-mercator`(Web Mercator)和 `eqc-wgs84`(Equirectangular)等,同时也允许开发者通过定义空间参考系统来实现自定义投影[^3]。 要实现自定义投影,首先需要在地图配置文件中将 `type` 设置为 `projected`,然后在 `<profile>` 标签中指定所需的投影名称或 EPSG 编码。例如,若要使用等距投影(Equirectangular),可以在配置文件中使用 `eqc-wgs84` 作为 profile 名称[^2]。若需要使用其他投影,如 EPSG:3857(Web Mercator),则可以使用 `global-mercator` 作为 profile 名称[^3]。 以下是一个使用等距投影的地图配置示例: ```xml <map name="EquirectangularMap" type="projected" version="2"> <options> <terrain driver="rex"/> <profile>eqc-wgs84</profile> </options> <image name="World Image" driver="gdal"> <url>world.tif</url> </image> </map> ``` 如果需要定义一个 osgEarth 不直接支持的自定义投影,可以通过创建自定义的空间参考系统(SpatialReference)来实现。这通常涉及调用 `osgEarth::SpatialReference::create` 方法并传入对应的 EPSG 编码或 WKT 定义。例如: ```cpp osgEarth::SpatialReference* srs = osgEarth::SpatialReference::create("EPSG:XXXX"); ``` 其中 `"EPSG:XXXX"` 替换为实际的 EPSG 编码或 WKT 描述字符串。随后,可以将该空间参考系统应用到地图的 profile 设置中,以实现特定的投影需求。 在配置过程中,还需确保数据源的空间参考与地图的投影一致,否则需要进行坐标转换。osgEarth 提供了 `osgEarth::GeometryUtils::transformGeometry` 等工具方法用于处理不同坐标系统之间的几何数据转换。 此外,osgEarthRex 引擎支持基于投影的地形渲染,因此在配置文件中指定 `<terrain driver="rex"/>` 可以更好地适配不同的投影方式[^2]。 ### 相关问题 1. osgEarth 中如何配置 EPSG:3857 投影? 2. 如何在 osgEarth 中实现等距投影地图的高效渲染? 3. osgEarth 是否支持通过 WKT 定义自定义空间参考系统? 4. osgEarth 中如何实现不同图层使用不同投影的叠加显示? 5. osgEarthRex 引擎在处理非 Mercator 投影时有哪些优化策略?
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值