#include "math.h" #include "stdio.h"     double casm_rr ; unsigned int casm_t1; unsigned int casm_t2; double casm_x1; double casm_y1; double casm_x2; double casm_y2; double casm_f; double yj_sin2(double x) {     double tt ;     double ss;     int ff ;     double s2;     int cc;     ff=;     if (x<)     {         x=-x;         ff=;     }     cc=int(x/6.28318530717959);     tt=x-cc*6.28318530717959;     if (tt>3.1415926535897932)     {         tt=tt-3.1415926535897932;         if (ff==)         ff=;         else if (ff==)         ff=;     }     x=tt;     ss=x;     s2=x;     tt=tt*tt;     s2=s2*tt;     ss=ss-s2* 0.166666666666667;     s2=s2*tt;     ss=ss+s2* 8.33333333333333E-03;     s2=s2*tt;     ss=ss-s2* 1.98412698412698E-04;     s2=s2*tt;     ss=ss+s2* 2.75573192239859E-06;     s2=s2*tt;     ss=ss-s2* 2.50521083854417E-08;     if (ff==)     ss=-ss;     return ss; } double Transform_yj5(double x , double y ) {     double tt;     tt =  +  * x +  * y + 0.1 * x * x + 0.1 * x * y + 0.1 * sqrt(sqrt(x*x));     tt = tt + ( *yj_sin2(18.849555921538764 * x ) +  * yj_sin2(6.283185307179588 * x))*0.6667;     tt = tt + ( * yj_sin2(3.141592653589794 * x ) +  * yj_sin2(1.047197551196598 * x))*0.6667;     tt = tt + ( * yj_sin2(0.2617993877991495 * x) +  * yj_sin2(0.1047197551196598 * x))*0.6667;     return tt; } double Transform_yjy5(double x , double y ) {     double tt ;     tt = - +   * x +  * y + 0.2 * y * y + 0.1 * x * y + 0.2 * sqrt(sqrt(x*x));     tt = tt + ( * yj_sin2(18.849555921538764 * x) +  * yj_sin2(6.283185307179588 * x))*0.6667;     tt = tt + ( * yj_sin2(3.141592653589794 * y)+  * yj_sin2(1.047197551196598 * y))*0.6667;     tt = tt + ( * yj_sin2(0.2617993877991495 * y) +  * yj_sin2(0.1047197551196598 * y))*0.6667;     return tt; } double Transform_jy5(double x , double xx ) {     double n ;     double a ;     double e ;     a = ;     e = 0.00669342;     n = sqrt ( - e * yj_sin2(x * 0.0174532925199433) * yj_sin2(x * 0.0174532925199433) );     n = (xx * ) /(a / n * cos(x * 0.0174532925199433) * 3.1415926) ;     return n; } double Transform_jyj5(double x , double yy ) {     double m ;     double a ;     double e ;     double mm;     a = ;     e = 0.00669342;     mm=  - e * yj_sin2(x * 0.0174532925199433) * yj_sin2(x * 0.0174532925199433) ;     m = (a * ( - e)) / (mm * sqrt(mm));     return (yy * ) / (m * 3.1415926); } double r_yj() {     int casm_a ;     int casm_c ;     casm_a = ;     casm_c = ;     return ; } double random_yj() {     int t;     int casm_a ;     int casm_c ;     casm_a = ;     casm_c = ;     casm_rr = casm_a * casm_rr + casm_c ;     t = int(casm_rr /);     casm_rr = casm_rr - t * ;     casm_rr = casm_rr /  ;     return (casm_rr); } void IniCasm(unsigned int w_time, unsigned int w_lng, unsigned int w_lat) {     int tt;     casm_t1 = w_time ;     casm_t2 = w_time ;     tt=int(w_time/0.357);     casm_rr=w_time-tt*0.357;     if (w_time==)     casm_rr=0.3;     casm_x1 = w_lng;     casm_y1 = w_lat;     casm_x2 = w_lng;     casm_y2 = w_lat;     casm_f=; } unsigned int wgtochina_lb(int wg_flag, unsigned int wg_lng, unsigned int wg_lat, int wg_heit,  int wg_week, unsigned int wg_time, unsigned  int *china_lng, unsigned int *china_lat) {     double x_add ;     double y_add ;     double h_add ;     double x_l;     double y_l;     double casm_v ;     double t1_t2;     double x1_x2;     double y1_y2;                 if (wg_heit>)     {         *china_lng =  ;         *china_lat = ;         return 0xFFFF95FF;     }     x_l =  wg_lng;     x_l =  x_l / 3686400.0;     y_l =  wg_lat ;     y_l =  y_l / 3686400.0;     if (x_l < 72.004)     {         *china_lng =  ;         *china_lat = ;         return 0xFFFF95FF;     }     if ( x_l > 137.8347)     {         *china_lng =  ;         *china_lat = ;         return 0xFFFF95FF;     }     if (y_l < 0.8293)     {         *china_lng =  ;         *china_lat = ;         return 0xFFFF95FF;     }     if ( y_l > 55.8271)     {         *china_lng =  ;         *china_lat = ;         return 0xFFFF95FF;     }     if (wg_flag ==)     {         IniCasm(wg_time,wg_lng,wg_lat);         *china_lng = wg_lng;         *china_lat = wg_lat;         return 0x00000000;     }         casm_t2= wg_time ;     t1_t2 =(double)(casm_t2 - casm_t1)/1000.0;     if ( t1_t2<= )     {         casm_t1= casm_t2 ;         casm_f=casm_f+;         casm_x1 = casm_x2;         casm_f=casm_f+;         casm_y1 = casm_y2;         casm_f=casm_f+;     }     else    {         if ( t1_t2 >  )         {             if (casm_f == )             {                 casm_f=;                 casm_x2 = wg_lng;                 casm_y2 = wg_lat;                 x1_x2 = casm_x2 - casm_x1;                 y1_y2 = casm_y2 - casm_y1;                 casm_v = sqrt (x1_x2 * x1_x2 + y1_y2 * y1_y2 ) /t1_t2;                 if (casm_v  > )                 {                     *china_lng =  ;                     *china_lat = ;                     return (0xFFFF95FF);                 }             }             casm_t1= casm_t2 ;             casm_f=casm_f+;             casm_x1 = casm_x2;             casm_f=casm_f+;             casm_y1 = casm_y2;             casm_f=casm_f+;         }     }     x_add = Transform_yj5(x_l - , y_l - ) ;     y_add = Transform_yjy5(x_l - , y_l - ) ;     h_add = wg_heit;         x_add = x_add + h_add * 0.001 + yj_sin2(wg_time*0.0174532925199433)+random_yj();     y_add = y_add + h_add * 0.001 + yj_sin2(wg_time*0.0174532925199433)+random_yj();     *china_lng = unsigned int( (x_l + Transform_jy5(y_l, x_add)) *  );     *china_lat = unsigned int( (y_l + Transform_jyj5(y_l, y_add)) *  );     return (0x00000000); }     bool wg2mars( const double in_lon, const double in_lat, double& out_lon, double& out_lat ) {     const double BASE = 3686400.0;     unsigned int lon, lat;     lon = unsigned int ( in_lon * BASE );     lat = unsigned int ( in_lat * BASE );     unsigned int ret = wgtochina_lb( , lon, lat, , , , &lon, &lat );     out_lon = lon / BASE;     out_lat = lat / BASE;     return (==ret); }

