A set of utilities for manipulating (Geo)JSON and GeoTIFF data.
Project description
🚨 This package is under heavy development and breaking changes are likely to happen. 🚨
Features
Hydrodata is a stack of Python libraries designed to aid in watershed analysis through web services. Currently, it only includes hydrology and climatology data within the US. Hydrodata software stack is shown in the table below.
Package |
Description |
---|---|
Access NWIS, HCDN 2009, NLCD, and SSEBop databases |
|
Query data from any ArcGIS RESTful-, WMS-, and WFS-based services |
|
Convert responses from PyGeoOGC’s supported web services to datasets |
|
Access NLDI and WaterData web services for navigating the NHDPlus database |
|
Access topographic data through the 3D Elevation Program (3DEP) web service |
|
Access the Daymet database for daily climate data |
PyGeoUtils provides utilities for manipulating (Geo)JSON and GeoTIFF data:
json2geodf: For converting (Geo)JSON objects to GroPandas dataframe.
arcgis2geojson: For converting ESRIGeoJSON objects to standard GeoJSON format.
gtiff2xarray: For converting (Geo)TIFF objects to xarray datasets.
xarray_geomask: For masking a xarray.Dataset or xarray.DataArray using a polygon.
All these function handle all necessary CRS transformations. Moreover, requests for additional functionalities can be submitted via issue tracker.
Installation
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
Quickstart
To demonstrate capabilities of PyGeoUtils lets use PyGeoOGC to access National Wetlands Inventory from WMS, and FEMA National Flood Hazard via WFS, then convert the outpus to GeoDataFrame and xarray.Dataset using PyGeoUtils.
import pygeoutils as geoutils
from pygeoogc import WFS, WMS
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],
]
)
url_wms = "https://www.fws.gov/wetlands/arcgis/services/Wetlands_Raster/ImageServer/WMSServer"
wms = WMS(
url_wms,
layers="0",
outformat="image/tiff",
crs="epsg:3857",
)
r_dict = wms.getmap_bybox(
geometry.bounds,
1e3,
box_crs="epsg:4326",
)
wetlands = geoutils.gtiff2xarray(r_dict, geometry, "epsg:4326")
url_wfs = "https://hazards.fema.gov/gis/nfhl/services/public/NFHL/MapServer/WFSServer"
wfs = WFS(
url_wfs,
layer="public_NFHL:Base_Flood_Elevations",
outformat="esrigeojson",
crs="epsg:4269",
)
r = wfs.getfeature_bybox(geometry.bounds, box_crs="epsg:4326")
flood = geoutils.json2geodf(r.json(), "epsg:4269", "epsg:4326")
Contributing
Contributions are very welcomed. Please read CONTRIBUTING.rst file for instructions.
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
Hashes for pygeoutils-0.1.8-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 118e5252bd55439f9576b81ac22da8d9de3ecab7473219bc05e561fc8b8e4d80 |
|
MD5 | 46171da213c0804e0e12c97e5fe9438b |
|
BLAKE2b-256 | bfda38c5f98a5dff934a4d803e3c3e2d06e4da285b8fc8a201444d60869ea4bc |