-
2019-05-15 18:06:23
三种常见经纬度坐标系的转化
我们常用的地图api坐标系有wgs84坐标系,gcj02坐标系,bd09坐标系。
wgs坐标系是国际上通用的坐标系,也称地球坐标系,gps和北斗系统都使用的是wgs坐标系。谷歌地图使用的是wgs坐标系(中国部分除外),openstreetmap使用的也是这种坐标系
gcj02坐标系是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系,也称火星坐标系,谷歌中国地图、搜搜中国地图、高德地图采用的是GCJ02地理坐标系。
BD09坐标系:即百度坐标系,GCJ02坐标系经加密后的坐标系,由百度公司独创,百度地图使用的就是这个坐标系。
下附三种坐标系转换的代码import json import urllib import math x_pi = 3.14159265358979324 * 3000.0 / 180.0 pi = 3.1415926535897932384626 # π a = 6378245.0 # 长半轴 ee = 0.00669342162296594323 # 偏心率平方 def gcj02_to_bd09(lng, lat): """ 火星坐标系(GCJ-02)转百度坐标系(BD-09) 谷歌、高德——>百度 :param lng:火星坐标经度 :param lat:火星坐标纬度 :return: """ z = math.sqrt(lng * lng + lat * lat) + 0.00002 * math.sin(lat * x_pi) theta = math.atan2(lat, lng) + 0.000003 * math.cos(lng * x_pi) bd_lng = z * math.cos(theta) + 0.0065 bd_lat = z * math.sin(theta) + 0.006 return [bd_lng, bd_lat] def bd09_to_gcj02(bd_lon, bd_lat): """ 百度坐标系(BD-09)转火星坐标系(GCJ-02) 百度——>谷歌、高德 :param bd_lat:百度坐标纬度 :param bd_lon:百度坐标经度 :return:转换后的坐标列表形式 """ x = bd_lon - 0.0065 y = bd_lat - 0.006 z = math.sqrt(x * x + y * y) - 0.00002 * math.sin(y * x_pi) theta = math.atan2(y, x) - 0.000003 * math.cos(x * x_pi) gg_lng = z * math.cos(theta) gg_lat = z * math.sin(theta) return [gg_lng, gg_lat] def wgs84_to_gcj02(lng, lat): """ WGS84转GCJ02(火星坐标系) :param lng:WGS84坐标系的经度 :param lat:WGS84坐标系的纬度 :return: """ if out_of_china(lng, lat): # 判断是否在国内 return [lng, lat] dlat = _transformlat(lng - 105.0, lat - 35.0) dlng = _transformlng(lng - 105.0, lat - 35.0) radlat = lat / 180.0 * pi magic = math.sin(radlat) magic = 1 - ee * magic * magic sqrtmagic = math.sqrt(magic) dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi) dlng = (dlng * 180.0) / (a / sqrtmagic * math.cos(radlat) * pi) mglat = lat + dlat mglng = lng + dlng return [mglng, mglat] def gcj02_to_wgs84(lng, lat): """ GCJ02(火星坐标系)转GPS84 :param lng:火星坐标系的经度 :param lat:火星坐标系纬度 :return: """ if out_of_china(lng, lat): return [lng, lat] dlat = _transformlat(lng - 105.0, lat - 35.0) dlng = _transformlng(lng - 105.0, lat - 35.0) radlat = lat / 180.0 * pi magic = math.sin(radlat) magic = 1 - ee * magic * magic sqrtmagic = math.sqrt(magic) dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi) dlng = (dlng * 180.0) / (a / sqrtmagic * math.cos(radlat) * pi) mglat = lat + dlat mglng = lng + dlng return [lng * 2 - mglng, lat * 2 - mglat] def bd09_to_wgs84(bd_lon, bd_lat): lon, lat = bd09_to_gcj02(bd_lon, bd_lat) return gcj02_to_wgs84(lon, lat) def wgs84_to_bd09(lon, lat): lon, lat = wgs84_to_gcj02(lon, lat) return gcj02_to_bd09(lon, lat) def _transformlat(lng, lat): ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + \ 0.1 * lng * lat + 0.2 * math.sqrt(math.fabs(lng)) ret += (20.0 * math.sin(6.0 * lng * pi) + 20.0 * math.sin(2.0 * lng * pi)) * 2.0 / 3.0 ret += (20.0 * math.sin(lat * pi) + 40.0 * math.sin(lat / 3.0 * pi)) * 2.0 / 3.0 ret += (160.0 * math.sin(lat / 12.0 * pi) + 320 * math.sin(lat * pi / 30.0)) * 2.0 / 3.0 return ret def _transformlng(lng, lat): ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + \ 0.1 * lng * lat + 0.1 * math.sqrt(math.fabs(lng)) ret += (20.0 * math.sin(6.0 * lng * pi) + 20.0 * math.sin(2.0 * lng * pi)) * 2.0 / 3.0 ret += (20.0 * math.sin(lng * pi) + 40.0 * math.sin(lng / 3.0 * pi)) * 2.0 / 3.0 ret += (150.0 * math.sin(lng / 12.0 * pi) + 300.0 * math.sin(lng / 30.0 * pi)) * 2.0 / 3.0 return ret def out_of_china(lng, lat): """ 判断是否在国内,不在国内不做偏移 :param lng: :param lat: :return: """ return not (lng > 73.66 and lng < 135.05 and lat > 3.86 and lat < 53.55)
更多相关内容 -
GPS坐标系转换以及经纬度距离计算
2016-12-28 17:52:11设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系, % * 谷歌地图采用的是WGS84地理坐标系(中国范围除外); % * GCJ02坐标系:即火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS... -
各种经纬度坐标系转换-百度坐标系、火星坐标系、国际坐标系
2018-11-01 10:25:12各种经纬度坐标系转换-百度坐标系、火星坐标系、国际坐标系 (文章代码参考网上 测试没什么问题, 汇总整理希望对大家有帮助-dou ) WGS84:国际坐标系,为一种大地坐标系,也是目前广泛使用的GPS全球卫星定位系统...(文章代码参考网上 测试没什么问题, 汇总整理希望对大家有帮助-dou )
WGS84:国际坐标系,为一种大地坐标系,也是目前广泛使用的GPS全球卫星定位系统使用的坐标系。
GCJ02:火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系。
BD09:为百度坐标系,在GCJ02坐标系基础上再次加密。其中bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托米制坐标
一 : 百度坐标与百度墨卡坐标互转
import java.util.HashMap; import java.util.Map; /** * @ClassName: Baidu * @Description: 百度坐标与百度墨卡坐标互转 * @author: Max dou * @date: 2017年4月11日 下午4:49:54 */ public class Baidu { public static void main(String[] args) { //百度坐标转百度墨卡坐标 Map<String, Double> location = convertMC2LL(13745329.000000, 5104310.500000); System.out.println(location.get("lng")+"==="+location.get("lat")); //百度墨卡坐标转百度坐标 location = convertLL2MC(location.get("lng"),location.get("lat")); System.out.println(location.get("x")+"==="+location.get("y")); } private static Double EARTHRADIUS = 6370996.81; private static Double[] MCBAND = {12890594.86, 8362377.87, 5591021d, 3481989.83, 1678043.12, 0d}; private static Double[] LLBAND = {75d, 60d, 45d, 30d, 15d, 0d}; private static Double[][] MC2LL = {{1.410526172116255e-8, 0.00000898305509648872, -1.9939833816331, 200.9824383106796, -187.2403703815547, 91.6087516669843, -23.38765649603339, 2.57121317296198, -0.03801003308653, 17337981.2}, {-7.435856389565537e-9, 0.000008983055097726239, -0.78625201886289, 96.32687599759846, -1.85204757529826, -59.36935905485877, 47.40033549296737, -16.50741931063887, 2.28786674699375, 10260144.86}, {-3.030883460898826e-8, 0.00000898305509983578, 0.30071316287616, 59.74293618442277, 7.357984074871, -25.38371002664745, 13.45380521110908, -3.29883767235584, 0.32710905363475, 6856817.37}, {-1.981981304930552e-8, 0.000008983055099779535, 0.03278182852591, 40.31678527705744, 0.65659298677277, -4.44255534477492, 0.85341911805263, 0.12923347998204, -0.04625736007561, 4482777.06}, {3.09191371068437e-9, 0.000008983055096812155, 0.00006995724062, 23.10934304144901, -0.00023663490511, -0.6321817810242, -0.00663494467273, 0.03430082397953, -0.00466043876332, 2555164.4}, {2.890871144776878e-9, 0.000008983055095805407, -3.068298e-8, 7.47137025468032, -0.00000353937994, -0.02145144861037, -0.00001234426596, 0.00010322952773, -0.00000323890364, 826088.5}}; private static Double[][] LL2MC = {{-0.0015702102444, 111320.7020616939, 1704480524535203d, -10338987376042340d, 26112667856603880d, -35149669176653700d, 26595700718403920d, -10725012454188240d, 1800819912950474d, 82.5}, {0.0008277824516172526, 111320.7020463578, 647795574.6671607, -4082003173.641316, 10774905663.51142, -15171875531.51559, 12053065338.62167, -5124939663.577472, 913311935.9512032, 67.5}, {0.00337398766765, 111320.7020202162, 4481351.045890365, -23393751.19931662, 79682215.47186455, -115964993.2797253, 97236711.15602145, -43661946.33752821, 8477230.501135234, 52.5}, {0.00220636496208, 111320.7020209128, 51751.86112841131, 3796837.749470245, 992013.7397791013, -1221952.21711287, 1340652.697009075, -620943.6990984312, 144416.9293806241, 37.5}, {-0.0003441963504368392, 111320.7020576856, 278.2353980772752, 2485758.690035394, 6070.750963243378, 54821.18345352118, 9540.606633304236, -2710.55326746645, 1405.483844121726, 22.5}, {-0.0003218135878613132, 111320.7020701615, 0.00369383431289, 823725.6402795718, 0.46104986909093, 2351.343141331292, 1.58060784298199, 8.77738589078284, 0.37238884252424, 7.45}}; /** * 墨卡托坐标转经纬度坐标 * @param x * @param y * @return */ public static Map<String, Double> convertMC2LL(Double x, Double y) { Double[] cF = null; x = Math.abs(x); y = Math.abs(y); for (int cE = 0; cE < MCBAND.length; cE++) { if (y >= MCBAND[cE]) { cF = MC2LL[cE]; break; } } Map<String,Double> location = converter(x, y, cF); location.put("lng",location.get("x")); location.remove("x"); location.put("lat",location.get("y")); location.remove("y"); return location; } /** * 经纬度坐标转墨卡托坐标 * @param lng * @param lat * @return */ private static Map<String, Double> convertLL2MC(Double lng, Double lat) { Double[] cE = null; lng = getLoop(lng, -180, 180); lat = getRange(lat, -74, 74); for (int i = 0; i < LLBAND.length; i++) { if (lat >= LLBAND[i]) { cE = LL2MC[i]; break; } } if (cE!=null) { for (int i = LLBAND.length - 1; i >= 0; i--) { if (lat <= -LLBAND[i]) { cE = LL2MC[i]; break; } } } return converter(lng,lat, cE); } private static Map<String, Double> converter(Double x, Double y, Double[] cE) { Double xTemp = cE[0] + cE[1] * Math.abs(x); Double cC = Math.abs(y) / cE[9]; Double yTemp = cE[2] + cE[3] * cC + cE[4] * cC * cC + cE[5] * cC * cC * cC + cE[6] * cC * cC * cC * cC + cE[7] * cC * cC * cC * cC * cC + cE[8] * cC * cC * cC * cC * cC * cC; xTemp *= (x < 0 ? -1 : 1); yTemp *= (y < 0 ? -1 : 1); Map<String, Double> location = new HashMap<String, Double>(); location.put("x", xTemp); location.put("y", yTemp); return location; } private static Double getLoop(Double lng, Integer min, Integer max) { while (lng > max) { lng -= max - min; } while (lng < min) { lng += max - min; } return lng; } private static Double getRange(Double lat, Integer min, Integer max) { if (min != null) { lat = Math.max(lat, min); } if (max != null) { lat = Math.min(lat, max); } return lat; } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
二 : 国际坐标即gps坐标、百度坐标、火星坐标转换
/** * @ClassName: PositionUtil * @Description: * 各地图API坐标系统比较与转换; * WGS84坐标系:即地球坐标系,国际上通用的坐标系。设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系, * 谷歌地图采用的是WGS84地理坐标系(中国范围除外); * GCJ02坐标系:即火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系。 * 谷歌中国地图和搜搜中国地图采用的是GCJ02地理坐标系; BD09坐标系:即百度坐标系,GCJ02坐标系经加密后的坐标系; * 搜狗坐标系、图吧坐标系等,估计也是在GCJ02基础上加密而成的。 chenhua * @author: Max dou * @date: 2017年4月10日 下午4:17:44 */ public class PositionUtil { public static final String BAIDU_LBS_TYPE = "bd09ll"; public static double pi = 3.1415926535897932384626; public static double a = 6378245.0; public static double ee = 0.00669342162296594323; /** * 国际坐标 to 火星坐标系 (GCJ-02) World Geodetic System ==> Mars Geodetic System * * @param lat * @param lon * @return */ public static Gps gps84_To_Gcj02(double lat, double lon) { if (outOfChina(lat, lon)) { return null; } double dLat = transformLat(lon - 105.0, lat - 35.0); double dLon = transformLon(lon - 105.0, lat - 35.0); double radLat = 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 = lat + dLat; double mgLon = lon + dLon; return new Gps(mgLat, mgLon); } /** * * 火星坐标系 (GCJ-02) to 国际坐标 * * @param lon * @param lat * @return * */ public static Gps gcj_To_Gps84(double lat, double lon) { Gps gps = transform(lat, lon); double lontitude = lon * 2 - gps.getWgLon(); double latitude = lat * 2 - gps.getWgLat(); return new Gps(latitude, lontitude); } /** * 火星坐标系 (GCJ-02) to 百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标 * * @param gg_lat * @param gg_lon */ public static Gps gcj02_To_Bd09(double gg_lat, double gg_lon) { double x = gg_lon, y = gg_lat; double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * pi); double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * pi); double bd_lon = z * Math.cos(theta) + 0.0065; double bd_lat = z * Math.sin(theta) + 0.006; return new Gps(bd_lat, bd_lon); } /** * * 火星坐标系 (GCJ-02) to 百度坐标系 (BD-09) 的转换算法 * * 将 BD-09 坐标转换成GCJ-02 坐标 * * @param * bd_lat * @param bd_lon * @return */ public static Gps bd09_To_Gcj02(double bd_lat, double bd_lon) { double x = bd_lon - 0.0065, y = bd_lat - 0.006; double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * pi); double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi); double gg_lon = z * Math.cos(theta); double gg_lat = z * Math.sin(theta); return new Gps(gg_lat, gg_lon); } /** * 百度坐标系 (BD-09) to 国际坐标 * @param bd_lat * @param bd_lon * @return */ public static Gps bd09_To_Gps84(double bd_lat, double bd_lon) { Gps gcj02 = PositionUtil.bd09_To_Gcj02(bd_lat, bd_lon); Gps map84 = PositionUtil.gcj_To_Gps84(gcj02.getWgLat(), gcj02.getWgLon()); return map84; } public static boolean outOfChina(double lat, double lon) { if (lon < 72.004 || lon > 137.8347) return true; if (lat < 0.8293 || lat > 55.8271) return true; return false; } public static Gps transform(double lat, double lon) { if (outOfChina(lat, lon)) { return new Gps(lat, lon); } double dLat = transformLat(lon - 105.0, lat - 35.0); double dLon = transformLon(lon - 105.0, lat - 35.0); double radLat = 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 = lat + dLat; double mgLon = lon + dLon; return new Gps(mgLat, mgLon); } public static double transformLat(double x, double y) { double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x)); ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0; ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0; ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0; return ret; } public static double transformLon(double x, double y) { double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x)); ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0; ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0; ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0; return ret; } public static void main(String[] args) { Gps gps = new Gps(40.084481,116.395412 ); System.out.println("gps :" + gps); Gps bd = bd09_To_Gcj02(gps.getWgLat(), gps.getWgLon()); System.out.println("bd :" + bd); } } /** * @ClassName: Gps * @Description: TODO * @author: Max dou * @date: 2017年4月10日 下午4:19:13 */ public class Gps { private double wgLat; private double wgLon; public Gps(double wgLat, double wgLon) { setWgLat(wgLat); setWgLon(wgLon); } public double getWgLat() { return wgLat; } public void setWgLat(double wgLat) { this.wgLat = wgLat; } public double getWgLon() { return wgLon; } public void setWgLon(double wgLon) { this.wgLon = wgLon; } @Override public String toString() { return wgLat + "," + wgLon; } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
三 : 利用百度地图api接口,坐标转换
参考链接:http://lbsyun.baidu.com/index.php?title=webapi/guide/changeposition 此接口为免费接口,不过每天有限制
- 1
- 2
- 3
四 : 利用百度地图api接口,根据坐标获取地理位置信息
参考链接:http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-geocoding
此接口为免费接口,不过每天有限制:
/** * @ClassName: BaiDuUtil * @Description: TODO * @author: Max dou * @date: 2017年4月10日 上午11:58:55 */ public class BaiDuUtil { public static String getCity(String lat, String lng) { JSONObject objSrc = getLocationInfo(lat, lng); System.out.println(objSrc.toString()); JSONObject obj = getLocationInfo(lat, lng).getJSONObject("result") .getJSONObject("addressComponent"); return obj.getString("city"); } public static JSONObject getLocationInfo(String lat, String lng) { String url = "http://api.map.baidu.com/geocoder/v2/?location=" + lat + "," + lng + "&output=json&ak=" + "此处填写百度开放平台秘钥" + "&pois=0"; JSONObject obj = JSONObject.fromObject(HttpUtil.getRequest(url)); return obj; } public static void main(String[] args) { System.out.println(BaiDuUtil.getCity("40.091637", "116.396764")); } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
五 : 阿里云接口 : 根据坐标获取地理位置信息
(此接口从网上找到的,已现在测试看没有限制条件)需要json解析包: <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> <classifier>jdk15</classifier> </dependency>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
import java.net.URL; import net.sf.json.JSONArray; import net.sf.json.JSONObject; /** * @ClassName: GetLocation * @Description: TODO * @author: Max dou * @date: 2017年4月10日 下午1:53:42 */ public class GetLocation { public static void main(String[] args) { String add = getAdd("110.303959", "23.548133"); JSONObject jsonObject = JSONObject.fromObject(add); JSONArray jsonArray = JSONArray.fromObject(jsonObject.getString("addrList")); JSONObject j_2 = JSONObject.fromObject(jsonArray.get(1)); JSONObject j_1 = JSONObject.fromObject(jsonArray.get(0)); String allAdd = j_2.getString("admName"); String arr[] = allAdd.split(","); System.out.println("省:"+arr[0]+"\n市:"+arr[1]+"\n区:"+arr[2]+"\n路:"+j_1.getString("name")+"\n详细地址:"+j_2.getString("name")); } public static String getAdd(String log, String lat ){ //lat 小 log 大 ,经过测试,数据的经纬度为国家坐标即火星坐标 //参数解释: 纬度,经度 type 001 (100代表道路,010代表POI,001代表门址,111可以同时显示前三项) String urlString = "http://gc.ditu.aliyun.com/regeocoding?l="+lat+","+log+"&type=111"; String res = ""; try { URL url = new URL(urlString); java.net.HttpURLConnection conn = (java.net.HttpURLConnection)url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(conn.getInputStream(),"UTF-8")); String line; while ((line = in.readLine()) != null) { res += line+"\n"; } in.close(); } catch (Exception e) { System.out.println("error in wapaction,and e is " + e.getMessage()); } System.out.println(res); return res; } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
如有什么问题,请大家指正,谢谢!
- 1
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-7f770a53f2.css" rel="stylesheet"> </div>
-
地图坐标系转换
2018-04-24 15:36:47设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系, * 谷歌地图采用的是WGS84地理坐标系(中国范围除外); * GCJ02坐标系:即火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84... -
Openlayers GPS(度分秒)和经纬度坐标相互转换
2022-04-04 20:07:55在地图开发过程中,尤其是手持设备中,有时会遇到GPS原始坐标数据,为了方便使用,需要转换为经纬度。Openlayers GPS(度分秒)和经纬度坐标相互转换
OpenLayers 教程
在地图开发过程中,尤其是涉及手持设备,有时会遇到GPS原始坐标数据(116°23’28.44",39°54’25.77"),为了方便使用,需要转换为经纬度(116.39123,39.9071583)。
这里介绍一下GPS坐标和经纬度坐标互转。
Openlayers GPS(度分秒)和经纬度坐标相互转换
<html lang="en"> <head> <meta charset="utf-8"> <!--注意:openlayers 原版的比较慢,这里引起自己服务器版--> <link rel="stylesheet" href="http://openlayers.vip/examples/css/ol.css" type="text/css"> <style> /* 注意:这里必须给高度,否则地图初始化之后不显示;一般是计算得到高度,然后才初始化地图 */ .map { height: 400px; width: 100%; float: left; } </style> <!--注意:openlayers 原版的比较慢,这里引起自己服务器版--> <script src="http://openlayers.vip/examples/resources/ol.js"></script> <script src="./tiandituLayers.js"></script> <title>OpenLayers example</title> </head> <body> <h2>Feature transfer</h2> <!--地图容器,需要指定 id --> <div id="map" class="map"></div> <!--注意:本示例将 高德腾讯坐标设置为黑色;将百度坐标设置为黄色 --> <!--注意:本示例将 高德腾讯坐标转为WGS84颜色设置为粉色;将百度坐标转为WS84颜色设置为绿色 --> <script type="text/javascript"> var map = new ol.Map({ // 地图容器 target: 'map', // 地图图层,比如底图、矢量图等 layers: [ getIMG_CLayer(), getIBO_CLayer(), getCIA_CLayer(), ], // 地图视野 view: new ol.View({ projection: "EPSG:4326", // 定位 center: [116, 39], // 缩放 zoom: 4, maxZoom: 18, minZoom: 1, }) }); var xy = [116.391232637988, 39.907157016256974]; // 初始点 var originPoint = new ol.Feature({ geometry: new ol.geom.Point(xy), name: 'My Point' }); // 矢量图层 var layer = initVectorLayer(); /** * @todo 矢量图层 * @returns {VectorLayer} * @constructor */ function initVectorLayer() { //实例化一个矢量图层Vector作为绘制层 let source = new ol.source.Vector(); //创建一个图层 let customVectorLayer = new ol.layer.Vector({ source: source, zIndex: 2, //设置样式 style: new ol.style.Style({ //边框样式 stroke: new ol.style.Stroke({ color: 'red', width: 5, lineDash: [3, 5] }), //填充样式 fill: new ol.style.Fill({ color: 'rgba(0, 0, 255, 0.3)', }), image: new ol.style.Circle({ radius: 9, fill: new ol.style.Fill({ color: 'red', }) }) }), }); //将绘制层添加到地图容器中 map.addLayer(customVectorLayer); customVectorLayer.getSource().addFeatures([originPoint]); var extent = customVectorLayer.getSource().getExtent(); map.getView().fit(extent, { duration: 1,//动画的持续时间, callback: null, }); return customVectorLayer; } /** * 添加点到地图 * @param geom * @param color 颜色 * @returns {Feature|Feature|null} */ function addFeature(geom, color) { let temp = new ol.Feature({ geometry: new ol.geom.Point(geom), name: 'My Point' }); let style = new ol.style.Style({ image: new ol.style.Circle({ radius: 9, fill: new ol.style.Fill({ color: color || 'blue', }) }) }); temp.setStyle(style); layer.getSource().addFeatures([temp]); move(); return temp; } //============转换方法 start =================================================================================== /** * 度分秒转经纬度 * @param dfm * @returns {number} */ function convertGPSToXY(dfm) { const arr1 = dfm.split('°'); const d = arr1[0]; const arr2 = arr1[1].split("'") let f = arr2[0] || 0; const m = arr2[1].replace('"', '') || 0; f = parseFloat(f) + parseFloat(m / 60); var du = parseFloat(f / 60) + parseFloat(d); return du; } /** * 经纬度转度分秒 * @param point * @returns {*} */ function convertXYToGPS(point) { let xy; if (point instanceof Array) { xy = point; } else { point = point + ""; xy = point.split(','); } let dPoint = []; let dPointStr = ""; for (let i = 0; i < xy.length; i++) { const mElement = xy[i] + ""; const arr1 = mElement.split("."); const d = arr1[0]; let tp = "0." + arr1[1] tp = String(tp * 60); //这里进行了强制类型转换 const arr2 = tp.split("."); const f = arr2[0]; tp = "0." + arr2[1]; tp = tp * 60; const m = tp.toFixed(2); const dfm = d + "°" + f + "'" + m + "\""; dPointStr += "," + dfm; dPoint.push(dfm); } dPointStr = dPointStr.replace(',', ''); return point instanceof Array ? dPoint : dPointStr; } var gps; /** * @todo gps坐标转为WKT格式 */ function GPSToXY() { if (!gps) { alert("请先点击 XY坐标转为GPS坐标!"); return; } // 参数包含x和y,并且以 , 拼接 if (gps instanceof Array) { alert("XY数组:" + [convertGPSToXY(gps[0]), convertGPSToXY(gps[1])]); // 参数只有x或者y } else { alert("X或Y:" + convertGPSToXY(gps)); } } /** * @todo WKT坐标转为gps格式 */ function XYToGPS() { // 获取坐标 // var point = xy; var point = originPoint.getGeometry().getCoordinates(); gps = convertXYToGPS(point); alert("gps数组:" + gps); } //===========转换方法 end ==================================================================================== </script> <button id="WKTToGPS" onclick="XYToGPS()">XY坐标转为GPS坐标</button> <button id="GPSToWKT" onclick="GPSToXY()">GPS坐标转为XY坐标</button> </body> </html>
在线示例
Openlayers GPS(度分秒)和经纬度坐标相互互转换:Openlayers transfer_gps
-
经纬度坐标系之间相互转化工具(百度与WGS84、百度与国测局、国测局与WGS)
2021-09-26 14:45:56刚刚想从百度坐标拾取工具里面找到一些地点的经纬度,存储到系统中使用,由于百度拾取系统给到的是百度(BD-09)坐标系统,系统统一用到的是WGS-84,所以需要进行一次转换,本来想从网上下载一个,结果花了仅剩不多...1.前言
刚刚想从百度坐标拾取工具里面找到一些地点的经纬度,存储到系统中使用,由于百度拾取系统给到的是百度(BD-09)坐标系统,系统统一用到的是WGS-84,所以需要进行一次转换,本来想从网上下载一个,结果花了仅剩不多的49积分,下载到了一个用起来很不方便,而且还报错的东西下来,真TM好气!所以无奈自己编写一个提供给大家使用!
2.实现
2.1.语言及框架说明
我这边是基于C#语言开发的winform桌面应用程序,使用的是.NET Framework 4.6.1
2.2.经纬度坐标系统转换类
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CoordinateConversionForm { public class CoordinateUtil { //WGS-84坐标系:全球定位系统使用,GPS、北斗等 //GCJ-02坐标系:中国地区使用,由WGS-84偏移而来 //BD-09坐标系:百度专用,由GCJ-02偏移而来 private static readonly double pi = 3.14159265358979324; private static readonly double x_pi = 3.14159265358979324 * 3000.0 / 180.0; //克拉索天斯基椭球体参数值 private static readonly double a = 6378245.0; //第一偏心率 private static readonly double ee = 0.00669342162296594323; /// <summary> /// BD-09转换GCJ-02 /// </summary> /// <param name="bd_lat">纬度</param> /// <param name="bd_lon">经度</param> /// <returns></returns> public static GPSPoint BD09ToGCJ02(double bd_lat, double bd_lon) { GPSPoint point = new GPSPoint(); double x = bd_lon - 0.0065, y = bd_lat - 0.006; double z = Math.Sqrt(x * x + y * y) - 0.00002 * Math.Sin(y * x_pi); double theta = Math.Atan2(y, x) - 0.000003 * Math.Cos(x * x_pi); double gg_lon = z * Math.Cos(theta); double gg_lat = z * Math.Sin(theta); point.lat = gg_lat; point.lon = gg_lon; return point; } /// <summary> /// GCJ-02转WGS84 /// </summary> /// <param name="gcj_lat"></param> /// <param name="gcj_lon"></param> /// <returns></returns> public static GPSPoint GCJ02ToWGS84(double gcj_lat,double gcj_lon) { GPSPoint point = new GPSPoint(); if (OutOfChina(gcj_lat, gcj_lon)) { point.lon = gcj_lon; point.lat = gcj_lat; } else { double dlat = TransformLat(gcj_lon - 105.0, gcj_lat - 35.0); double dlon = TransformLon(gcj_lon - 105.0, gcj_lat - 35.0); double radlat = gcj_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 = gcj_lat + dlat; double mglon = gcj_lon + dlon; point.lon = gcj_lon * 2 - mglon; point.lat = gcj_lat * 2 - mglat; } return point; } /// <summary> /// BD09转WGS84 /// </summary> /// <param name="bd_lat"></param> /// <param name="bd_lon"></param> /// <returns></returns> public static GPSPoint BD09ToWGS84(double bd_lat, double bd_lon) { GPSPoint point = BD09ToGCJ02(bd_lat, bd_lon); return GCJ02ToWGS84(point.lat, point.lon); } /// <summary> /// GS-84转换BD09 /// </summary> /// <param name="wgLat"></param> /// <param name="wgLon"></param> /// <returns></returns> public static GPSPoint WGS84ToBD09(double wgLat, double wgLon) { GPSPoint point = WGS84ToGCJ02(wgLat, wgLon); return GCJ02ToBD09(point.lat, point.lon); } /// <summary> /// WGS-84转换GCJ-02 /// </summary> /// <param name="wgLat">纬度</param> /// <param name="wgLon">经度</param> /// <returns></returns> public static GPSPoint WGS84ToGCJ02(double wgLat, double wgLon) { GPSPoint point = new GPSPoint(); if (OutOfChina(wgLat, wgLon)) { point.lat = wgLat; point.lon = wgLon; return point; } double dLat = TransformLat(wgLon - 105.0, wgLat - 35.0); double dLon = TransformLon(wgLon - 105.0, wgLat - 35.0); double radLat = wgLat / 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 lat = wgLat + dLat; double lon = wgLon + dLon; point.lat=lat; point.lon=lon; return point; } /// <summary> /// GCJ-02转换BD-09 /// </summary> /// <param name="gg_lat">纬度</param> /// <param name="gg_lon">经度</param> /// <returns></returns> public static GPSPoint GCJ02ToBD09(double gg_lat, double gg_lon) { GPSPoint point = new GPSPoint(); double x = gg_lon, y = gg_lat; double z = Math.Sqrt(x * x + y * y) + 0.00002 * Math.Sin(y * x_pi); double theta = Math.Atan2(y, x) + 0.000003 * Math.Cos(x * x_pi); double bd_lon = z * Math.Cos(theta) + 0.0065; double bd_lat = z * Math.Sin(theta) + 0.006; point.lat = bd_lat; point.lon = bd_lon; return point; } /// <summary> /// 经纬度点是否不再国内(这个方法精确度太差,可以使用GIS算法重写,我这边主要目的是为了做国内经纬度纠偏,国外的不需要纠偏) /// </summary> /// <param name="lat"></param> /// <param name="lon"></param> /// <returns></returns> private static bool OutOfChina(double lat, double lon) { return (lon < 72.004 || lon > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false); } private static double TransformLat(double x, double y) { double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.Sqrt(Math.Abs(x)); ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0; ret += (20.0 * Math.Sin(y * pi) + 40.0 * Math.Sin(y / 3.0 * pi)) * 2.0 / 3.0; ret += (160.0 * Math.Sin(y / 12.0 * pi) + 320 * Math.Sin(y * pi / 30.0)) * 2.0 / 3.0; return ret; } private static double TransformLon(double x, double y) { double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.Sqrt(Math.Abs(x)); ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0; ret += (20.0 * Math.Sin(x * pi) + 40.0 * Math.Sin(x / 3.0 * pi)) * 2.0 / 3.0; ret += (150.0 * Math.Sin(x / 12.0 * pi) + 300.0 * Math.Sin(x / 30.0 * pi)) * 2.0 / 3.0; return ret; } } }
2.3.界面设计
几个RadioButton,一个Button,两个RichTextBox
界面代码:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CoordinateConversionForm { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btn_change_Click(object sender, EventArgs e) { rtb_conversion.Clear(); foreach (var item in rtb_previous.Lines) { string[] lonlatArr = item.Split(','); GPSPoint point = new GPSPoint(); if (rb_bd09Togcj02.Checked) { point = CoordinateUtil.BD09ToGCJ02(double.Parse(lonlatArr[1]), double.Parse(lonlatArr[0])); } else if (rb_bd09Towgs84.Checked) { point = CoordinateUtil.BD09ToWGS84(double.Parse(lonlatArr[1]), double.Parse(lonlatArr[0])); } else if (rb_wgs84Tobd09.Checked) { point = CoordinateUtil.WGS84ToBD09(double.Parse(lonlatArr[1]), double.Parse(lonlatArr[0])); } else if (rb_gcj02Tobd09.Checked) { point = CoordinateUtil.GCJ02ToBD09(double.Parse(lonlatArr[1]), double.Parse(lonlatArr[0])); } else if (rb_wgs84Togcj02.Checked) { point = CoordinateUtil.WGS84ToGCJ02(double.Parse(lonlatArr[1]), double.Parse(lonlatArr[0])); } else if (rb_gcj02Towgs84.Checked) { point = CoordinateUtil.GCJ02ToWGS84(double.Parse(lonlatArr[1]), double.Parse(lonlatArr[0])); } rtb_conversion.Text += point.lon + "," + point.lat + System.Environment.NewLine; } } } }
另外还有一个经纬度点的封装实体类
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CoordinateConversionForm { public class GPSPoint { public double lat; public double lon; } }
3.实现效果
4.源码资源
-
经纬度坐标系分类转换以及奥维地图导出路径经纬度所属坐标系
2020-09-07 14:26:17WGS-84坐标:世界标准经纬度坐标系(GPS/北斗设备得到的经纬度) GCJ-02坐标:中国国内使用的经纬度坐标系(火星坐标系),是经过WGS-84坐标系换算得到的,比如WGS-84坐标系下经纬度为45°30’ 20在火星坐标系下对应... -
wgs84坐标系经纬度投影_南方cass坐标转经纬度_坐标转经纬度软件
2021-03-17 10:03:14一、笔名 主流被使用的地理坐标系并不统一,常见的有wgs84、gcj02(月球坐标系)、bd09(百度坐标系)此外百度地图中留存矢量信息的web墨卡托,本文利用python编写相关类以实现4种坐标功能之间的相互转换。... -
kotlin DLLatLngUtil 经纬度数据处理工具的使用 坐标系转换 度分秒转换
2021-11-10 16:18:36kotlin DLLatLngUtil 经纬度数据处理工具的使用 坐标系转换 度分秒转换前言使用实例Github完事 前言 常用的经纬度数据的处理逻辑封装。 使用 1 Add it in your root build.gradle at the end of repositories: ... -
python 编写的经纬度坐标转换类
2020-12-29 00:05:02设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系,#* 谷歌地图采用的是WGS84地理坐标系(中国范围除外);#* GCJ02坐标系:即火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标... -
【GNSS】北斗坐标系
2021-04-23 17:21:241. 北斗坐标系 一个全球卫星导航定位系统的基本任务是为全球用户提供可用性、完好性、连续性和精度符合规定要求的导航定位服务。卫星导航系统赖以导航定位的大地基准是其使用的坐标系。坐标系对导航定位系统的重要... -
WGS84地球坐标系,GCJ02火星坐标系,BD09百度坐标系简介与转换
2019-09-25 22:36:15背景:从GPS和北斗卫星定位得到的定位数据采用的都是WGS84坐标系,即地球坐标系,但是国内不管是高德地图、百度地图采用的并不是WGS84坐标系,所以需要经过转换后才能使用,前端用百度API提供的方法转换速度较慢。... -
C语言版经纬度与高斯投影相互转换函数
2018-11-15 17:26:52C语言版经纬度与高斯投影相互转换函数,实现了不同坐标系之间转换 -
GIS投影、坐标系、坐标系转换
2022-05-10 10:08:15整理GIS基础知识,投影,坐标系问题。 1. 大地测量学 (Geodesy) 大地测量学是一门量测和描绘地球表面的学科,也包括确定地球重力场和海底地形。 1.1 大地水准面 (geoid) 大地水准面是海洋表面在排除风力、潮汐等... -
JAVA将北斗定位系统坐标系用于高德地图或百度地图
2021-06-28 16:01:57常用坐标系介绍 WGS-84(GPS) 国际标准,一般从国际标准的GPS设备获取的坐标都是WGS-84,以及国际地图提供商使用的...如果有对接过北斗定位系统的小伙伴可能会发现一个问题,北斗坐标经纬度好像都被乘了100? $GNRMC, -
各种地图坐标系转换工具
2021-02-11 15:40:58} }/*** 各种坐标系转换工具类 *@authorchenfangbo *@returndouble **/ public classPositionUtil {public static final String BAIDU_LBS_TYPE = "bd09ll";public static double pi = 3.1415926535897932384626 * ... -
GPS坐标转换经纬度及换算方法
2013-04-11 13:58:34地形图坐标系:我国的地形图采用高斯-克吕格平面直角坐标系。在该坐标系中,横轴:赤道,用Y表示;纵轴:中央经线,用X表示;坐标原点:中央经线与赤 道的交点,用0表示。赤道以南为负,以北为正;中央经线以东为... -
不同gps坐标系统比较与转换以及经纬度距离计算MATLAB脚本
2017-05-29 16:11:36自己写了一个MATLAB的demo,关于地图之间的gps坐标转换,以及计算gps坐标之间的距离(单位:m)。 -
GPS坐标系转换工具类
2022-06-07 14:04:01GPS坐标系转换工具类 -
代码分析Python地图坐标转换
2020-12-24 02:33:22设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系, 谷歌地图采用的是WGS84地理坐标系(中国范围除外); GCJ02坐标系:即火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标... -
GNSS系列(1)------GNSS坐标系转换
2020-12-03 10:17:43由于工作需要,最近开启了GNSS系列文章的撰写工作,发布于公司官网,现将其同步至CSDN。 原文链接: ... “GNSS定位不准确,漂移了好几公里,... WGS-84:大地坐标系,也是目前广泛使用的GPS采用的坐标系,在中国,任何 -
火星坐标系、WGS84坐标系、百度坐标系和Web墨卡托坐标系相互转换(基于Python实现)
2022-04-14 21:55:59主流被使用的地理坐标系并不统一,导致在处理多源数据时往往会出现对不齐的情况,如何在火星坐标系、WGS84坐标系、百度坐标系和Web墨卡托坐标系进行坐标转换非常关键,本文介绍了基于python实现的坐标系转换代码。 -
GPS坐标系转高德地图坐标系——数据库函数+存储过程实现
2021-01-26 09:35:31设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系。 GCJ-02坐标系:它是一种对经纬度数据的加密算法,即加入随机的偏差。国内出版的各种地图系统(包括电子形式),必须至少采用GCJ-02对地理位置进行... -
FreeJTS部标视频平台:车载坐标系与地图坐标系转换
2020-11-23 10:48:07设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系。 GCJ02坐标系 火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系。 BD09坐标系 百度地图使用坐标系,... -
WGS84、GCJ02、BD09地图坐标系间的坐标转换及坐标距离计算
2020-12-19 07:51:40设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系,最基础的坐标,谷歌地图在非中国地区使用的坐标系GPS/谷歌地图卫星GCJ02火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。并要求在中国... -
对.gpx文件进行地图坐标系转换
2020-10-02 13:11:07设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系,最基础的坐标,谷歌地图在非中国地区使用的坐标系 GPS/谷歌地图卫星 GCJ02 火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。并要求... -
根据经纬度计算距离的公式、百度坐标转换成GPS坐标(PHP版)
2021-02-05 09:24:15//百度坐标转换成GPS坐标$lnglat = '121.437518,31.224665';function FromBaiduToGpsXY($lnglat){// 经度,纬度$lnglat = explode(',',$lnglat);list($x,$y) = $lnglat;$Baidu_Server = ... -
各地图API坐标系统比较与转换(WGS84坐标系、火星坐标系、百度坐标系、搜狗坐标系、图吧坐标系)
2016-04-17 23:31:50设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系, * 谷歌地图采用的是WGS84地理坐标系(中国范围除外); * GCJ02坐标系:即火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS... -
GIS:深圳独立坐标系与国家2000坐标系互转教程
2022-08-02 17:53:39经过多年的发展,在深圳独立坐标系下的地理数据已经积累很多了,如今国家要求统一转换到国家2000坐标系。对于北京54、西安80这类坐标系下的数据,借助ArcGIS软件能够很轻松地转换为国家2000,但是由于缺少深圳独立...