{"id":18525202,"url":"https://github.com/leifgehrmann/gcj02-distortion-map","last_synced_at":"2025-04-09T12:31:06.165Z","repository":{"id":92188994,"uuid":"195135751","full_name":"leifgehrmann/gcj02-distortion-map","owner":"leifgehrmann","description":"Simple map to display how coordinates are displaced by China's GCJ-02 datum","archived":false,"fork":false,"pushed_at":"2021-06-19T08:40:44.000Z","size":659,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-24T05:34:52.520Z","etag":null,"topics":["china","eviltransform","gcj-02","maps","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leifgehrmann.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-03T22:50:22.000Z","updated_at":"2025-01-06T13:00:53.000Z","dependencies_parsed_at":"2023-06-07T22:00:34.988Z","dependency_job_id":null,"html_url":"https://github.com/leifgehrmann/gcj02-distortion-map","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leifgehrmann%2Fgcj02-distortion-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leifgehrmann%2Fgcj02-distortion-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leifgehrmann%2Fgcj02-distortion-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leifgehrmann%2Fgcj02-distortion-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leifgehrmann","download_url":"https://codeload.github.com/leifgehrmann/gcj02-distortion-map/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248040153,"owners_count":21037825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["china","eviltransform","gcj-02","maps","python"],"created_at":"2024-11-06T17:44:43.645Z","updated_at":"2025-04-09T12:31:06.158Z","avatar_url":"https://github.com/leifgehrmann.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GCJ-02 Distortion Map\n\nI saw this [YouTube video] a while ago about China's obfuscated geodetic datum\ncalled [GCJ-02]. But I was still curious what the distortion actually\nlooks like overall. I could only find [one result on the web], but was not\nsatisfied.\n\nAfter discovering someone has made a nice python library for this called\n[eviltransform], I quickly put together this script that will render the\ndisplacement across China. The output of `distortion-map.py` is displayed\nbelow.\n\n![Map of China showing the GCJ-02 geodetic datum displacement](output.svg)\n\nThe direction of the arrows indicates the direction that the coordinate moves\nwhen going from the [WGS-84] datum to the [GCJ-02] datum.\n\n## Accuracy\n\nThen I wondered how accurate this eviltransform library really is...\n\nSo I sampled some coordinates from Google Maps, which has map data using the\nGCJ-02 datum, then located the \"true\" WGS-84 coordinates in\nOpenStreetMap. These coordinates are in `empirical-data.csv`.\n\nThe script `empirical-data-vs-eviltransform.py` calculates the distance between\nmy sampled coordinates and eviltransform's coordinates. The results of\nthat script is displayed below.\n\n```\nleifgehrmann$ python empirical-data-vs-eviltransform.py \nCity         My Sample         EvilTransform     Difference\nHefei        564.64 metres     566.31 metres      2.14 metres\nBeijing      556.01 metres     555.90 metres      1.78 metres\nChongqing    475.64 metres     479.27 metres      5.15 metres\nFuzhou       591.79 metres     590.93 metres      0.91 metres\nGuangzhou    623.50 metres     621.16 metres      2.94 metres\nLanzhou      220.37 metres     219.71 metres      4.16 metres\nNanning      503.55 metres     511.23 metres      8.02 metres\nGuiyang      537.07 metres     539.67 metres      2.67 metres\nZhengzhou    581.16 metres     577.00 metres      4.80 metres\nWuhan        591.41 metres     586.37 metres      6.03 metres\nShijiazhuang 539.78 metres     532.51 metres      7.46 metres\nHaikou       505.55 metres     509.61 metres      4.07 metres\nHarbin       505.84 metres     509.06 metres      3.30 metres\nChangsha     658.00 metres     659.92 metres      3.42 metres\nChangchun    591.16 metres     586.82 metres      4.80 metres\nNanjing      534.96 metres     541.89 metres      7.85 metres\nNanchang     602.44 metres     606.67 metres      4.49 metres\nShenyang     576.46 metres     577.89 metres      4.74 metres\nHohhot       591.86 metres     589.36 metres      2.52 metres\nYinchuan     390.29 metres     387.54 metres      2.92 metres\nXining       180.53 metres     174.94 metres      6.15 metres\nChengdu      354.21 metres     359.84 metres      7.61 metres\nJinan        531.84 metres     528.25 metres      3.59 metres\nShanghai     473.37 metres     472.91 metres      3.32 metres\nXi'an        465.20 metres     463.65 metres      1.97 metres\nTaiyuan      551.91 metres     555.13 metres      7.02 metres\nTianjin      562.76 metres     562.08 metres      4.59 metres\nÜrümqi       264.13 metres     264.43 metres      3.57 metres\nLhasa        337.64 metres     335.95 metres      7.82 metres\nKunming      357.32 metres     359.96 metres      3.75 metres\nHangzhou     525.59 metres     522.34 metres      7.45 metres\nNgari        347.17 metres     345.03 metres     11.54 metres\nKashgar      267.57 metres     261.01 metres      6.57 metres\nAltay        294.14 metres     292.83 metres      2.76 metres\n```\n\nSince OpenStreetMap data and satellite imagery\nusually has an error of ~15m, this means eviltransform is pretty reliable!\n\n## Installation\n\n```\n# To install geos on the mac...\nbrew install geos\n\n# Create a virtual environment\npython3 -m venv venv\n\n# Active the environment\nsource venv/bin/activate\n\n# Install the dependencies\npip install -r requirements.txt\n\n# Install the non-pip-able dependencies (This takes a while)\npip install https://github.com/matplotlib/basemap/archive/master.zip\n```\n\n**Update 2021:** It appears basemap does not work on python 3.9, so installing\nthe non-pip-able dependencies is broken. This means the `distortion-map.py`\nscript no longer works. Ideally basemap should be replaced with cartopy.\n\n## To run\n\n```\npython distortion-map.py\n\npython empirical-data-vs-eviltransform.py\n```\n\n[YouTube video]: https://www.youtube.com/watch?v=L9Di-UVC-_4\n[one result on the web]: https://www.gearthblog.com/blog/archives/2015/08/look-chinese-map-offsets.html\n[eviltransform]: https://github.com/googollee/eviltransform\n[WGS-84]: https://en.wikipedia.org/wiki/WGS-84\n[GCJ-02]: https://en.wikipedia.org/wiki/Restrictions_on_geographic_data_in_China#GCJ-02\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleifgehrmann%2Fgcj02-distortion-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleifgehrmann%2Fgcj02-distortion-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleifgehrmann%2Fgcj02-distortion-map/lists"}