{ "info": { "author": "Yann-Sebastien Tremblay-Johnston", "author_email": "yanns.tremblay@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: GIS", "Topic :: Utilities" ], "description": "# geojsplit\nA python implementation of the node package geojsplit: https://github.com/woodb/geojsplit\n\n[![Build Status](https://travis-ci.com/underchemist/geojsplit.svg?branch=master)](https://travis-ci.com/underchemist/geojsplit)\n[![Documentation Status](https://readthedocs.org/projects/geojsplit/badge/?version=latest)](https://geojsplit.readthedocs.io/en/latest/?badge=latest)\n[![Coverage Status](https://coveralls.io/repos/github/underchemist/geojsplit/badge.svg?branch=master)](https://coveralls.io/github/underchemist/geojsplit?branch=master)\n![PyPI](https://img.shields.io/pypi/v/geojsplit)\n![GitHub](https://img.shields.io/github/license/underchemist/geojsplit)\n\n## Installation\n\n### With poetry\n\nFor an [introduction to poetry](https://dev.to/yukinagae/beginner-guide-on-poetry-new-python-dependency-management-tool-4327/).\n\n```\n$ poetry add geojsplit\n```\n\nwill add geojsplit to your current virtual environment and update your poetry.lock file. If you would like to contribute or develop geojsplit\n\n```\n$ git clone https://github.com/underchemist/geojsplit.git\n$ cd geojsplit\n$ poetry install\n```\n\nYou may need some extra configuration to make poetry play nice with conda virtual environments\n\n```\npoetry config settings.virtualenvs.path /envs # tell poetry where you virtualenvs are stored\npoetry config settings.virtualenvs.create 0 # tell poetry not to try to create its own virtualenvs.\n```\n\nSee https://github.com/sdispater/poetry/issues/105#issuecomment-498042062 for more info.\n\n```\n$ poetry config settings.virtualenvs.path $CONDA_ENV_PATH\n$ poetry config settings.virtualenvs.create 0\n```\n\n### With pip\nThough geojsplit is developed using [poetry](https://poetry.eustace.io/) (and as such does not have a setup.py), [pep517](https://www.python.org/dev/peps/pep-0517/) implementation in pip means we can install it directly\n\n```\n$ pip install geojsplit\n```\n\n## Usage\n\nAlthough both the library code and the command line tool of geojsplit are relatively simple, there are use cases for both. You may want to use the backend `GeoJSONBatchStreamer` class directly in order to do more sophisticated manipulations with GeoJOSN documents. As a command line tool geojsplit also works well as a preprocessing step for working with large GeoJSON documents i.e. for piping into GDAL\u2019s ogr2ogr tool.\n\n### As a library\n\nOnce installed, geojsplit can be imported in like\n\n```\nfrom geojsplit import geojsplit\n\ngeojson = geojsplit.GeoJSONBatchStreamer(\"/path/to/some.geojson\")\n\nfor feature_collection in geojson.stream():\n do_something(feature_collection)\n ...\n```\n\nIf the `/path/to/some.geojson` does not exists, `FileNotFound` will be raised.\n\nYou can control how many features are streamed into a Feature Collection using the batch parameter (Default is 100).\n\n```\n>>> g = geojson.stream(batch=2) # instatiate generator object\n>>> data = next(g)\n>>> print(data)\n{\"features\": [{\"geometry\": {\"coordinates\": [[[-118.254638, 33.7843], [-118.254637,\n33.784231], [-118.254556, 33.784232], [-118.254559, 33.784339], [-118.254669,\n33.784338], [-118.254668, 33.7843], [-118.254638, 33.7843]]], \"type\": \"Polygon\"},\n\"properties\": {}, \"type\": \"Feature\"}, {\"geometry\": {\"coordinates\": [[[-118.254414,\n33.784255], [-118.254232, 33.784255], [-118.254232, 33.784355], [-118.254414,\n33.784355], [-118.254414, 33.784255]]], \"type\": \"Polygon\"}, \"properties\": {}, \"type\":\n\"Feature\"}], \"type\": \"FeatureCollection\"}\n>>> print(len(data[\"features\"]))\n2\n```\n\nIf your GeoJSON document has a different format or you want to iterate over different elements on your document, you can also pass a different value to the `prefix` keyword argument (Default is `'features.item'`). This is an argument passed directly down to a `ijson.items` call, for more information see https://github.com/ICRAR/ijson.\n\n### As a command line tool\n\nAfter installing you should have the geojsplit executable in your `PATH`.\n\n```\n$ geojsplit -h\nusage: geojsplit [-h] [-l GEOMETRY_COUNT] [-a SUFFIX_LENGTH] [-o OUTPUT]\n [-n LIMIT] [-v] [-d] [--version]\n geojson\n\nSplit a geojson file into many geojson files.\n\npositional arguments:\ngeojson filename of geojson file to split\n\noptional arguments:\n-h, --help show this help message and exit\n-l GEOMETRY_COUNT, --geometry-count GEOMETRY_COUNT\n the number of features to be distributed to each file.\n-a SUFFIX_LENGTH, --suffix-length SUFFIX_LENGTH\n number of characters in the suffix length for split\n geojsons\n-o OUTPUT, --output OUTPUT\n output directory to save split geojsons\n-n LIMIT, --limit LIMIT\n limit number of split geojson file to at most LIMIT,\n with GEOMETRY_COUNT number of features.\n-v, --verbose increase output verbosity\n-d, --dry-run see output without actually writing to file\n--version show geojsplit version number\n```\n\nBy default splitted GeoJSON files are saved as `filename_x.geojson`. Default SUFFIX_LENGTH is 4, meaning that 456976 unique files can be generated. If you need more use `-a` or `--suffix-length` to increase this value appropriately.\n\nThe `--geometry-count` flag corresponds to the batch keyword argument for `GeoJSONBatchStreamer.stream` method. Note that if GEOMETRY_COUNT does not divide equally into the number of features in the Feature Collection, the last batch of features will be < GEOMETRY_COUNT.\n\nFinally, to only iterate over the the first n elements of a GeoJSON document, use `--limit`.", "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/underchemist/geojsplit", "keywords": "geospatial,geojson,gis,python,stream", "license": "MIT", "maintainer": "Yann-Sebastien Tremblay-Johnston", "maintainer_email": "yanns.tremblay@gmail.com", "name": "geojsplit", "package_url": "https://pypi.org/project/geojsplit/", "platform": "", "project_url": "https://pypi.org/project/geojsplit/", "project_urls": { "Documentation": "https://geojsplit.readthedocs.io/en/latest/", "Homepage": "https://github.com/underchemist/geojsplit", "Repository": "https://github.com/underchemist/geojsplit" }, "release_url": "https://pypi.org/project/geojsplit/0.1.2/", "requires_dist": [ "geojson (>=2.5,<3.0)", "ijson (>=2.4,<3.0)", "simplejson (>=3.16,<4.0)", "sphinx (>=2.2,<3.0); extra == \"docs\"", "sphinx_rtd_theme (>=0.4.3,<0.5.0); extra == \"docs\"" ], "requires_python": ">=3.6,<4.0", "summary": "A python implementation of the npm package geojsplit. Used to split GeoJSON files into smaller pieces.", "version": "0.1.2" }, "last_serial": 5933799, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "219ebe60bf1357044a649fe9e874299a", "sha256": "c6ef1137edb3248c64c314d78ea82ae5bd8c4e816b7a51fa34549bf4c60e6ede" }, "downloads": -1, "filename": "geojsplit-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "219ebe60bf1357044a649fe9e874299a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 5846, "upload_time": "2019-09-09T06:19:55", "url": "https://files.pythonhosted.org/packages/32/cf/5f4acced91f11d7ebb7bdf26e37e6c5e6294df7424f6b7731f3585eefba0/geojsplit-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b0e0c0e2fd3428e786b193ae3ec727d2", "sha256": "805b0b6a87c58984356b9d4f7c8c552f4f6373dd773deaaa16a0a98584331e5b" }, "downloads": -1, "filename": "geojsplit-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b0e0c0e2fd3428e786b193ae3ec727d2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 5052, "upload_time": "2019-09-09T06:19:57", "url": "https://files.pythonhosted.org/packages/37/ed/dc1a3b12b34052c4f158c7fa570c0664f94d1d553a2df294475373525542/geojsplit-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "17c750accdf8c1405f7b0e5c1440a508", "sha256": "c164f5142caeb38badd0c8d17f71e935dd8061400bec10f628fe8498df8282fd" }, "downloads": -1, "filename": "geojsplit-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "17c750accdf8c1405f7b0e5c1440a508", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 8174, "upload_time": "2019-09-09T07:23:59", "url": "https://files.pythonhosted.org/packages/0c/de/707a73a71ce99e134389a2f17b37801dfe86091dea6703c5f02610c64b90/geojsplit-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3555d32ab07d54a80b9dc2f9bbed8bb8", "sha256": "0d628cdb0f3127e7fa3521673c968921f2e77851deb4286919d2431d0342ce68" }, "downloads": -1, "filename": "geojsplit-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3555d32ab07d54a80b9dc2f9bbed8bb8", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 7966, "upload_time": "2019-09-09T07:24:01", "url": "https://files.pythonhosted.org/packages/c3/83/6f36eda2ec00eff77e0bd135c97f91ba9221a20473843a66b41852b6eba3/geojsplit-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "603f5b56ce6f266791691f7f427c6f16", "sha256": "31097c1f688cae9c12c634fd597e1f0dea3e2e4a8e38c67b017df9a993e95f30" }, "downloads": -1, "filename": "geojsplit-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "603f5b56ce6f266791691f7f427c6f16", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 8195, "upload_time": "2019-10-06T04:17:22", "url": "https://files.pythonhosted.org/packages/e5/66/052c86fa497531bf23725406af69d2b1c4eab633b6281e72c99374a4a629/geojsplit-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "906180b544dda7aa9d08be494240e646", "sha256": "44d5721dbaf6e0045e0546cb6957a61d22991854304c65b5a7fe46dd9012385b" }, "downloads": -1, "filename": "geojsplit-0.1.2.tar.gz", "has_sig": false, "md5_digest": "906180b544dda7aa9d08be494240e646", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 7980, "upload_time": "2019-10-06T04:17:23", "url": "https://files.pythonhosted.org/packages/65/19/a4dbf77e49124d5ae17b3a1f13b7a4b9c3de9f011852b823c2019d3619a4/geojsplit-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "603f5b56ce6f266791691f7f427c6f16", "sha256": "31097c1f688cae9c12c634fd597e1f0dea3e2e4a8e38c67b017df9a993e95f30" }, "downloads": -1, "filename": "geojsplit-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "603f5b56ce6f266791691f7f427c6f16", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 8195, "upload_time": "2019-10-06T04:17:22", "url": "https://files.pythonhosted.org/packages/e5/66/052c86fa497531bf23725406af69d2b1c4eab633b6281e72c99374a4a629/geojsplit-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "906180b544dda7aa9d08be494240e646", "sha256": "44d5721dbaf6e0045e0546cb6957a61d22991854304c65b5a7fe46dd9012385b" }, "downloads": -1, "filename": "geojsplit-0.1.2.tar.gz", "has_sig": false, "md5_digest": "906180b544dda7aa9d08be494240e646", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 7980, "upload_time": "2019-10-06T04:17:23", "url": "https://files.pythonhosted.org/packages/65/19/a4dbf77e49124d5ae17b3a1f13b7a4b9c3de9f011852b823c2019d3619a4/geojsplit-0.1.2.tar.gz" } ] }