GPS location is always biased in China

I use the latest SDK for Google Maps iOS in my application, and it seems that the GPS location is always shifted in China by 1-2 street blocks, however in the official Google Maps application the location is 100% correct.

I came across this post, which seems to be the reason: http://home.wangjianshuo.com/archives/20081109_all_maps_in_china_are_transformed.htm

It seems that the official application uses the correctly converted map, and the Google Maps iOS SDK does not. Has anyone found a way around this?

+6
source share
2 answers

The reason for GPS correction in China is the combination of technology (different databases) and political / economic interests.

Due to security concerns, China uses a different coordinate system from the rest of the world - GCJ-02 instead of WGS-84 , used by GPS satellites and the vast majority of maps. All maps of China must be approved by the State Council in order to mark the position of China on various politically disputed possessions (Tibet, Taiwan, etc.). Approval also requires cards to use the GCJ-02. This causes WGS-84 locations, such as GPS tracks from a genuine GPS receiver, to be displayed “off” when building on Chinese street maps.

GPS coordinates appear offset on GCJ-02 map

Another coordinate system is usually not a problem, but China decided to encrypt the GCJ-02, so there is no direct conversion. The first conversion attempt used a coordinate database obtained from Google China Maps (ditu.google.com), when earlier it could calculate the deviation in 2010. It was an interpolation method and somewhat inaccurate. The data sets went on sale using offsets calculated for thousands of Chinese cities .

Meanwhile, the GCJ-02 algorithm has leaked and is a “public secret” (searching for “GCJ-02 conversion” finds many results). The eviltransform project is known to offer the conversion APIs for C, C #, Go, Java, JavaScript, and PHP. The geoChina library handles the conversion between GJC-02, WGS-084 and Baidu BD-09 using R.

The code is non-trivial and also performs a very crude check box to determine if it is in China:

function outOfChina(lat, lng) { if ((lng < 72.004) || (lng > 137.8347)) { return true; } if ((lat < 0.8293) || (lat > 55.8271)) { return true; } return false; } 

This includes most of India, all of South and North Korea, the Philippines, Vietnam, Mongolia, Thailand and several other countries:

enter image description here

An improvement would be to use a polygon border like china.kml .

+6
source

Isn't this because of using another coordinate system used in China, the one we use WGS84?

Here are some code that can handle translations from WGS84

0
source

All Articles