In the interest of national security, the Chinese government strictly controls geographic data, and deliberately skews maps of the country to protect sensitive buildings and facilities. These restrictions cause offsets in the data when using GPS navigation or digital maps, but the OpenStreetMap (OSM) based maps in Gaia GPS don’t have this problem, and this makes apps like Gaia GPS popular in China.
You can find hiking, cycling, and topo maps based on OpenStreetMap in Gaia GPS. Check out these Knowledge Base links to learn how to change your visible layer to an OSM-based source in the iOS or Android versions of Gaia GPS.
Apple Maps Work, but iOS Photos and Apps Have Issues
Because Apple is an authorized mobile provider that has purchased a “shift correction algorithm,” Apple Maps will display your current location correctly on an iPhone. However, the GPS offset still causes a number of problems on iOS devices:
- Your phone will offset geotagged photos. Similarly, some cameras with GPS chips may not display coordinates for users in China either.
- Google Maps will only display the correct location on an Android phone, an iPhone user who recently visited China explained.
- Apps that show your friends’ whereabouts will offset their locations by 300-500 meters, or about a block or two.
GPS, Mapping, and Chinese Law
OSM’s contributors build the map by collecting GPS traces and by tracing features from satellite imagery. Despite legal restrictions, a lot of this mapping has been done in China. Our recent blog post explains how to contribute to OSM, but keep in mind that due to restrictions on private mapping activities, doing so in China is illegal.
The restrictions apply to all types of geographic data; the country’s Surveying and Mapping Law effectively makes private surveying and mapping off-limits in mainland China. While the government has provisions for academic research, foreigners must obtain approval from the State Council and partner with the relevant authorities when conducting fieldwork. Individuals who break the rules can face confiscation of equipment, interrogation, and even jail time. China takes the matter very seriously, as evidenced by the nearly 40 illegal mapping cases it prosecuted from 2006-2011. Law enforcement has detained and questioned geologists and other scientists for recording what they believed to be innocuous GPS coordinates for their research.
How to Circumvent the GPS Restrictions in China
When you’re on the ground in China, using an OSM-based map is the best way to get accurate locations. In addition, if you’re a programmer working with geotagged photos or other geodata, there are several open source scripts that can help you convert WGS coordinates to GCJ-02.
Programmers can choose from scripts in C#, R, Python, PHP, Ruby, and Objective-C to georeference locations correctly. While the authors of the scripts probably used leaked code to create them, other solutions use the accurately aligned data from the Chinese version of Google Maps. Some fixes use statistical regression to interpolate GWS-84 coordinates from this version.
Did You Know? Google Maps and Displacement
You may notice the displacement when using satellite imagery in Google Maps (compared to a road map), and particularly when looking at major roads. For example, in the screen shot below, Google offsets the marked highway interchanges near the Capital Library and Beijing Vansha Outlets Shopping Center to the northeast on the street map.
This is because location-based service providers like Google must obtain authorization from the Chinese government to offer digital street maps of China, and buy a “shift correction” algorithm. In order to comply with the law, these companies must use the country’s proprietary, encrypted GCJ-02 coordinate system, rather than the most commonly used WGS-84 system. The satellite imagery uses the “true” coordinate system, while the street map uses the skewed Chinse system. Dan Dascalescu investigated this shift by searching maps.google.com for the known WGS coordinates of the Monument to the People’s Heroes in Shanghai (31.24427 N, 121.48695 E).
Google’s street map retrieves a location in the middle of the Wusong River, while in reality you’ll find the monument several hundred meters to the southeast, at the intersection of the Wusong and Huangpu Rivers.
Activating the satellite imagery reveals pronounced misalignment, as shown in the screenshot below. The marker appears in the correct position on the imagery.
Apple Maps has the same displacement issue. Searching on the WGS coordinates will pinpoint the correct location on the imagery, but not on the map. Apple doesn’t display the street map’s road network when imagery is activated, which makes the effect less jarring. Still, the bevvy of hotels it displays in the middle of the Wusong River give the displacement away.
The misalignment does not appear on the Chinese version of Google Maps, since both the imagery and the map use the state-mandated coordinate system. Users can pinpoint the correct location of the monument on both sources by searching for the GCJ-02 coordinates (31.2423 N, 121.4914 E). Similarly, maps from the Chinese company Baidu line up correctly. In addition, manufacturers evidently modify GPS devices sold in China to align with GCJ-02 maps. “It is still unclear whether GPS chips manufactured in China return GCJ-02 coordinates directly to match approved Chinese maps, or if they return WGS-84 coordinates, which authorized map software providers can convert to GCJ-02,” a Wikipedia article on the subject states.
However, because the cartographic regulations do not apply in the special administrative regions (SAR) of Macau and Hong Kong, Google will always scramble the map at the borders of these SARS and mainland China.