You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

osgEarth中CircleNode设置的半径与实际测量不符的问题求助

osgEarth中CircleNode设置的半径与实际测量不符的问题求助

我在地图上展示CircleNode时,实际测量发现显示的半径不对,但绘制直线时距离是完全正确的。

CircleNode相关代码:

osg::ref_ptr<CircleNode> circle = new CircleNode();

circle->setPosition(center); // center 和地图使用相同的SRS

circle->setRadius(Distance(2000, Units::METERS));

绘制直线的代码(距离显示正常):

auto centerPoint = m_Center.transform(m_Center.getSRS()->getGeographicSRS());

double outLon;
double outLat;

GeoMath::destination(osgEarth::deg2rad(centerPoint.y()),
osgEarth::deg2rad(centerPoint.x()), osgEarth::deg2rad(angle),
radius.as(Units::METERS), outLat, outLon); // 移动2km

centerPoint.x() = osgEarth::rad2deg(outLon);
centerPoint.y() = osgEarth::rad2deg(outLat);

const auto endPoint = wgsCenterPoint.transform(m_Center.getSRS());

下图中红色圆圈的半径设置为2km:
红色2km半径圆圈示意图

地图配置信息:

+proj=webmerc +a=6378137 +b=6378137 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +towgs84=0,0,0,0,0,0,0 +no_defs

地图数据源是http://[abc].tile.openstreetmap.org/{z}/{x}/{y}.png(球面墨卡托投影)

我哪里疏漏了?谢谢!


编辑补充:经过排查,我发现CircleNode似乎没有把SRS传递给GeometryFactory。

备注:内容来源于stack exchange,提问作者selpak

火山引擎 最新活动