A lightweight Python package for extracting data from Esri REST API endpoints.
Project description
ezesri
A lightweight Python package for extracting data from Esri REST API endpoints.
Features
- Multiple export formats: Export to GeoJSON, Shapefile, CSV, and GeoDataFrame.
- Robust extraction: Automatically handles Esri's pagination.
- Filtering: Filter data by bounding box or attribute query.
- Bulk exports: Download all layers from a MapServer or FeatureServer.
- Simple CLI: An easy-to-use command-line interface for all features.
Installation
pip install ezesri
Usage
Python library
You can use ezesri as a library to integrate with your Python scripts.
import ezesri
# URL for a public Esri feature layer
url = "your_esri_layer_url_here"
# Get layer metadata
metadata = ezesri.get_metadata(url)
print(metadata)
# Extract layer to a GeoDataFrame
gdf = ezesri.extract_layer(url)
print(gdf.head())
Command-line interface
ezesri also provides a command-line tool for quick data extraction.
Fetch metadata
ezesri metadata <YOUR_ESRI_LAYER_URL>
Fetch layer data
You can fetch a layer and save it to a file in various formats.
-
GeoJSON
ezesri fetch <YOUR_ESRI_LAYER_URL> --format geojson --out output.geojson
-
Shapefile
ezesri fetch <YOUR_ESRI_LAYER_URL> --format shapefile --out output.shp
-
CSV (geometry is dropped)
ezesri fetch <YOUR_ESRI_LAYER_URL> --format csv --out output.csv
You can also filter by a bounding box (in WGS84 coordinates):
ezesri fetch <URL> --bbox <xmin,ymin,xmax,ymax> --format geojson --out <FILE>
Bulk-fetch all layers from a service
You can discover and export all layers from a MapServer or FeatureServer to a specified directory.
ezesri bulk-fetch <YOUR_ESRI_SERVICE_URL> <YOUR_OUTPUT_DIRECTORY>
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue to discuss your ideas.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ezesri-0.2.2.tar.gz.
File metadata
- Download URL: ezesri-0.2.2.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64cd1b5e7334aa047076da1bbfc20b98e0b30bd0ce70fcd63f89c01c112c15e4
|
|
| MD5 |
c1236e938dfc330dcb871ee83871731f
|
|
| BLAKE2b-256 |
7cf655a375bf73bd0c69405cfe8f05ec4425613525bf295c64ee7a3a90b066a4
|
File details
Details for the file ezesri-0.2.2-py3-none-any.whl.
File metadata
- Download URL: ezesri-0.2.2-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd1be6a7076a316acae09d8428bb5d3c663feccd596270a9297397c3c867966b
|
|
| MD5 |
f62d95e102e264a4e74988c869eb4b1d
|
|
| BLAKE2b-256 |
794b326f884e06f852368908e230371e5da2fe93ab7a67ec99b8a6ac1654f8b9
|