{ "info": { "author": "Mingye Wang", "author_email": "arthur200126@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: GIS" ], "description": "PRCoords\n========\n\nPeople's Rectified Coordinates (PRCoords) is a cross-language implementation of \"public secret\" Chinese coordinate obfuscation methods including GCJ-02 and BD-09, along with general deobfuscation methods previously established in [ChinaMapShift][], [eviltransform][], and [geoChina][]. (Referring to the process of replacing straight lines with wavy ones as a \"transform\" is euphemism overdone.)\n\n[ChinaMapShift]: https://gist.github.com/anonymous/e7c6f67555099180ce1ae8da4ba2c513\n[geoChina]: https://github.com/caijun/geoChina/blob/master/R/cst.R\n[eviltransform]: https://github.com/googollee/eviltransform\n\nLanguages\n---------\n\n- [x] JavaScript ([`npm install prcoords`](https://www.npmjs.com/package/prcoords))\n * Web demo: https://artoria2e5.github.io/PRCoords/demo\n- [x] Python ([`pip install prcoords`](https://pypi.org/project/prcoords/))\n- [x] \\(Obj-\\)C/C++ (C structs)\n * [ ] Makefile with `install`\n- [ ] Ruby\n- [ ] Swift\n- [ ] C#\n- [x] Haskell (GCJ only; data structure incomplete)\n * need to move googollee/eviltransform#54 here sometime.\n- [ ] Java\n- [ ] Matlab/Octave\n * too lazy to split the files. also expand \"caijun\"\n- [x] PGSQL\n- [ ] Typed Racket\n * is it done?\n\n(should I split them into submodules?)\n\nFor languages not yet supported, we recommend you to check for [eviltransform][] (MIT) or [geoChina][] (GPLv3, R) instead.\n\nAPI\n---\n\nPRCoord's APIs operate on, and returns, dedicated structures for coordinates. In API names, we generally refer to WGS-84 as `wgs`, GCJ-02 as `gcj`, and BD-09 (lat-lon) as `bd`. \n\n### Inverse functions\n\nThe obfuscations generally have these properties to maintain basic usefulness:\n\n1. `obfs(coord)` is sort of close to `coord`.\n2. `obfs(a) - obfs(b)` is usually close to `a - b`. (The closer `a` and `b` are\n to each other, the better it works.)\n\nIn general two approaches of inverting the \"forward\" obfuscations, or working from\n`obfs(coord)` to `coord`, are implemented:\n\n* _Run it backwards_: `obfs(coord)` is never too far from `coord`, so just use\n \u00a0`obfs(obfs(coord)) - obfs(coord)` to estimate `obfs(coord) - coord`.\n* _Iterate a bit_: Get a rough `guess` somehow, and just use property 2 to estimate\n the remaining error as `obfs(guess) - obfs(coord)` and correct the `guess`.\n\nYou can read on the demo page about how well these methods work from the `\u0394Roundtrip`\nentry. Unless you are doing archival work, you generally don't have to iterate.\n\n### The \"in China\" sanity check\n\nTypically PRCoords is only supposed to be ran on obfuscated input data, which\nare primarily Chinese coordinates. For this reason, initial implementations\ninclude this [very very rough](https://news.ycombinator.com/item?id=10965506)\nsanity check that spans a rectangular region on a mercator-projected map.\nThis check can be overridden by passing a boolean value, or may be not at all\nimplemented in certain languages if I am not in the right mood for doing\nsilly things.\n\nThere is an \"insane\" sanity check intended to approximate the range of Google\nand Baidu's distortion, intended for use by [IITC](https://iitc.me):\n[`js/insane_is_in_china.js`](https://github.com/Artoria2e5/PRCoords/blob/master/js/insane_is_in_china.js).\nIt is basically a ray-casting polygon check with 70 vertices. You, as the\ncaller, should still be responsible for telling whether a point is part of the\ngov-screwed Chinese data.\n\nWhy another wheel?\n------------------\n\n* Public Domain\n* Clean API based on pairs of coordinates\n* Need to find a place for this sarcastic name\n\nPhysical PRCoords\n-----------------\n\nYou can print out a minimal copy of PRCoords with [this PDF file](https://commons.wikimedia.org/wiki/File:PRcoords_Cheatsheet.pdf). I am working on some better options [in issue #2](https://github.com/Artoria2e5/PRCoords/issues/2). A fairly simple tote bag with an older version of the PDF is [available from Teespring](https://teespring.com/miniprcoords-tote-v1).\n\nFeel free to print and sell t-shirts with the PDF file! It is put in the Public Domain, so you don't have to pay me for that. You can always fund my subversive activities on [Patreon](https://www.patreon.com/artoria2e5) though.\n\nLicense\n-------\n\nUnless otherwise mentioned, all files in this package, including this README file,\nare dual-licensed under:\n\n* [CC0 1.0 Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/)\n* [GNU General Public License (version 3 or up)](https://gnu.org/licenses/gpl.html)\n\nGPL is only included for fun here.\n\nSources\n-------\n\n* [Algorithm.Coords.Converter](https://archive.is/20130815104734/emq.googlecode.com/svn/emq/src/Algorithm/Coords/Converter.java) from [EMQ](https://code.google.com/archive/p/emq/) ([GitHub mirror](https://github.com/richardyu-au/emq)) is probably *the* GCJ leak. It is a JSP project \"for demonstrating GIS systems\", probably done by some government contractor.\n * There is some randomness in the GCJ deltas on both axes: one `sin` invocation and one LCG. Each add a maximum of 1 meter of error.\n* [on4wp7](https://archive.is/20150702191259/https://on4wp7.codeplex.com/SourceControl/changeset/view/21483%23353936) (2013) is the earliest rationalized GCJ (forward) implementation. No randomness is attempted.\n* [ChinaMapShift][] (2014) figured out the quick iterative inverse for GCJ. I learned about it via geoChina first and generalized it here.\n* BD-09 is not very well sourced, but [pycoordtrans](https://github.com/zxteloiv/pycoordtrans) (2014) seems to have it.\n\nSee also\n--------\n\n* [Restrictions on geographic data in China](https://en.wikipedia.org/wiki/Restrictions_on_geographic_data_in_China#Coordinate_systems): this Wikipedia article outlines impacts and the \"common secret\" deobfuscation approach.\n * Chinese readers: see [\u4e2d\u534e\u4eba\u6c11\u5171\u548c\u56fd\u6d4b\u7ed8\u9650\u5236](https://zh.wikipedia.org/wiki/\u4e2d\u534e\u4eba\u6c11\u5171\u548c\u56fd\u6d4b\u7ed8\u9650\u5236).\n* [eviltransform][] is among the most popular cross-language soltions to the problem. It borrows its name directly from [EvilTransform.cs](https://github.com/Leask/EvilTransform/blob/master/EvilTransform.cs), an early refactored version of a raw-flesh Java implementation found in \"[emq](https://code.google.com/archive/p/emq/)\", some sort of government contractor GIS demo project.\n * Since June 2016, eviltransform contains numerous parameter errors that compromise its output, especially for BD-09. See googollee/eviltransform[#43](https://github.com/googollee/eviltransform/issues/43), [#53](https://github.com/googollee/eviltransform/pull/53) and [#44](https://github.com/googollee/eviltransform/issues/44) for corrections. As of June 2019 these problems are not fixed.\n* [geoChina][] by caijun is a clear, concise implementation written in R. It features the iterative method from ChinaMapShift.\n* I am planning on moving some of the comments on the algorithm found in [my initial JavaScript implementation](https://zh.wikipedia.org/wiki/User:Artoria2e5/PRCoords.js) to the [GitHub Wiki](https://github.com/Artoria2e5/PRCoords/wiki). I don't think anyone is going to be interested in copying comments on these idiocy when translating my implementation to other languages.\n** If you are doing a translation, consider only using the comments from the PDF.\n\nOh, and finally, here is an official [news report](https://archive.fo/20110804185923/http://cxzy.people.com.cn/GB/196034/14908095.html) on that particular *\\[bleep\\]* who came up with GCJ-02.\n\n\n\n \n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Artoria2e5/PRCoords", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "prcoords", "package_url": "https://pypi.org/project/prcoords/", "platform": "", "project_url": "https://pypi.org/project/prcoords/", "project_urls": { "Homepage": "https://github.com/Artoria2e5/PRCoords" }, "release_url": "https://pypi.org/project/prcoords/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "Public Domain library for rectifying Chinese coordinates (gcj-02/bd-09)", "version": "1.0.2" }, "last_serial": 5690653, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f2bec7d0aa54fb5082ba608eaffe3d13", "sha256": "9375094d8b5056ed03b3b77029ae3c4f7fc91b69185933ef76726329876146a5" }, "downloads": -1, "filename": "prcoords-1.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "f2bec7d0aa54fb5082ba608eaffe3d13", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7777, "upload_time": "2019-06-28T02:11:37", "url": "https://files.pythonhosted.org/packages/f6/5f/bee6731768340345ba4a56c0b6c7c06c02b5193c69c542f2bdb8c89b16dc/prcoords-1.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d33f7a3c72ac83ba716deef9ce434f58", "sha256": "7e59a9786c111f65c09c59a56f7f5a4ceb8f82cb1e068b868a820e9e56058bc7" }, "downloads": -1, "filename": "prcoords-1.0.0.tar.gz", "has_sig": false, "md5_digest": "d33f7a3c72ac83ba716deef9ce434f58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7358, "upload_time": "2019-06-28T02:11:40", "url": "https://files.pythonhosted.org/packages/e5/60/7b484bee55a21a0ca6392eef3f75c28f11e682ba8731c6ea93764c24adba/prcoords-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "331689e70ff0912b372b422d708e4e78", "sha256": "94b868f690ef6bb12fade2f63b656b2915b3f3753abd88eb63d8023cc33a3909" }, "downloads": -1, "filename": "prcoords-1.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "331689e70ff0912b372b422d708e4e78", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7797, "upload_time": "2019-08-17T01:35:00", "url": "https://files.pythonhosted.org/packages/b3/4d/c2d0c0629c6cd45f24b8a28026f284cf5110af01f0a209c0af2bf5f36960/prcoords-1.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3819e5de8b28c9ce5942af64dd699e9b", "sha256": "888d7d23540a366fbf3c15ac8f8f61b2bd0d559bee9efac47bb3998c106f11f6" }, "downloads": -1, "filename": "prcoords-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3819e5de8b28c9ce5942af64dd699e9b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7768, "upload_time": "2019-08-17T01:35:02", "url": "https://files.pythonhosted.org/packages/99/7c/3e46af73966831e95179435d9d23106765bf389f103b31af90371836ae65/prcoords-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "04b2b8558c9c609d021e73da522c07f7", "sha256": "fe89e46ade1cf84082864157a40430a420c8e69ed277eede0b43388c05ef0287" }, "downloads": -1, "filename": "prcoords-1.0.1.tar.gz", "has_sig": false, "md5_digest": "04b2b8558c9c609d021e73da522c07f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7458, "upload_time": "2019-08-17T01:35:04", "url": "https://files.pythonhosted.org/packages/4c/21/31ef2a56b45740509baf5e6602b033f0b9da47808512a1f6aa6a2a3b1804/prcoords-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "ef43904dd7bf8188101afb17c2295bf6", "sha256": "9d3bc12667b19dffac2769df17c735e6a6f91e154f8fbdddc95bd816def9fe3d" }, "downloads": -1, "filename": "prcoords-1.0.2.tar.gz", "has_sig": false, "md5_digest": "ef43904dd7bf8188101afb17c2295bf6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7429, "upload_time": "2019-08-17T05:35:37", "url": "https://files.pythonhosted.org/packages/5d/4b/a77264c82300976f769fb2cbf3c466ddb8d07adea2c2c7bbabe95a41aff6/prcoords-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ef43904dd7bf8188101afb17c2295bf6", "sha256": "9d3bc12667b19dffac2769df17c735e6a6f91e154f8fbdddc95bd816def9fe3d" }, "downloads": -1, "filename": "prcoords-1.0.2.tar.gz", "has_sig": false, "md5_digest": "ef43904dd7bf8188101afb17c2295bf6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7429, "upload_time": "2019-08-17T05:35:37", "url": "https://files.pythonhosted.org/packages/5d/4b/a77264c82300976f769fb2cbf3c466ddb8d07adea2c2c7bbabe95a41aff6/prcoords-1.0.2.tar.gz" } ] }