public static LBSPoint WGS_84_To_BD_09(LBSPoint args_WGS_84) { LBSPoint gcj_02 = WGS_84_To_GCJ_02(args_WGS_84); LBSPoint bd_09 = GCJ_02_To_BD_09(gcj_02); return(bd_09); }
public static LBSPoint BD_09_To_WGS_84(LBSPoint args_BD_09) { LBSPoint gcj_02 = BD_09_To_GCJ_02(args_BD_09); LBSPoint wgs_84 = GCJ_02_To_WGS_84(gcj_02); return(wgs_84); }
/// <summary> /// LBSInfo 构造函数 /// </summary> /// <param name="lat">纬度</param> /// <param name="lng">经度</param> /// <param name="locType">经纬度类型</param> public LBSInfo(double lat, double lng, LocationType locType = LocationType.GCJ_02) { LBSPoint temp = new LBSPoint(lat, lng, locType); switch (temp.LocationType) { case LocationType.WGS_84: this.WGS_84 = temp; this.GCJ_02 = LBSUtils.WGS_84_To_GCJ_02(this.WGS_84); this.BD_09 = LBSUtils.GCJ_02_To_BD_09(this.GCJ_02); break; case LocationType.GCJ_02: this.GCJ_02 = temp; this.WGS_84 = LBSUtils.GCJ_02_To_WGS_84(this.GCJ_02); this.BD_09 = LBSUtils.GCJ_02_To_BD_09(this.GCJ_02); break; case LocationType.BD_09: this.BD_09 = temp; this.GCJ_02 = LBSUtils.BD_09_To_GCJ_02(this.BD_09); this.WGS_84 = LBSUtils.GCJ_02_To_WGS_84(this.GCJ_02); break; } this.IsOutOfChina = Util.LBS.LBSUtils.IsOutOfChina(this); this.WGS_84.IsOutOfChina = this.IsOutOfChina; this.GCJ_02.IsOutOfChina = this.IsOutOfChina; this.BD_09.IsOutOfChina = this.IsOutOfChina; }
public static LBSPoint GCJ_02_To_WGS_84(LBSPoint args_GCJ_02) { LBSPoint gps = transform(args_GCJ_02); double lontitude = args_GCJ_02.Lng * 2 - gps.Lng; double latitude = args_GCJ_02.Lat * 2 - gps.Lat; return(new LBSPoint(latitude, lontitude, LocationType.WGS_84)); }
public static LBSPoint GCJ_02_To_BD_09(LBSPoint args_GCJ_02) { double x = args_GCJ_02.Lng; double y = args_GCJ_02.Lat; double z = Math.Sqrt(x * x + y * y) + 0.00002 * Math.Sin(y * bd_pi); double theta = Math.Atan2(y, x) + 0.000003 * Math.Cos(x * bd_pi); double bd_lon = z * Math.Cos(theta) + 0.0065; double bd_lat = z * Math.Sin(theta) + 0.006; return(new LBSPoint(bd_lat, bd_lon, LocationType.BD_09)); }
public static LBSPoint BD_09_To_GCJ_02(LBSPoint args_BD_09) { double x = args_BD_09.Lng - 0.0065; double y = args_BD_09.Lat - 0.006; double z = Math.Sqrt(x * x + y * y) - 0.00002 * Math.Sin(y * bd_pi); double theta = Math.Atan2(y, x) - 0.000003 * Math.Cos(x * bd_pi); double gg_lon = z * Math.Cos(theta); double gg_lat = z * Math.Sin(theta); return(new LBSPoint(gg_lat, gg_lon, LocationType.GCJ_02)); }
static LBSPoint transform(LBSPoint args) { double dLat = transformLat(args.Lng - 105.0, args.Lat - 35.0); double dLon = transformLon(args.Lng - 105.0, args.Lat - 35.0); double radLat = args.Lat / 180.0 * pi; double magic = Math.Sin(radLat); magic = 1 - ee * magic * magic; double sqrtMagic = Math.Sqrt(magic); dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi); dLon = (dLon * 180.0) / (a / sqrtMagic * Math.Cos(radLat) * pi); double mgLat = args.Lat + dLat; double mgLon = args.Lng + dLon; return(new LBSPoint(mgLat, mgLon)); }