http://hi.baidu.com/sa_sc/item/570101a588b5f8f714329b26

WGS84 2 GCJ-02的更多相关文章

  1. 火星02坐标转换为WGS84坐标

    import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import jav ...

  2. 地球坐标系(WGS-84)转火星坐标系(GCJ)

    /** * 单点坐标纠偏 */ var pi = 3.14159265358979324; var a = 6378245.0; var ee = 0.00669342162296594323; va ...

  3. 使用js对WGS-84 ,GCJ-02与BD-09的坐标进行转换

    获取到经纬度在用百度地图进行定位时,却发现行驶轨迹的路线定到海里面去了.从网上查阅,知道此方法. 出处:https://www.jianshu.com/p/53f00ba897f7 一.在进行地图开发 ...

  4. python、js实现WGS84、高德(火星)、百度坐标转换

    在日常工作学习中常会涉及到WGS84.高德(火星/谷歌).百度三种空间坐标系的坐标转换,本文将通过python.js两种语言实现坐标系的转换. 坐标系说明: wgs84:为一种大地坐标系,也是目前广泛 ...

  5. 火星坐标、百度坐标、WGS-84坐标相互转换及墨卡托投影坐标转经纬度JavaScript版

    火星坐标 火星坐标是国家测绘局为了国家安全在原始坐标的基础上进行偏移得到的坐标,基本国内的电子地图.导航设备都是采用的这一坐标系或在这一坐标的基础上进行二次加密得到的.火星坐标的真实名称应该是GCJ- ...

  6. GPS坐标互转:WGS-84(GPS)、GCJ-02(Google地图)、BD-09(百度地图)(转载)

    WGS-84:是国际标准,GPS坐标(Google Earth使用.或者GPS模块)GCJ-02:中国坐标偏移标准,Google Map.高德.腾讯使用BD-09:百度坐标偏移标准,Baidu Map ...

  7. WGS84、Web墨卡托、火星坐标、百度坐标互转

    转自:1.http://blog.csdn.net/wildboy2001/article/details/12031351 2.http://kongxz.com/2013/10/wgs-cgj/ ...

  8. WGS84、GCJ-02(火星坐标)、百度坐标,Web墨卡托坐标

    GCJ-02坐标系统(火星坐标)简介:http://blog.csdn.net/giswens/article/details/8775121(存档:http://mapbd.com/cms/2012 ...

  9. GCJ-02火星坐标系和WGS-84坐标系转换关系

    GCJ-02火星坐标系和WGS-84坐标系转换关系 WGS-84:GPS坐标系 GCJ-02:火星坐标系,国测局02年发布的坐标体系,高德,腾讯等使用. BD-09:百度坐标系,百度自研,百度地图使用 ...

  10. WGS84,GCJ02, BD09坐标转换

    public class Gps { private double wgLat; private double wgLon; public Gps(double wgLat, double wgLon ...

随机推荐

  1. linux下的缓存机制buffer、cache、swap - 运维总结 ["Cannot allocate memory"问题]

    一.缓存机制介绍 在Linux系统中,为了提高文件系统性能,内核利用一部分物理内存分配出缓冲区,用于缓存系统操作和数据文件,当内核收到读写的请求时,内核先去缓存区找是否有请求的数据,有就直接返回,如果 ...

  2. Go语言实现简单的TCP、UDP链接

    ⼀.使用Golang创建⼀一个TCP连接   1.服务端处理理流程 a.监听端口   b.接受客户端的链接 c.创建Goroutine,处理这个链接(⼀个服务端要链接多个客户端,所以使用Gorouti ...

  3. Codeforces Round #510 (Div. 2) C. Array Product

    题目 题意: 给你n个数,有两种操作,操作1是把第i个位置的数删去, 操作2 是把 a[ j ]= a[ i ]* a[ j ],把a[ i ]删去 .n-1个操作以后,只剩1个数,要使这个数最大 . ...

  4. 【清北学堂】广州OI学习游记

    \(Day~0\) 早上\(9\)点多才爬起来,然后水了道题. 下午从[数据删除]出发,颠簸了将近\(5\)个小时终于抵达广州. 一出地铁站--卧槽这天,卧槽这风,要下雨的节奏? 没过两分钟倾盆大雨. ...

  5. UML之关系

    学习UML我们首先要掌握他们的关系,UML关系可以分为四类,主要有关联.依赖.泛化和实现. 下面我们就一一来详细说明这几种关系. 关联 表示两个类或类与接口之间强烈的依赖关系,关联用直线表示.当然我们 ...

  6. 配置Cisco网络设备

    了解就行,不用记 电脑管理路由器软件   路由器显示命令: router#show run :显示配置信息 router#show interface :显示接口信息 router#show ip r ...

  7. IIS:URL Rewrite实现vue的地址重写

    vue-router 全局配置 const router = new VueRouter({ mode: 'history', routes: [...] }) URL Rewrite 1.添加规则 ...

  8. Vue.js 中的 v-cloak 指令

    可以使用 v-cloak 指令设置样式,这些样式会在 Vue 实例编译结束时,从绑定的 HTML 元素上被移除. 当网络较慢,网页还在加载 Vue.js ,而导致 Vue 来不及渲染,这时页面就会显示 ...

  9. 「CF319E」Ping-Pong「线段树」「并查集」

    题意 规定区间\((a,b)\)到区间\((c,d)\)有边当且仅当\(c<a<d\)或\(c<b<d\). 起初区间集合为空.有\(n\)(\(n\leq 10^5\))次操 ...

  10. 项目 java.lang.NoClassDefFoundError 异常。

    项目部署之后调用接口失败:异常信息: NoClassDefFoundError ClassNotFoundException 注意这两种是有区别的. 具体转 https://www.cnblogs.c ...