{ "info": { "author": "Tom Caruso", "author_email": "carusot42@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython" ], "description": "\n# meridian\n\n[![PyPI version](https://badge.fury.io/py/meridian.svg)](https://badge.fury.io/py/meridian)\n\nHigher-level geospatial data abstractions for Python.\n\n\n`meridian` lets you treat your geospatial dataset like you would a normal Python data structure, backed by a spatial index for high-performance geospatial queries.\n\n\n# Usage\n\nThe core data structure implemented is the `SpatialDataset`, which takes an iterable (`list`, `generator`, etc) of [GeoJSON](http://geojson.org/)-structured `dict`s and builds up the dataset and index. The records in your dataset are stored within the `SpatialDataset` as `SpatialData` objects, with all the key/value pairs in the GeoJSON's `properties` as attributes. Once it's done loading, you have a familiar-feeling data structure you can use to query your dataset.\n\n`meridian` is fully compatible with the GeoJSON-like objects produced by the `fiona` library, which makes it very easy to get started:\n\n```python\nimport fiona\n\nfrom meridian import SpatialDataset\nfrom shapely import geometry\n\nwith fiona.open('/path/to/my/shapefile.shp') as src:\n dataset = SpatialDataset(src)\n\n# Find out how many records you have\nprint(len(dataset))\n\npoi = geometry.shape({\n 'type': 'Point',\n 'coordinates': [-72.319261, 43.648956]\n})\n\n# Check if your poi intersects with the dataset\nprint(dataset.intersects(poi)) # True\n\n# See how many records intersect\nprint(dataset.count(poi)) # 1\n\n# Find the n nearest records to the query geometry\nprint(dataset.nearest(poi, 3))\n\n# The dataset itself is iterable.\nfor record in dataset:\n print(record)\n\n# iterate through all records in the dataset which bbox-intersect with poi\n# dataset.intersection returns a list of spatialdata objects\nfor record in dataset.intersection(poi):\n print(record)\n\n\n```\n\nAll of the spatial query methods on a `SpatialDataset` require only that the query object has a `bounds` property which returns a 4-tuple like `(xmin, ymin, xmax, ymax)`. As long as that exists, `meridian` is agnostic of query geometry implementation, however it does use `shapely` geometry under the hood for the records stored within.\n\nThe records in a `SpatialDataset` are `SpatialData`s:\n\n```python\npoi = geometry.shape({\n 'type': 'Point',\n 'coordinates': [-72.319261, 43.648956]\n})\n\nfor record in dataset:\n print(record.id) # The id in the `id` field of the input geojson\n print(record.geom) # The `shapely` geometry representation of the record\n print(record.bounds) # The bounds of the geometry\n print(record.properties) # a dict of all the `properties` in the initial geojson feature\n print(record.my_fancy_property) # All individual properties in the geojson feature will be exposed as attributes on the namedtuple\n\n # SpatialData objects are fully compatible with all of the objects & operations defined in the shapely package.\n print(record.intersects(poi))\n print(poi.intersects(record))\n\n# Even advanced operations like cascaded union work as expected.\nfrom shapely.ops import cascaded_union\n\nunioned = cascaded_union(dataset)\nprint(unioned.wkt)\n\n```\n\nSince the `id` field is not part of the GeoJSON spec it is optional to include; the library will function just fine without it. However, it does give the user a means to uniquely identify the records within each dataset.\n\n\n# Installation\n\nFrom `pypi`:\n\n pip install meridian\n\nOr, clone the repo and run\n\n python path/to/repo/setup.py install\n\nYou can also use `pip` to install directly from the github repo:\n\n pip install git+git://github.com/tomplex/meridian.git\n\n\n`meridian` requires GEOS (for the `shapely` library) and [`libspatialindex`](https://libspatialindex.github.io/) to create the spatial index used for querying. On most systems, `libspatialindex` must be compiled from source. These instructions should work on Linux & macOS:\n\n```bash\nwget -qO- http://download.osgeo.org/libspatialindex/spatialindex-src-1.8.5.tar.gz | tar xz -C /tmp\ncd /tmp/spatialindex-src-1.8.5 && ./configure; make; make install\n```\n\nOn Linux, you might be to run `ldconfig` afterwards to ensure that the `rtree` python library can find the library correctly.\n\nIf you use docker, there are images with all dependencies and the latest version of `meridian` pre-installed available on [docker hub](https://hub.docker.com/r/tomplex/meridian-base/).\n\n# Gotcha's\n\nData takes up memory. Depending on the number & size of the geometries you're trying to work with, you might run out of memory. On my machine, a 2016 MacBook Pro, I found that a dataset with 350k records with an average of 6 nodes per polygon used ~500mb of memory footprint. YMMV. \n\n`meridian` is opinionated and believes that data should be immutable. If you need your data to change, you should create new data representing your input + processing instead of changing old data. Thus, a `SpatialDataset` is more like a `frozenset` in behavior than a `list`. \n\n\n# Planned features\n\n- In-depth docs and usage examples\n- Format compat. Built-in tools to help load data from other formats (Postgres, WKT, etc)\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/tomplex/meridian", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "meridian", "package_url": "https://pypi.org/project/meridian/", "platform": "", "project_url": "https://pypi.org/project/meridian/", "project_urls": { "Homepage": "https://github.com/tomplex/meridian" }, "release_url": "https://pypi.org/project/meridian/1.1.0/", "requires_dist": [ "shapely (>=1.6.4.post2)", "Rtree (>=0.8.3)" ], "requires_python": ">=3.6.0", "summary": "Easy geospatial data processing.", "version": "1.1.0" }, "last_serial": 4877697, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0d154efe460bf3f09675c9cf594b2e34", "sha256": "1d3fd0c7b84c7318441e3b85d21e5d4a8f11f32efcd6842624920e0689b63689" }, "downloads": -1, "filename": "meridian-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0d154efe460bf3f09675c9cf594b2e34", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5.0", "size": 5789, "upload_time": "2018-11-18T06:58:58", "url": "https://files.pythonhosted.org/packages/11/d9/ca18860950c4855f376b8c4fcf9667c55a9a2fa65185ed60c97feb3e6012/meridian-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "09899a2dc09315387255017093c0c0a3", "sha256": "4c427a2f6b4e24787653c9564501bfc695ba4f6414265770b13ec72d9cba6c69" }, "downloads": -1, "filename": "meridian-0.1.0.tar.gz", "has_sig": false, "md5_digest": "09899a2dc09315387255017093c0c0a3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.0", "size": 6120, "upload_time": "2018-11-18T06:59:00", "url": "https://files.pythonhosted.org/packages/c9/66/abb68ae96a5a99b71d41d0c38664dbc7df54618917da75c2f22ee147ad60/meridian-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "07ec751d3ee9f1fff31c20916e4beebd", "sha256": "77b7edaca7554cb0e9e21921adceb92d1f0a522c8772778c1c1cbf3bedce2724" }, "downloads": -1, "filename": "meridian-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "07ec751d3ee9f1fff31c20916e4beebd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5.0", "size": 6098, "upload_time": "2018-11-19T22:11:25", "url": "https://files.pythonhosted.org/packages/ad/42/c9f98880753d2681eb091a0824441eadb26b37b8dc7ab7952592b082190d/meridian-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d443ff1e1f133760b67128e65610287e", "sha256": "9a0fffe8988953ce30306e8ccbb7f89a6f90122162403adf410d268d225d5416" }, "downloads": -1, "filename": "meridian-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d443ff1e1f133760b67128e65610287e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.0", "size": 6481, "upload_time": "2018-11-19T22:11:26", "url": "https://files.pythonhosted.org/packages/85/44/d9aae397e34cb2438915812ed200b6bbdda5408cfe2167856ac08997925f/meridian-0.2.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "c8e5a7ec291a73f7da36c4ed26b12d1d", "sha256": "1e548c5e3fcffc759d8804493646aa33b9357d8f25ad1700c9511e442c67d7c6" }, "downloads": -1, "filename": "meridian-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c8e5a7ec291a73f7da36c4ed26b12d1d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 7987, "upload_time": "2019-02-28T06:00:23", "url": "https://files.pythonhosted.org/packages/04/15/7315e115c298d15785a47867d42310372f392d7864239216507b8f92ce4c/meridian-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "781da4017283ab5e70753ddcfa6adcdd", "sha256": "4c3189b36385b17c4a4c3ab1dda78fb83d8d820868299ad9f03bd73c22822fd3" }, "downloads": -1, "filename": "meridian-1.1.0.tar.gz", "has_sig": false, "md5_digest": "781da4017283ab5e70753ddcfa6adcdd", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 7656, "upload_time": "2019-02-28T06:00:25", "url": "https://files.pythonhosted.org/packages/c4/a8/5bf6d5ff36badf10e1e8be619b7d3e211c33c949bbd62771e6137ed2f9eb/meridian-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c8e5a7ec291a73f7da36c4ed26b12d1d", "sha256": "1e548c5e3fcffc759d8804493646aa33b9357d8f25ad1700c9511e442c67d7c6" }, "downloads": -1, "filename": "meridian-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c8e5a7ec291a73f7da36c4ed26b12d1d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 7987, "upload_time": "2019-02-28T06:00:23", "url": "https://files.pythonhosted.org/packages/04/15/7315e115c298d15785a47867d42310372f392d7864239216507b8f92ce4c/meridian-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "781da4017283ab5e70753ddcfa6adcdd", "sha256": "4c3189b36385b17c4a4c3ab1dda78fb83d8d820868299ad9f03bd73c22822fd3" }, "downloads": -1, "filename": "meridian-1.1.0.tar.gz", "has_sig": false, "md5_digest": "781da4017283ab5e70753ddcfa6adcdd", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 7656, "upload_time": "2019-02-28T06:00:25", "url": "https://files.pythonhosted.org/packages/c4/a8/5bf6d5ff36badf10e1e8be619b7d3e211c33c949bbd62771e6137ed2f9eb/meridian-1.1.0.tar.gz" } ] }