China Map Deviation as a Regression Problem

All published maps of China are deviated. GPS devices sold in China are modified to give the same deviated coordinates. If you don’t know, you may read here, here, here or here. Fortunately, the same deviation algorithm is applied on all maps I have seen, including Garmin (unistrong in China) GPS maps,, Google Maps/Earth. The algorithm is secrete and is only accessible by authority and companies such as garmin and google. Needless to say, this is very annoying for GPS users. Many individuals tried to discover the deviation algorithm by GPS measurement and correlation and found the algorithm to be not only nonlinear but very complicated to describe.

I accidentally found the Chinese version of Google Map to be able to correlate satellite image with map, and it gives the amount of deviation for any location in China. This URL queries the deviation of 34.29273N,108.94695E (Xi’an):,0.001&t=h&z=18&vp=$34.29273,108.94695 (seems it’ doesn’t work now)

With enough sample data, we should be able to get a regression function, which, should resemble the deviation algorithm. I’m not good at regression so I’m putting up all my data and hope someone can help out. It can be downloaded from here. The format is very simple: four fields (longitude, latitude, longitude deviation and latitude deviation) separated by tab. Longitude deviation means (deviated_longitude – true_longitude). The points are sampled with 0.025 degree separation, i.e. 40 samples per degree. There are 1529737 points (lines of text) in the file. Only points in mainland China are available. Figure 1 and 2 shows an overview of the data.

There is another file, which contains samples from 8 selected lines (4 west-east, 4 south-north). The sample resolution is higher (200 samples per degree). It is used to plot Figure 3-6. I think it’s helpful for regression analysis.

Here are the plots of the data:

latitude deviation shown in color

Fig. 1. latitude deviation shown in color

longitude deviation shown in color

Fig. 2. longitude deviation shown in color

Fig. 3. longitude deviation v.s. longitude

Fig. 4. latitude deviation v.s. longitude

Fig. 5. longitude deviation v.s. latitude

Fig. 6. latitude deviation v.s. latitude

Some observations:

  1. The longitude deviation is always positive (deviate to the east). The maximum is 0.0085562 degree.
  2. The latitude deviation ranges from -0.0038542 (to the south) to +0.0028230 (to the north) degree.
  3. It’s very obvious that there are sinusoid component of period 1 and 1/3. (see Fig. 3, 4 and 6)
  4. Fig. 4. looks simple. You may think it’s f(x)=b*sin(a*x) + b*sin(3*a*x) + c*x + d. You are wrong. There are other small components.
  5. To make discussion easier, let’s define fdx(x,y) to be the longitude deviation of a point with longitude x and latitude y. Similarly, fdy(x,y) to be the latitude deviation of that point. So, Figure 3 shows fdx(x,25.12), fdx(x,32.24), … Figure 6 shows fdy(85.52,x), fdy(97.84,x)
  6. I suggest using fourier transform, but I’m not good at it.

Happy regression!

16 Responses to “China Map Deviation as a Regression Problem”

  1. guest Says:

    did you have any success with findining the right function?

  2. alexgallery Says:

    Thank you for the unlocking tool. It works perfect on Mac.

  3. Der Versender Says:

    Thanks for ‘gimgtools’. An fascinating piece of work!

    Do you know if Is there is a way to convert NT formated maps into in editable format?

  4. GPS и карты: смещённые координаты в Китае | ЧАО ХЭМЗ IPEC Says:

    […] в виде статьи «All Maps in China are Transformed» от Jian Shuo Wang и «China Map Deviation as a Regression Problem» от Wu […]

  5. Maxime Guilbot Says:


    I’ve worked on your data and processed it with Fourier discrete cosine transforms and polynomial regressions. I’ve a version here that works pretty well, with 4-5 meters precision, implemented in Objective-C:

    Thank you for providing all the data, it has been extremely useful.

    • wuyongzheng Says:

      Good to see my data being useful. I have also done some research on the regression function, but haven’t got time to publish it. I will defiantly check your code and maybe refer to it.

  6. wuyongzheng Says:

    There has been some progress on solving the problem. I have put my results here:

  7. remedios caseros para la gripe Says:

    I have been surfing online more than three hours today, but I by no means discovered any fascinating article like yours.

    It is beautiful price sufficient for me. Personally, if all webmasters and bloggers made excellent content material
    as you probably did, the web might be a lot more helpful than ever before.

  8. wuyongzheng Says:

    Seems this problem has been perfectly solved. Comparing my solution and this one, I missed the square root component.

  9. Oleg Says:

    Great work! I’ve been wondering for this stuff two yrs ago when my girlfriend went to China for work and sent me places she visited. Watching Google Maps I noticed that sattelite view doesn’t correspond street view and it was a problem. I then found and there wasn’t that deviation, but that site didnt have option “photograps”… So now it all seems to be clear except how can i use google maps without deviation?
    Oleg from Ukraine

  10. maojianwei Says:

    We need new transform algorithm !!!

    data at 2015.10.11

    NMEA from GPS source:
    lat = 39.5768506
    lon = 116.2097481

    Real Location (From 1. android API 2. picked by BaiduMap):
    lat = 39.96165504
    lon = 116.35180069

    If you have any improvement,
    Please contact me @
    Thank you very much !

  11. Bo Wei-lin Says:

    I guess spatial regression rather than conventional regression because location matters in this case. OLS will not be enough. By the way, where did you get these two datasets, the google link that has expired?

  12. %url% Says:

    Your posts is extremely appealing

  13. 中国地图坐标(GCJ-02)偏移算法破解小史 – Dog my cats Says:

    […] 有了足够的数据,wuyongzheng建议使用回归算法来逼近这个偏移算法: […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: