{ "info": { "author": "Henry Walshaw", "author_email": "henry.walshaw@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: GIS" ], "description": "geogrids\n========\n\n|Latest PyPI version|\n\nA Python implementation of the npm\n`geogrids `__ library by `Iv\u00e1n\nS\u00e1nchez Ortega `__ - utilities for\nworking with Global Discrete Geodetic Grids (GDGGs).\n\nThis module contains both a Location object that can be used to generate\na hash or take a has and generate a location, along with an encoders\nmodule that can transform the code into a (hopefully) useful text\nstring.\n\nThis is written with the default encoders from the original library, and\ncan be easily extended to use a text set of your choice.\n\nUsage\n-----\n\nThere are two components of the library:\n\nRepresenting a location\n~~~~~~~~~~~~~~~~~~~~~~~\n\nGiven some location with a latitude and longitude, for example:\n-35.6498, 150.2935 you can easily create a hash as either a simple\nstring or a numeric value:\n\n::\n\n >>> latitude = -35.6498\n >>> longitude = 150.2935\n >>> import geogrids\n >>> geogrids.gdgg.latitude_longitude_to_readable_hash(latitude=latitude, longitude=longitude)\n '702020210311'\n >>> geogrids.gdgg.latitude_longitude_to_numeric_hash(latitude=latitude, longitude=longitude)\n 12108871\n\nOf course you can go the other direction as well:\n\n::\n\n >>> geogrids.gdgg.numeric_hash_to_latitude_longitude(12108871)\n (-35.65283203125, 150.2789682218808)\n >>> geogrids.gdgg.readable_hash_to_latitude_longitude('702020210311')\n (-35.65283203125, 150.2789682218808)\n\nNotice that the hashes are location approximations depending on a level\nof precision - the higher the precision the better the accuracy:\n\n::\n\n >>> numeric_hash = geogrids.gdgg.latitude_longitude_to_numeric_hash(latitude=latitude, longitude=longitude, precision=55)\n >>> geogrids.gdgg.numeric_hash_to_latitude_longitude(numeric_hash, precision=55)\n (-35.64979965984821, 150.2934998246466)\n\nEffectively these hashes define a location within a triangular region,\nwhich you can retrieve from either the ``numeric_hash_to_area`` or the\n``readable_hash_to_area`` functions, which return a collection of\n``Location`` objects (usually the three vertices of a triangular region,\nbut close to the poles for simplification the default is to return a\nbox):\n\n::\n\n >>> vertices = geogrids.gdgg.numeric_hash_to_area(numeric_hash)\n >>> vertices\n [, , ]\n >>> vertices[0].latitude, vertices[0].longitude\n (-35.63964843750004, 150.24252223120465)\n\nIn general it's advisable to just stick to the hashes and the latitudes\nand longitudes, but the ``Location`` object does implement a\n`__geo_feature__ `__\ninterface which means you can use it with other libraries that work with\nthis interface for more complicated geometric operations, for example\nvia the `Shapely `__ library:\n\n::\n\n >>> from shapely import geometry\n >>> points = [geometry.shape(vertex) for vertex in vertices]\n >>> line = geometry.LineString(points)\n >>> line.length\n 0.11570586750499379\n >>> polygon = geometry.Polygon(line)\n >>> polygon.area\n 0.0015986572857657128\n\nEncoding and decoding a hash\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe encoders allow you to transform a hash to an easily memorisable\nstring and back again. Out of the box this comes with a number of\nencoders:\n\n- ``geogrids.encoders.fucks`` as featured in\n `http://www.what3fucks.com `__\n- ``geogrids.encoders.goshdarnits`` as featured in\n `http://www.what3goshdarnits.com/ `__\n- ``geogrids.encoders.pokes`` as featured in\n `http://www.what3pokemon.com/ `__\n- ``geogrids.encoders.cheeses`` which doesn't yet feature anywhere\n (AFAIK)\n- ``geogrids.encoders.ducks`` as featured in\n `http://www.what3ducks.com `__\n\nGiven a numeric hash of a location (see above) these are easy to use:\n\n::\n\n >>> geogrids.encoders.cheeses.hash_to_string(numeric_hash, precision=25)\n 'Dubliner Requeij\u00e3o Provolone Telemea'\n >>> geogrids.encoders.cheeses.hash_to_string(numeric_hash, precision=55)\n 'Dubliner Requeij\u00e3o Provolone Telemea Danablu Coulommiers Chevrotin'\n\nOr given the readable encoding it's simple to go back the other way:\n\n::\n\n >>> numeric_hash, precision = geogrids.encoders.cheeses.string_to_hash('Dubliner Requeij\u00e3o Provolone Telemea')\n >>> numeric_hash, precision\n (3870868551, 32)\n >>> geogrids.gdgg.numeric_hash_to_latitude_longitude(numeric_hash, precision)\n (-35.647064208984375, 150.2948563112389)\n\nIf you don't want to use one of the builtin encoders, you can generate\nyour own easily:\n\n::\n\n >>> wordlist = list('\ud83d\ude00\ud83d\ude0e\ud83e\udd2c\ud83d\ude31\ud83d\ude08\ud83d\udc4d\ud83d\udd96\u26bd\ud83d\udc36\ud83d\udc0d\ud83d\udc21\ud83e\udd9c\ud83c\udf40\ud83c\udf1e\ud83c\udf1a\ud83d\udd25')\n\n*Note* the wordlist should be length that is a power of two - the level\nused for calculating precisions is rounded down to the closest power of\ntwo - any words after that number will be skipped.\n\n::\n\n >>> emoji_encoder = geogrids.encoders.Encoder(wordlist, separator='')\n >>> emoji_encoder.hash_to_string(numeric_hash, precision)\n '\u26bd\ud83d\ude08\ud83d\ude08\ud83c\udf40\ud83d\udc36\ud83e\udd9c\ud83d\udd96\ud83c\udf1a'\n\n**Warning** One key consideration with the encoders: if you create an\nencoding and share it with someone else the wordlist must be in exactly\nthe same order! Otherwise when decoding you'll get completely different\nresults!\n\n::\n\n >>> numeric_hash, precision = emoji_encoder.string_to_hash('\u26bd\ud83d\ude08\ud83d\ude08\ud83c\udf40\ud83d\udc36\ud83e\udd9c\ud83d\udd96\ud83c\udf1a')\n >>> geogrids.gdgg.numeric_hash_to_latitude_longitude(numeric_hash, precision)\n (-35.647064208984375, 150.2948563112389)\n\nInstallation\n------------\n\n``pip install geogrids``\n\nRequirements\n~~~~~~~~~~~~\n\n``geogrids`` doesn't have any third party library requirements\n\nCompatibility\n-------------\n\nPython 3.5+\n\nLicence\n-------\n\nThis is licensed under the Do What The Fuck You Want Public License as\nis the original JS implementation. So enjoy!\n\nAuthors\n-------\n\n``geogrids`` was written by Henry Walshaw in Python, translated from the\nnpm geogrids library by Iv\u00e1n S\u00e1nchez Ortega\n\n``ducks`` encoder contributed by Adam Steer\n\n.. |Latest PyPI version| image:: https://img.shields.io/pypi/v/geogrids.svg\n :target: https://pypi.python.org/pypi/geogrids\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/om-henners/geogrids", "keywords": "", "license": "WTFPL", "maintainer": "", "maintainer_email": "", "name": "geogrids", "package_url": "https://pypi.org/project/geogrids/", "platform": "", "project_url": "https://pypi.org/project/geogrids/", "project_urls": { "Homepage": "https://github.com/om-henners/geogrids" }, "release_url": "https://pypi.org/project/geogrids/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "A Python implementation of the npm geogrids library - utilities for working with Global Discrete Geodetic Grids (GDGGs)", "version": "1.1.0" }, "last_serial": 5169317, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "76fb31d26a7afeb29f7530dee41e1ecf", "sha256": "43b8e6cdd4f729596637574d6e3b6144481b0dd18a9498bfdf0419047654a0ed" }, "downloads": -1, "filename": "geogrids-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "76fb31d26a7afeb29f7530dee41e1ecf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20192, "upload_time": "2019-04-20T23:45:19", "url": "https://files.pythonhosted.org/packages/1f/61/f89d8a98ee871e83acb7d59bb2ad15085891bf828359f7931d93e2df1c65/geogrids-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a3f8f3f6802b21238902f18b7ea8794", "sha256": "af17ef86e0aede3dcfffec92fa1d71a23148a9aa39e1b7f875b569d6df80def4" }, "downloads": -1, "filename": "geogrids-1.0.1.tar.gz", "has_sig": false, "md5_digest": "6a3f8f3f6802b21238902f18b7ea8794", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21734, "upload_time": "2019-04-20T23:45:22", "url": "https://files.pythonhosted.org/packages/69/27/ba5b7728f524ad7f90170bcf69d82f92e8e43cb63ccf0530bc81f96530e9/geogrids-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "e538fcb9d81f0a256fa82e999d5c6ddc", "sha256": "bd9e5ea19d929df03746e3464c541c2055ffa5e0fe48acd2bcbbbec4fdb752e9" }, "downloads": -1, "filename": "geogrids-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e538fcb9d81f0a256fa82e999d5c6ddc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21056, "upload_time": "2019-04-21T08:25:41", "url": "https://files.pythonhosted.org/packages/66/80/314b10801caba6667f2fecec960dabd9fc1294e59f7ebd8238e96faaa29a/geogrids-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "51bd043416f9a34a34fe11e9464f5b04", "sha256": "b15ea1435d14e209238b4d7e796dde70e054186aac52f60fe484c5f8499df695" }, "downloads": -1, "filename": "geogrids-1.1.0.tar.gz", "has_sig": false, "md5_digest": "51bd043416f9a34a34fe11e9464f5b04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22672, "upload_time": "2019-04-21T08:25:43", "url": "https://files.pythonhosted.org/packages/87/df/df486230b797e3859f855b90f571f39c56e53e13dac35ba34787484f52d8/geogrids-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e538fcb9d81f0a256fa82e999d5c6ddc", "sha256": "bd9e5ea19d929df03746e3464c541c2055ffa5e0fe48acd2bcbbbec4fdb752e9" }, "downloads": -1, "filename": "geogrids-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e538fcb9d81f0a256fa82e999d5c6ddc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21056, "upload_time": "2019-04-21T08:25:41", "url": "https://files.pythonhosted.org/packages/66/80/314b10801caba6667f2fecec960dabd9fc1294e59f7ebd8238e96faaa29a/geogrids-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "51bd043416f9a34a34fe11e9464f5b04", "sha256": "b15ea1435d14e209238b4d7e796dde70e054186aac52f60fe484c5f8499df695" }, "downloads": -1, "filename": "geogrids-1.1.0.tar.gz", "has_sig": false, "md5_digest": "51bd043416f9a34a34fe11e9464f5b04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22672, "upload_time": "2019-04-21T08:25:43", "url": "https://files.pythonhosted.org/packages/87/df/df486230b797e3859f855b90f571f39c56e53e13dac35ba34787484f52d8/geogrids-1.1.0.tar.gz" } ] }