The Android Project uses the Baidu map location Sdk,web End Use is also Baidu map, later found that the interface shows Baidu map is not as good as the gold effect, the web switch to the gold map, the original Baidu map coordinates can be used directly, due to the German and Baidu map coordinate system inconsistency to how to convert it.
After the knowledge of the coordinate system, it was found that the coordinate system used by the GCJ02 is "Mars coordinates"
Baidu use is "BD09" because Baidu is used by everyone is accustomed to call "Baidu coordinates", how to turn bd09 into gcj02, suddenly think in Baidu's positioning SDK has such a section of instructions (from Baidu map)
?
12345678 |
设置返回值的坐标类型。 public void setCoorType ( String ) 我们支持返回若干种坐标系,包括国测局坐标系、百度坐标系,需要更多坐标系请联系我们,需要深度合作。目前这些参数的代码为。因此需要在请求时指定类型,如果不指定,默认返回百度坐标系。注意当仅输入IP时,不会返回坐标。目前这些参数的代码为 返回国测局经纬度坐标系 coor=gcj02 返回百度墨卡托坐标系 coor=bd09 返回百度经纬度坐标系 coor=bd09ll 百度手机地图对外接口中的坐标系默认是bd09ll,如果配合百度地图产品的话,需要注意坐标系对应问题。 |
That is to say, Baidu this positioning SDK should be able to directly return gcj02 coordinates, so you can directly in the use of the German
The code is as follows
?
12 |
LocationClientOption option = new LocationClientOption(); option.setCoorType( "gcj02" ); //如果是百度坐标参数为 bd0911 |
It seems that Baidu's use of the SDK to find this piece is better than gold, so it will appear in spite of the good map data but in the development or Baidu map picked the first color.
Android Note: Baidu map and the German map coordinate conversion problem