{ "info": { "author": "lucaspcram", "author_email": "lucaspcram@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7" ], "description": "# PyAtlas\n#### A simplified Atlas API for Python\n\n----\n## Getting Started\nTo get setup in a new project folder, run:\n\n $ mkdir newproj && cd newproj\n $ virtualenv venv --python=python2.7\n $ source venv/bin/activate\n\nNOTE: `pyatlas` will automatically install the dependencies it needs, including\nthe Protocol Buffers Python runtime - `protobuf-2.6.1`. \nTherefore, it is highly recommended that you develop `pyatlas` based projects in\na Python virtual environment - you may need to install `virtualenv` if you have not already. \n(If you want to create a `pyatlas` distribution that does not automatically pull\nin dependencies, see the next section.)\n\nNow that you have your virtual environment set up, you can install `pyatlas` with:\n\n (venv) $ pip install pyatlas\n\nIf pip is unable to find the `pyatlas` package, you may need to build it from\nsource yourself. Check the next section for more info.\n\nTo test that everything went smoothly, create a file `helloatlas.py` with the following code:\n```python\nimport pyatlas\npyatlas.hello_atlas()\n```\nNow run:\n\n (venv) $ python helloatlas.py\n\nIf you see:\n\n Hello Atlas!\n\nthen you're good to go!\n\n----\n## Building the `pyatlas` module\nTo build the `pyatlas` module from source, run:\n\n $ git clone https://github.com/osmlab/atlas.git\n $ cd atlas\n $ ./gradlew buildPyatlas\n\nThis will generate a wheel file at `pyatlas/dist`. You can now install this with `pip` like\n\n $ cd /path/to/project/that/uses/pyatlas\n $ virtualenv venv --python=python2.7\n $ source venv/bin/activate\n $ pip install /path/to/atlas/pyatlas/dist/pyatlas-VERSION.whl\n\nAgain, it is recommended that you do this in the desired virtual environment.\n\nIf you want to build a `pyatlas` wheel file that does not automatically pull dependencies,\nopen up `setup.py` and remove the lines that say\n\n install_requires=[\n .\n .\n .\n ],\n\nThen re-run the `./gradlew buildPyatlas` command from above and reinstall\nusing `pip`. Note that you will now need to manage the required dependencies manually.\n\n### Note on the formatter\n`pyatlas` uses the `yapf` formatting library to check for code format issues when building.\nIf you are running into issues after modifying `pyatlas`, try running\n\n ./gradlew applyFormatPyatlas\n\nNow `pyatlas` should make it past the `CHECK` format step!\n\nNote there is an issue that causes the formatter to goof if a source file does not\nend with a newline (\\n) character.\nIf the `CHECK` format step is consistently failing after repeated `APPLY` steps,\nand you are seeing a message like the following:\n\n atlas.py: found issue, reformatting...\n\nwith no formatter diff being displayed, check to make sure that the file has an ending newline. \n\n----\n## Documentation\n`pyatlas` documentation is automatically generated using the `pydoc` tool and\nstored in the `doc` folder. To build\nthe documentation, run the gradle build command:\n\n $ ./gradlew buildPyatlas\n\nThis will generate HTML files detailing the functions and classes available in each module.\n\n----\n## Some sample use cases\n`pyatlas` is a highly capable subset of the API provided by the Java `Atlas`. Here are some examples\nto get you started. Note that all of these examples were ran using the `test.atlas`\nprovided in the `resources` folder, and assume that you have an atlas variable defined like:\n\n```python\nfrom pyatlas.atlas import Atlas\natlas = Atlas('/path/to/atlas/pyatlas/resources/test.atlas')\n```\n\n#### Getting features and metadata\nYou can get filtered iterables over an `Atlas`'s features using the methods provided in the `Atlas` class.\n\n```python\n# print all Nodes\nfor node in atlas.nodes():\n print node\n\n# print all Edges that have 'key1' as a tag key\nfor edge in atlas.edges(predicate=lambda e: 'key1' in e.get_tags().keys()):\n print edge\n```\n\nYou can also get a feature with a specific identifier like:\n\n```python\n# print the Relation with Atlas ID 2\nprint atlas.relation(2)\n```\n\nMetadata about the `Atlas` is also available. For a quick sample, try something like:\n\n```python\nmetadata = atlas.metadata()\nprint metadata.number_of_points\nprint metadata.country\n```\n\nCheck out `doc/atlas.html` and `doc/atlas_metadata.html` for more information.\n\n#### Operating on features\nThe `Atlas` features themselves support a set of operations defined in their respective classes.\n\nHere is a quick example:\n\n```python\n# print the tag dict for Point with Atlas ID 3\nprint atlas.point(3).get_tags()\n\n# print all Relations of which the Node with Atlas ID 1 is a member\nfor relation in atlas.node(1).relations():\n print relation\n\n# print all the members of Relation with Atlas ID 1\nfor member in atlas.relation(1).get_members():\n # print the RelationMember object\n print member\n # print the actual AtlasEntity contained in the RelationMember\n print member.get_entity()\n```\n\n`Node`s and `Edge`s, in particular, support traversal through their connectivity API.\nHere are just the basics of what you can do with the connectivity interface:\n\n```python\n# print Edges connected to Node with ID 3\nfor edge in atlas.node(3).in_edges():\n print edge\nfor edge in atlas.node(3).out_edges():\n print edge\nfor edge in atlas.node(3).connected_edges():\n print edge\n\n# print the start and end Nodes of Edge 1\nprint atlas.edge(1).start()\nprint atlas.edge(1).end()\n```\n\nMany more methods are provided. See the classes in `doc/atlas_entities.html` for more information.\n\n#### Geometry\n`pyatlas` features some really simple geometry primitives for working with locations and shapes on the\nsurface of the Earth. Here is a simple example that uses these primitives:\n\n```python\nfrom pyatlas import geometry\nfrom pyatlas.geometry import Location, PolyLine, Polygon, Rectangle\n\n# Location constructor (lat/lon ordering) uses dm7 by default, see Location docs for info on dm7\nloc1 = Location(385000000, -1160200000)\n# create the same Location but with degree values instead (lat/lon ordering)\nloc2 = geometry.location_with_degrees(38.5, -116.02)\nprint loc1.get_latitude_deg()\nprint loc2.get_latitude()\n\n# create a new PolyLine with two shape points\npolyline1 = PolyLine([Location(385000000, -1160200000), Location(395000000, -116300000)])\nfor loc in polyline1.locations():\n print loc\nprint polyline1.bounds()\n\n# create a new Polygon with specified vertices\npolygon1 = Polygon([geometry.location_with_degrees(0, 0),\n geometry.location_with_degrees(10, 0),\n geometry.location_with_degrees(5, 10)])\nprint polygon1\n# print the vertices, will print the first again at the end to simulate closedness\nfor loc in polygon1.closed_loop():\n print loc\nprint polygon1.bounds()\n# will print True, since the point lies inside the triangle\nprint polygon1.fully_geometrically_encloses_location(geometry.location_with_degrees(5, 5))\n\n# create a new Rectangle with given lower left and upper right corners\nrect = Rectangle(geometry.location_with_degrees(0, 0), geometry.location_with_degrees(20, 20))\nprint rect\n# this Rectangle intersects (overlaps at any point) polygon1\nprint rect.intersects(polygon1)\n```\n\nSee the classes in `doc/geometry.html` for more information.\n\n#### Spatial queries\n`pyatlas` supports some simple spatial queries over its feature space. The queries use the geometry\nprimitives provided by the `geometry` module, but convert to [Shapely](https://github.com/Toblerity/Shapely)\nprimitives under the hood to make queries into a native [libgeos-backed](https://github.com/OSGeo/geos) R-tree.\nBelow are examples for a few of the spatial queries the `Atlas` supports:\n\n```python\nfrom pyatlas import geometry\nfrom pyatlas.geometry import Rectangle\n\n# print all Points intersecting a given Polygon that also have \"key1\" as a tag key\nlower_left = geometry.location_with_degrees(37, -118.02)\nupper_right = geometry.location_with_degrees(39, -118)\nfor point in atlas.points_within(Rectangle(lower_left, upper_right),\n predicate=lambda e: 'key1' in e.get_tags().keys()):\n print point\n\n# print all Relations with at least one member intersecting a given Polygon\nlower_left = geometry.location_with_degrees(37.999, -118.001)\nupper_right = geometry.location_with_degrees(38.001, -117.999)\nfor relation in atlas.relations_with_entities_intersecting(Rectangle(lower_left, upper_right)):\n print relation\n\n# print all Edges that intersect a given Polygon\nlower_left = geometry.location_with_degrees(38, -120)\nupper_right = geometry.location_with_degrees(40, -117)\nfor edge in atlas.edges_intersecting(Rectangle(lower_left, upper_right)):\n print edge\n```\n\nSee `doc/atlas.html` for more information on the available spatial queries.\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/osmlab/atlas", "keywords": "", "license": "BSD License", "maintainer": "", "maintainer_email": "", "name": "pyatlas", "package_url": "https://pypi.org/project/pyatlas/", "platform": "", "project_url": "https://pypi.org/project/pyatlas/", "project_urls": { "Homepage": "https://github.com/osmlab/atlas" }, "release_url": "https://pypi.org/project/pyatlas/5.3.6/", "requires_dist": [ "protobuf (==2.6.1)", "shapely (==1.6.4)" ], "requires_python": "", "summary": "A simplified Python API for Atlas", "version": "5.3.6" }, "last_serial": 4792099, "releases": { "5.1.2": [ { "comment_text": "", "digests": { "md5": "e1f432d9287e32a9bc6fd8d7bd2f323e", "sha256": "1378016a4de6256066bcdae6d57d9bc7a177db18f65e83e76a62edae7db4fb93" }, "downloads": -1, "filename": "pyatlas-5.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "e1f432d9287e32a9bc6fd8d7bd2f323e", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 51235, "upload_time": "2018-06-20T20:20:14", "url": "https://files.pythonhosted.org/packages/79/b2/d8c9267f2a282d4d5d8040b5e433e890232483a209340d6a7bb401976f9b/pyatlas-5.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3db0f50d9b5112b84ca5391965a4b81c", "sha256": "23b314aec9b986f764f28ccb8646cd0184a718e9a956fb79589870cc15a2d7bb" }, "downloads": -1, "filename": "pyatlas-5.1.2.tar.gz", "has_sig": false, "md5_digest": "3db0f50d9b5112b84ca5391965a4b81c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33127, "upload_time": "2018-06-20T20:20:16", "url": "https://files.pythonhosted.org/packages/2a/7e/f6a94caf90a0577e93082488deedb79d4f6fea2d6ba9d25ef1a229a20c7b/pyatlas-5.1.2.tar.gz" } ], "5.3.6": [ { "comment_text": "", "digests": { "md5": "fff251df9ad3d1767d87b635a6441f42", "sha256": "84e875b6eb8fa7bc3fc11d9d8580b5d38b6eca80dc347abac7b28d614addf997" }, "downloads": -1, "filename": "pyatlas-5.3.6-py2-none-any.whl", "has_sig": false, "md5_digest": "fff251df9ad3d1767d87b635a6441f42", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 52895, "upload_time": "2019-02-07T17:16:45", "url": "https://files.pythonhosted.org/packages/5f/26/100db768b4045fead00f2d4da9f3af2e9c0d17fa305d98fb7d2f24bd4c6a/pyatlas-5.3.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "655b0fc97a8d8afcce21bdea3fbbb2e7", "sha256": "97db40bef8d1f3cc2614aa241298d713403508fb5cd4ae52a554cdb810529bf4" }, "downloads": -1, "filename": "pyatlas-5.3.6.tar.gz", "has_sig": false, "md5_digest": "655b0fc97a8d8afcce21bdea3fbbb2e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33803, "upload_time": "2019-02-07T17:16:47", "url": "https://files.pythonhosted.org/packages/89/63/5a35b061b6b682f6b2575a49bc676ede965783b3ecb26d93e9e537bb1715/pyatlas-5.3.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fff251df9ad3d1767d87b635a6441f42", "sha256": "84e875b6eb8fa7bc3fc11d9d8580b5d38b6eca80dc347abac7b28d614addf997" }, "downloads": -1, "filename": "pyatlas-5.3.6-py2-none-any.whl", "has_sig": false, "md5_digest": "fff251df9ad3d1767d87b635a6441f42", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 52895, "upload_time": "2019-02-07T17:16:45", "url": "https://files.pythonhosted.org/packages/5f/26/100db768b4045fead00f2d4da9f3af2e9c0d17fa305d98fb7d2f24bd4c6a/pyatlas-5.3.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "655b0fc97a8d8afcce21bdea3fbbb2e7", "sha256": "97db40bef8d1f3cc2614aa241298d713403508fb5cd4ae52a554cdb810529bf4" }, "downloads": -1, "filename": "pyatlas-5.3.6.tar.gz", "has_sig": false, "md5_digest": "655b0fc97a8d8afcce21bdea3fbbb2e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33803, "upload_time": "2019-02-07T17:16:47", "url": "https://files.pythonhosted.org/packages/89/63/5a35b061b6b682f6b2575a49bc676ede965783b3ecb26d93e9e537bb1715/pyatlas-5.3.6.tar.gz" } ] }