restgdf


Namerestgdf JSON
Version 1.0.0 PyPI version JSON
download
home_page
Summaryimproved esri rest io for geopandas
upload_time2023-12-15 20:33:02
maintainer
docs_urlNone
authorJoshua Sundance Bailey
requires_python>=3.9
licenseMIT License Copyright (c) 2023 Joshua Sundance Bailey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords geopandas esri arcgis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # restgdf

improved esri rest io for geopandas


[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/bsd-3-clause/)
[![python](https://img.shields.io/badge/Python-3.9+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)

[![Publish to PyPI](https://github.com/joshuasundance-swca/restgdf/actions/workflows/publish_on_pypi.yml/badge.svg)](https://github.com/joshuasundance-swca/restgdf/actions/workflows/publish_on_pypi.yml)
![GitHub tag (with filter)](https://img.shields.io/github/v/tag/joshuasundance-swca/restgdf)
[![Read the Docs](https://img.shields.io/readthedocs/restgdf)](https://restgdf.readthedocs.io/en/latest/)

![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/joshuasundance-swca/restgdf)
![Code Climate issues](https://img.shields.io/codeclimate/issues/joshuasundance-swca/restgdf)
![Code Climate technical debt](https://img.shields.io/codeclimate/tech-debt/joshuasundance-swca/restgdf)
[![coverage](coverage.svg)](./COVERAGE.md)

[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
![Known Vulnerabilities](https://snyk.io/test/github/joshuasundance-swca/restgdf/badge.svg)

`gpd.read_file(url, driver="ESRIJSON")` does not account for max record count limitations

so if you read a service with 100000 features but there's a limit of 1000 records per query, then your gdf will only have 1000 features

these functions use asyncio to read all features from a service, not limited by max record count

keyword arguments to `FeatureLayer.getgdf` are passed on to `requests.Session.post`; include query parameters like where str and token str in data dict

this enables enhanced control over queries and allow use of any valid authentication scheme (eg `requests_ntlm.HttpNtlmAuth`) with use of `requests.Session.auth` or `data={"token": str}`

# Usage

```bash
pip install restgdf
```

```python
import asyncio

from aiohttp import ClientSession

from restgdf import FeatureLayer


beaches_url = r"https://maps1.vcgov.org/arcgis/rest/services/Beaches/MapServer/6"

zipcodes_url = "https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_ZIP_Codes_2016/FeatureServer/0"

async def main():
    async with ClientSession() as session:
        beaches = await FeatureLayer.from_url(beaches_url, session=session)
        beaches_gdf = await beaches.getgdf()

        daytona = await beaches.where("LOWER(City) LIKE 'daytona%'")
        daytona_gdf = await daytona.getgdf()

        oh_zipcodes = await FeatureLayer.from_url(zipcodes_url, where="STATE = 'OH'", session=session)
        oh_zipcodes_gdf = await oh_zipcodes.getgdf()

    return beaches_gdf, daytona_gdf, oh_zipcodes_gdf


beaches_gdf, daytona_gdf, oh_zipcodes_gdf = asyncio.run(main())

print(beaches_gdf.shape)
# (243, 10)

print(daytona_gdf.shape)
# (83, 10)

print(oh_zipcodes_gdf.shape)
# (1026, 8)
```

# Documentation

https://restgdf.readthedocs.io/

# Uses

- [restgdf_api](https://github.com/joshuasundance-swca/restgdf_api)
- [govgis_nov2023](https://huggingface.co/datasets/joshuasundance/govgis_nov2023)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "restgdf",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "geopandas,esri,arcgis",
    "author": "Joshua Sundance Bailey",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/cb/52/5fac588debc7106693267d9d986cb4685b1dd1b82a99e397737b5647c447/restgdf-1.0.0.tar.gz",
    "platform": null,
    "description": "# restgdf\n\nimproved esri rest io for geopandas\n\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/bsd-3-clause/)\n[![python](https://img.shields.io/badge/Python-3.9+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)\n\n[![Publish to PyPI](https://github.com/joshuasundance-swca/restgdf/actions/workflows/publish_on_pypi.yml/badge.svg)](https://github.com/joshuasundance-swca/restgdf/actions/workflows/publish_on_pypi.yml)\n![GitHub tag (with filter)](https://img.shields.io/github/v/tag/joshuasundance-swca/restgdf)\n[![Read the Docs](https://img.shields.io/readthedocs/restgdf)](https://restgdf.readthedocs.io/en/latest/)\n\n![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/joshuasundance-swca/restgdf)\n![Code Climate issues](https://img.shields.io/codeclimate/issues/joshuasundance-swca/restgdf)\n![Code Climate technical debt](https://img.shields.io/codeclimate/tech-debt/joshuasundance-swca/restgdf)\n[![coverage](coverage.svg)](./COVERAGE.md)\n\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)\n![Known Vulnerabilities](https://snyk.io/test/github/joshuasundance-swca/restgdf/badge.svg)\n\n`gpd.read_file(url, driver=\"ESRIJSON\")` does not account for max record count limitations\n\nso if you read a service with 100000 features but there's a limit of 1000 records per query, then your gdf will only have 1000 features\n\nthese functions use asyncio to read all features from a service, not limited by max record count\n\nkeyword arguments to `FeatureLayer.getgdf` are passed on to `requests.Session.post`; include query parameters like where str and token str in data dict\n\nthis enables enhanced control over queries and allow use of any valid authentication scheme (eg `requests_ntlm.HttpNtlmAuth`) with use of `requests.Session.auth` or `data={\"token\": str}`\n\n# Usage\n\n```bash\npip install restgdf\n```\n\n```python\nimport asyncio\n\nfrom aiohttp import ClientSession\n\nfrom restgdf import FeatureLayer\n\n\nbeaches_url = r\"https://maps1.vcgov.org/arcgis/rest/services/Beaches/MapServer/6\"\n\nzipcodes_url = \"https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_ZIP_Codes_2016/FeatureServer/0\"\n\nasync def main():\n    async with ClientSession() as session:\n        beaches = await FeatureLayer.from_url(beaches_url, session=session)\n        beaches_gdf = await beaches.getgdf()\n\n        daytona = await beaches.where(\"LOWER(City) LIKE 'daytona%'\")\n        daytona_gdf = await daytona.getgdf()\n\n        oh_zipcodes = await FeatureLayer.from_url(zipcodes_url, where=\"STATE = 'OH'\", session=session)\n        oh_zipcodes_gdf = await oh_zipcodes.getgdf()\n\n    return beaches_gdf, daytona_gdf, oh_zipcodes_gdf\n\n\nbeaches_gdf, daytona_gdf, oh_zipcodes_gdf = asyncio.run(main())\n\nprint(beaches_gdf.shape)\n# (243, 10)\n\nprint(daytona_gdf.shape)\n# (83, 10)\n\nprint(oh_zipcodes_gdf.shape)\n# (1026, 8)\n```\n\n# Documentation\n\nhttps://restgdf.readthedocs.io/\n\n# Uses\n\n- [restgdf_api](https://github.com/joshuasundance-swca/restgdf_api)\n- [govgis_nov2023](https://huggingface.co/datasets/joshuasundance/govgis_nov2023)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Joshua Sundance Bailey  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "improved esri rest io for geopandas",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/joshuasundance-swca/restgdf"
    },
    "split_keywords": [
        "geopandas",
        "esri",
        "arcgis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "453e115d039f90867d3f23ce4313360039e13aafa0158bf459e1e9db822f4bde",
                "md5": "77e709e124a7e07461ccb5f8fd838740",
                "sha256": "ed8d97aec659c2431d80838144e6a1c7c2fa5a9260c77f269ee3a9ff4d700f8d"
            },
            "downloads": -1,
            "filename": "restgdf-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "77e709e124a7e07461ccb5f8fd838740",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 12598,
            "upload_time": "2023-12-15T20:33:00",
            "upload_time_iso_8601": "2023-12-15T20:33:00.656697Z",
            "url": "https://files.pythonhosted.org/packages/45/3e/115d039f90867d3f23ce4313360039e13aafa0158bf459e1e9db822f4bde/restgdf-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb525fac588debc7106693267d9d986cb4685b1dd1b82a99e397737b5647c447",
                "md5": "9025843d0d71c70905263d716be9045f",
                "sha256": "5e8f078fb481fe2f0fbe2c9019cdb198c129f63f43f7697f44cdb3875494775d"
            },
            "downloads": -1,
            "filename": "restgdf-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9025843d0d71c70905263d716be9045f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 13808,
            "upload_time": "2023-12-15T20:33:02",
            "upload_time_iso_8601": "2023-12-15T20:33:02.440718Z",
            "url": "https://files.pythonhosted.org/packages/cb/52/5fac588debc7106693267d9d986cb4685b1dd1b82a99e397737b5647c447/restgdf-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-15 20:33:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "joshuasundance-swca",
    "github_project": "restgdf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "restgdf"
}
        
Elapsed time: 2.13876s