205 points · by ivank · 10y ago · 71 comments
ECEF is based on physical reality. The choice of prime meridian is arbitrary, but everything else has a physical basis. GPS, GLONASS, and Galileo all generate (almost) the same ECEF coordinates. (GLONASS has a position for the center of the earth about 3mm from GPS. Galileo is also about 3mm different.) This reflects when measurements were made.
Latitude and longitude are computed by putting ECEF coordinates into a geoid model. All such formulas are approximations. WGS-84 is used by most of the world. GLONASS uses PZ-90, which is slightly different from WGS-84 and fits the earth's profile better in Russia. The Chinese "encrypted" geoid is WGS-84 with some junk offsets added for coordinates within China's area of interest.[1] There's an actual "out of China" test:
outofChina <- function(lat, lon){
if(lon < 72.004 | lon > 137.8347) return(TRUE)
if(lat < 0.8293 | lat > 55.8271) return(TRUE)
return(FALSE)
}
This is a rather expansive view of China; this goes almost to the equator, including all of the South China Sea and the Spratly Islands.I'm constantly amazed that the whole system can be made to work at such high precision - sub 10cm from a moving aerial survey platform with decent gear. There's rather a lot of correction factors to get just right when pinning a consistent coordinate system on a squishy rotating blob like the Earth.
https://en.wikipedia.org/wiki/Restrictions_on_geographic_dat...
"GCJ-02 (aka Mars Coordinates) is a geodetic datum formulated by the Chinese State Bureau of Surveying and Mapping, and based on WGS-84.[12] It uses an encryption algorithm[13] which adds apparently random offsets to both the latitude and longitude, with the alleged goal of improving national security.[14][15]"
"Despite the secrecy surrounding the GCJ-02 encryption, several open-source projects exist that provide conversions between GCJ-02 and WGS-84, for languages including C#,[20] C, Go, Java, JavaScript, PHP,[21] Python,[22] R,[14] and Ruby.[23][24] They appear to be based on leaked code.[25]"
To be fair, you could say the exact same thing about any modern encryption scheme.
Encryption is designed to be irreversible without a specific piece of extra data.
That isn't the same as not knowing the formula or initialization seeds used. Those are both reversible.
You could "map" the whole thing or somehow steal the source and crypto parameters in order to transform between geoids, but you couldn't do something simple like subtraction.
Even though they're "encrypted", the encryption is locally smooth.
Points may vary by 2km from their wgs84 equivalent, but taking two points 2km away, using the haversine formula will still yield a distance ~2km.
This means we can treat wgs84 and baidu-coordinates as equivalent, but not comparable, which makes a lot of things simpler.
Note: we don't do cross border orders, so we don't need to worry about cross border comparison.
Interestingly, Baidu uses it's own additional encryption on top of GCJ-02, so we are very much locked in
https://en.m.wikipedia.org/wiki/Baidu_Maps#Coordinate_system
The intent is the same as encryption - to keep the real location a secret, available only to people with the key.
It feels different because the encrypted value is basically an offset, and it's continuous, so it feels almost the same as the unencrypted form.
EDIT: grammar
"The Soviets made far more detailed maps of some parts of the world. They mapped all of Europe, nearly all of Asia, as well as large parts of North America and northern Africa at 1:100,000 and 1:50,000 scales, which show even more features and fine-grained topography."
I sincerely doubt they have any of the China GPS offsets.
> Worse, the maps for the masses were deliberately distorted with a special projection that introduced random variations. “The main goal was to crush the contents of maps so it would be impossible to recreate the real geography of a place from the map,” Postnikov tells me. Well-known landmarks like rivers and towns were depicted, but the coordinates, directions, and distances were all off, making them useless for navigation or military planning, should they fall into enemy hands. The cartographer who devised this devious scheme was awarded the State Prize by Stalin.
Many things are forbidden by law, and many people do them anyway, because they know it is not /that/ forbidden. And not only in China, it is the same in France for example.
So, if you are working on OpenStreetMap in China: if your product is successful, be prepared to have to "drink tea" one day with authorities. They may tell you to use another map, or to comply with some rules, or to run your service from outside, etc.
Similarly, `to check the water meter` and `to receive a post package` mean the police to come to your door, as the police are thought to be disguised as staff from tap water company/package delivery company, in both cases, you are about to open the door.
China is not a place I'd like to test those boundaries.
After all, launching all those mapping satellites was expensive. They did it for some reason. ;)
The goal is to prevent uprisings or riots from having accurate data, not to prevent the US, for example, from having accurate data.
This is about citizenry control for internal threats, not external ones.
That would make a good story though, a full on first strike that missed every target '500m to the East' due to some mapping oversight.
However, as for real use 'National Security', you could hide some area by making it not exist with the surrounding area stretched a bit on the map to hide the secret area. With some natural features, or even a big forest, all kinds of things could be hidden from the general public (who are important and primary 'targets' for 'National Security') if not Uncle Sam.
Something similar has happened at least once(0)..
0. https://en.wikipedia.org/wiki/United_States_bombing_of_the_C...
Wrote about it on my old blog in 2013: http://michalkow.tumblr.com/post/43214865761/compensate-for-...
Back in 2008 before I had a smartphone with GPS, I had a camera and a separate GPS device I would use to "tag" places where I took interesting pictures during a 6-month trip around the world.
When I got back home I ran some code to match picture timestamps with GPS timestamps, correcting for time zone offsets (GPS was GMT, pictures were local). All of the pictures of the rest of the countries matched just fine, except for China :) Since I had relatively few data points, it took me a while to realise there was a systematic error in the data, not something I was doing wrong with the timestamps.