Skip to main content

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.

PyPI version License: MIT

Features

  • Fast downloads: Asynchronously fetches data for maximum speed.
  • 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

ezesri-0.2.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezesri-0.2.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file ezesri-0.2.0.tar.gz.

File metadata

  • Download URL: ezesri-0.2.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ezesri-0.2.0.tar.gz
Algorithm Hash digest
SHA256 266dc1c2769e7bd88af14fd43c4cd93b07b97aa28626088ebce4a347dc39a25a
MD5 604c30a631f0e54ecc0d1cc2bfeb3cbf
BLAKE2b-256 41a74de525417fa36a571346ec2c6357ad2e25432c56712b348e8ca5fa1359de

See more details on using hashes here.

File details

Details for the file ezesri-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ezesri-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ezesri-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8321576799b38f843ed1939b61c1a2b1bfa84bc7254de3516e06916da79eae03
MD5 d8e5a03c8ce8fcf871ff3a69cb913b5c
BLAKE2b-256 f61687fa369aee98a74df56b5c64e7713893fa7688d4e3b410ff6f29f84dd6b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page