Skip to main content

Utilities for manipulating geospatial, (Geo)JSON, and (Geo)TIFF data.

Project description






Navigate and subset NHDPlus (MR and HR) using web services

Github Actions


Access topographic data through National Map’s 3DEP web service

Github Actions


Access NWIS, NID, WQP, HCDN 2009, NLCD, CAMELS, and SSEBop databases

Github Actions


Access daily, monthly, and annual climate data via Daymet

Github Actions


High-level API for asynchronous requests with persistent caching

Github Actions


Send queries to any ArcGIS RESTful-, WMS-, and WFS-based services

Github Actions


Utilities for manipulating geospatial, (Geo)JSON, and (Geo)TIFF data

Github Actions

PyGeoUtils: Utilities for (Geo)JSON and (Geo)TIFF Conversion

PyPi Conda Version CodeCov Python Versions Downloads

CodeFactor black pre-commit Binder


PyGeoUtils is a part of HyRiver software stack that is designed to aid in hydroclimate analysis through web services. This package provides utilities for manipulating (Geo)JSON and (Geo)TIFF responses from web services. These utilities are:

  • json2geodf: For converting (Geo)JSON objects to GeoPandas dataframe.

  • arcgis2geojson: For converting ESRIGeoJSON to the standard GeoJSON format.

  • gtiff2xarray: For converting (Geo)TIFF objects to xarray datasets.

  • xarray2geodf: For converting xarray.DataArray to a geopandas.GeoDataFrame, i.e., vectorization.

  • xarray_geomask: For masking a xarray.Dataset or xarray.DataArray using a polygon.

All these functions handle all necessary CRS transformations.

You can find some example notebooks here.

You can also try using PyGeoUtils without installing it on your system by clicking on the binder badge. A Jupyter Lab instance with the HyRiver stack pre-installed will be launched in your web browser, and you can start coding!

Moreover, requests for additional functionalities can be submitted via issue tracker.


If you use any of HyRiver packages in your research, we appreciate citations:

    author = <s>{Chegini, Taher and Li, Hong-Yi and Leung, L. Ruby}</s>,
    doi = <s>{10.21105/joss.03175}</s>,
    journal = <s>{Journal of Open Source Software}</s>,
    month = <s>{10}</s>,
    number = <s>{66}</s>,
    pages = <s>{1--3}</s>,
    title = <s>{{HyRiver: Hydroclimate Data Retriever}}</s>,
    volume = <s>{6}</s>,
    year = <s>{2021}</s>


You can install PyGeoUtils using pip after installing libgdal on your system (for example, in Ubuntu run sudo apt install libgdal-dev).

$ pip install pygeoutils

Alternatively, PyGeoUtils can be installed from the conda-forge repository using Conda:

$ conda install -c conda-forge pygeoutils

Quick start

To demonstrate the capabilities of PyGeoUtils let’s use PyGeoOGC to access National Wetlands Inventory from WMS, and FEMA National Flood Hazard via WFS, then convert the output to xarray.Dataset and GeoDataFrame, respectively.

import pygeoutils as geoutils
from pygeoogc import WFS, WMS, ServiceURL
from shapely.geometry import Polygon

geometry = Polygon(
        [-118.72, 34.118],
        [-118.31, 34.118],
        [-118.31, 34.518],
        [-118.72, 34.518],
        [-118.72, 34.118],
crs = "epsg:4326"

wms = WMS(
r_dict = wms.getmap_bybox(
canopy = geoutils.gtiff2xarray(r_dict, geometry, crs)

mask = canopy > 60
canopy_gdf = geoutils.xarray2geodf(canopy, "float32", mask)

url_wfs = ""
wfs = WFS(
r = wfs.getfeature_bybox(geometry.bounds, box_crs=crs)
flood = geoutils.json2geodf(r.json(), "epsg:4269", crs)


Contributions are very welcomed. Please read CONTRIBUTING.rst file for instructions.

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

pygeoutils-0.13.6.tar.gz (40.3 kB view hashes)

Uploaded source

Built Distribution

pygeoutils-0.13.6-py3-none-any.whl (20.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page