WGS84转GCJ-02坐标系容易y=x+x2+x3+x4+...,但是反过来就难了。。原因在于高次代数方程求根。(https://www.bilibili.com/read/cv2121106)(一元n次方程的解法) 牛顿法和一元n次方程
要实现高精度转换,需要进行迭代,而这比较耗时。如果只取前4位,多项式则容易求解,但是精度不够。
有没有较快的方法实现高精度逆变换。
C++:https://www.cnblogs.com/2008nmj/p/14198389.html
以lonGCJ-02,latGCJ-02为观测值,而lonWGS84,latWGS84为未知数,列误差方程并线性化,则线性化后的误差方程为:
v=Ax-l
其中,,
,
而,系数矩阵A展开为:
要使得误差v=0,那么需要什么条件:
/** * \brief Covert geodetic coordinate in GCJ-02 coordinate system to geodetic coordinate * in WGS84 coordinate system * * \param [in] gcj02lon: longitude in GCJ-02 coordinate system [unit:degree] * \param [in] gcj02lat: latitude in GCJ-02 coordinate system [unit:degree] * \return Returns geodetic coordinate in WGS84 coordinate system * \remark The encryption formula is known,and use the analytical derivation method to * solve the problem with high precision. * \detail Assuming the encryption formula is * * gcj02lon = Wgs2Gcj(wgs84lon, wgs84lat) * gcj02lat = Wgs2Gcj(wgs84lon, wgs84lat) * * In the rectification process, (wgs84lon, wgs84lat) are unknown items. Obviously, * this is a system of nonlinear equations. * * The linear formed error functions of forward intersection come from * consideration of a Taylor series expansion. * V = AX - b * here: * V: The residuals of the observed values * A: The jacobian matrix * X: The modification of the unknown items * b: The constant terms of the error functions * * Then the error functions written in vector form are: * | V_lon | = | dlongcj_dlonwgs dlongcj_dlatwgs | | d_lonwgs | - | l_lon | * | V_lat | = | dlatgcj_dlonwgs dlatgcj_dlatwgs | | d_latwgs | - | l_lat | * here: * l_lon = longcj - longcj' // the modification of longcj * l_lat = latgcj - latgcj' // the modification of latgcj * longcj : the observed longitude in GCJ-02 * latgcj : the observed latitude in GCJ-02 * longcj' = Wgs2Gcj(wgs84lon',wgs84lat') // estimated longitude in GCJ-02 * latgcj' = Wgs2Gcj(wgs84lon',wgs84lat') // estimated latitude in GCJ-02 * wgs84lon' : estimated longitude in WGS84 * wgs84lat' : estimated latitude in WGS84 * d_lonwgs : unknown items * d_latwgs : unknown items * wgs84lon = wgs84lon' + d_lonwgs // update * wgs84lat = wgs84lat' + d_latwgs * * let V = [V_lon V_lat]T = 0, then * d_latwgs = (l_lon * dlatgcj_dlonwgs - l_lat * dlongcj_dlonwgs) / * (dlongcj_dlatwgs * dlatgcj_dlonwgs - dlatgcj_dlatwgs * dlongcj_dlonwgs) * d_lonwgs = (l_lon - dlongcj_dlatwgs * d_latwgs) / dlongcj_dlonwgs * * This iterative procedure is repeated until X= [d_lonwgs d_latwgs]T are * sufficiently small. * \time 01:54:46 2020/06/13 */
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
2019-01-21 MV摄影制作一体化系统&AI摄影机器人
2019-01-21 人物和背景分离的快速方法
2019-01-21 4D(DLG,DRG,DOM,DEM)
2019-01-21 群论