{ "info": { "author": "Kevin Brochet-Nguyen", "author_email": "kmbn@nevermindtheumlauts.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Scientific/Engineering :: GIS" ], "description": "# Geodaisy: Python GeoJSON, WKT, and \\_\\_geo_interface\\_\\_ made easy\n\n[![GitHub license](https://img.shields.io/github/license/kmbn/geodaisy.svg?style=flat-square)](https://raw.githubusercontent.com/kmbn/geodaisy/master/LICENSE)\n[![PyPI Version](https://img.shields.io/pypi/v/geodaisy.svg?style=flat-square)](https://pypi.org/project/geodaisy/)\n[![Travis](https://img.shields.io/travis/kmbn/geodaisy.svg?style=flat-square)](https://travis-ci.org/kmbn/geodaisy)\n\nGeodaisy helps you convert to and from GeoJSON, Well Known Text (WKT), and Python objects that support the \\_\\_geo_interface\\_\\_ standard.\n\nGeodaisy works with Python 2 and Python 3.\n\n## What's this for?\n\nGeodaisy is for you if you:\n- Have GeoJSON and need WKT\n- Have WKT and need GeoJSON\n- Have GeoJSON or WKT and need a Python dictionary or array\n- Have a Pyshp shape object after reading a shapefile and need GeoJSON or WKT\n- Have a Shapely shape object and need GeoJSON or WKT\n- Have any other Python object with a \\_\\_geo_interface\\_\\_ and need GeoJSON or WKT\n- Want a \\_\\_geo_interface\\_\\_ dictionary that correctly and consistently implements the [specification](https://gist.github.com/sgillies/2217756)\n\nGeodaisy provides a GeoObject that can be created from any of the formats or objects above. GeoObject methods output GeoJSON, WKT, etc. representations of the object. Geodaisy also includes individual converters that can be used separately if you do not need an object.\n\n### Examples\n\n#### Convert WKT to GeoJSON\n```python\n>>> import geodaisy.converters as convert\n>>> wkt = 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))'\n>>> convert.wkt_to_geojson(wkt)\n'{\"type\": \"Polygon\", \"coordinates\": [[[30, 10], [40, 40], [20, 40], [10, 20], [30, 10]]]}'\n```\n\n#### Convert GeoJSON to WKT\n```python\n>>> import geodaisy.converters as convert\n>>> geojson = '{\"type\": \"Polygon\", \"coordinates\": [[[30, 10], [40, 40], [20, 40], [10, 20], [30, 10]]]}'\n>>> convert.geojson_to_wkt(geojson)\n'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))'\n```\n\n#### Create a GeoObject from any Python object with a geo_interface\n```python\n>>> from shapely.geometry import Polygon\n>>> polygon = Polygon([(30, 10), (40, 40), (20, 40), (10, 20), (30, 10)])\n>>> from geodaisy import GeoObject\n>>> geo_obj = GeoObject(polygon)\n>>> geo_obj\n{'type': 'Polygon', 'coordinates': [[(30.0, 10.0), (40.0, 40.0), (20.0, 40.0), (10.0, 20.0), (30.0, 10.0)]]}\n>>> geo_obj.type\n'Polygon'\n>>> geo_obj.coordinates\n[[(30.0, 10.0), (40.0, 40.0), (20.0, 40.0), (10.0, 20.0), (30.0, 10.0)]]\n>>> geo_obj.geojson()\n'{\"type\": \"Polygon\", \"coordinates\": [[[30.0, 10.0], [40.0, 40.0], [20.0, 40.0], [10.0, 20.0], [30.0, 10.0]]]}'\n>>> geo_obj.wkt()\n'POLYGON ((30.0 10.0, 40.0 40.0, 20.0 40.0, 10.0 20.0, 30.0 10.0))'\n```\n\n## Why use this instead Shapely or geojson, etc.?\nOther libraries are only offer translations to and from specific formats. For example, Shapely can go to and from WKT and \\_\\_geo_interface\\_\\_, but not GeoJSON. geojson can go to and from GeoJSON and \\_\\_geo_interface\\_\\_, but not WKT. If you need more than one kind of translation, you need to use more than one library. Geodaisy translates to and from multiple formats.\n\nIn addition, some other libraries, like Shapely, are much heavier. That makes sense, since they also do a lot more\u2014but it also makes installing them more of a chore. Geodaisy is lightweight and has no dependencies beyond Python core.\n\n## When should I use something else?\n\n### If you need to validate coordinates\nGeodaisy does not validate coordinates. Yet. If you need to validate coordinates, you might find libraries like [Shapely](https://pypi.org/project/Shapely/) or [geojson](https://pypi.org/project/geojson/) helpful, depending on what your expected inputs and outputs are. Note that neither of them fully validate coordinates when creating a shape object\u2014you need to create an object first, and then validate it, meaning that whether you use Geodaisy or one of the other libraries, you may wind up creating an invalid shape.\n\nIn the future, Geodaisy will validate coordinates when creating objects. (If you'd like to help make that possible, [contributions are welcome!](#contributions))\n\nNote that you can still use Geodaisy _with_ other geo libraries, or as a go-between or intermediary _between_ other libraries or types of object.\n\n### If you need geometric predicates, relationships, transformations and other operations on geometric objects\nIf you need any of the above, you probably need [Shapely](https://pypi.org/project/Shapely/).\n\n## How to install\n`pip install geodaisy`\n\n## Running the tests\n(The following commands assume you're in the `geodaisy` root directory.)\n\nGeodaisy uses the pytest testing framework as well as the Shapely and geojson libraries for testing. You'll need to install them first by doing `pip install -r dev-requirements.txt`.\n\nIf you're using Python 2 or a version of Python 3 prior to 3.5, you'll need to make sure that the `typing` module is installed: `pip install -r py2-requirements.txt`or `pip install typing`\n\nTo run the tests, just do `pytest`.\n\n## Contributing\nContributions are very welcome! In addition to the tests mentioned above, Geodaisy also uses flake8 for linting and Mypy for type checking. Pull requests will need to pass the tests as well as flake8 and Mypy checks (unless you're developing with Python 2, in which case you'll have to skip Mypy, since it requires Python 3.\n\n(The following commands assume you're in the Geodaisy root directory and have already pip-installed the dev requirements (see above).)\n\nTo run flake8: `flake8 src tests`\n\nTo run Mypy (if you're using Python 3): `mypy --py2 src`\n\n## License\nGeodaisy is licensed under the [MIT License](https://raw.githubusercontent.com/kmbn/geodaisy/master/LICENSE) and is free for commercial and private use.\n\n## Copyright\nCopyright © 2018 Kevin Brochet-Nguyen", "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/kmbn/geodaisy", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "geodaisy", "package_url": "https://pypi.org/project/geodaisy/", "platform": "", "project_url": "https://pypi.org/project/geodaisy/", "project_urls": { "Homepage": "https://github.com/kmbn/geodaisy" }, "release_url": "https://pypi.org/project/geodaisy/0.1.1/", "requires_dist": null, "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "summary": "Python GeoJSON, WKT, and __geo_interface__ made easy.", "version": "0.1.1" }, "last_serial": 3748278, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "952cd74e94fd780ddd5d173a78d859a5", "sha256": "aaf6fe6b56cfeb9f5012610ccc950485d4e5a58fa90aa3688de9d9a1466e9a7e" }, "downloads": -1, "filename": "geodaisy-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "952cd74e94fd780ddd5d173a78d859a5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 10312, "upload_time": "2018-04-03T19:16:39", "url": "https://files.pythonhosted.org/packages/f3/8f/23432a44558bcfc145a0b57107ae14a132d859581b846cf78ab7fa330a4f/geodaisy-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c1ef691c462591a4c79c43da87099832", "sha256": "29fa7364792bb4936b2b92c1a717cf4451db637e71910f722a59f48474a98921" }, "downloads": -1, "filename": "geodaisy-0.1.tar.gz", "has_sig": false, "md5_digest": "c1ef691c462591a4c79c43da87099832", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 8451, "upload_time": "2018-04-03T19:16:40", "url": "https://files.pythonhosted.org/packages/d7/ec/496c199c9d6377fb37fa4bed5b028998e20681b3014b447b995556b04e01/geodaisy-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f77b41fb7477b07458e92cb94c7c036e", "sha256": "15c2fd06f5ed24f0b297362caeb72d5cd18c616d48fc15e4a2ab9c3555c9c88b" }, "downloads": -1, "filename": "geodaisy-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f77b41fb7477b07458e92cb94c7c036e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 10336, "upload_time": "2018-04-09T11:04:18", "url": "https://files.pythonhosted.org/packages/99/a8/2ae2aec50916fb5c8cfa55810665c5fad3d444bc4b76bf48e123f6f42b3c/geodaisy-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3380db1124476e5f5fbd99fc3f581bee", "sha256": "599085c93545e862558a49e40afa325b07a8a487ac07b3f3e0e30a404979636a" }, "downloads": -1, "filename": "geodaisy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3380db1124476e5f5fbd99fc3f581bee", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 8643, "upload_time": "2018-04-09T11:04:12", "url": "https://files.pythonhosted.org/packages/61/4d/f68ec5e88a686ccd2ccc867da86324f509e4cb0a8f99410aeb2c555ef3e6/geodaisy-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f77b41fb7477b07458e92cb94c7c036e", "sha256": "15c2fd06f5ed24f0b297362caeb72d5cd18c616d48fc15e4a2ab9c3555c9c88b" }, "downloads": -1, "filename": "geodaisy-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f77b41fb7477b07458e92cb94c7c036e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 10336, "upload_time": "2018-04-09T11:04:18", "url": "https://files.pythonhosted.org/packages/99/a8/2ae2aec50916fb5c8cfa55810665c5fad3d444bc4b76bf48e123f6f42b3c/geodaisy-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3380db1124476e5f5fbd99fc3f581bee", "sha256": "599085c93545e862558a49e40afa325b07a8a487ac07b3f3e0e30a404979636a" }, "downloads": -1, "filename": "geodaisy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3380db1124476e5f5fbd99fc3f581bee", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 8643, "upload_time": "2018-04-09T11:04:12", "url": "https://files.pythonhosted.org/packages/61/4d/f68ec5e88a686ccd2ccc867da86324f509e4cb0a8f99410aeb2c555ef3e6/geodaisy-0.1.1.tar.gz" } ] }