improved esri rest io for geopandas
Project description
restgdf
improved esri rest io for geopandas
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
pip install restgdf
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file restgdf-1.0.0.tar.gz
.
File metadata
- Download URL: restgdf-1.0.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e8f078fb481fe2f0fbe2c9019cdb198c129f63f43f7697f44cdb3875494775d |
|
MD5 | 9025843d0d71c70905263d716be9045f |
|
BLAKE2b-256 | cb525fac588debc7106693267d9d986cb4685b1dd1b82a99e397737b5647c447 |
File details
Details for the file restgdf-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: restgdf-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed8d97aec659c2431d80838144e6a1c7c2fa5a9260c77f269ee3a9ff4d700f8d |
|
MD5 | 77e709e124a7e07461ccb5f8fd838740 |
|
BLAKE2b-256 | 453e115d039f90867d3f23ce4313360039e13aafa0158bf459e1e9db822f4bde |