A set of utilities for manipulating (Geo)JSON and (Geo)TIFF data.
Project description
Package |
Description |
Status |
---|---|---|
Navigate and subset NHDPlus (MR and HR) using web services |
||
Access topographic data through National Map’s 3DEP web service |
||
Access NWIS, NID, HCDN 2009, NLCD, and SSEBop databases |
||
Access Daymet for daily climate data both single pixel and gridded |
||
Send queries to any ArcGIS RESTful-, WMS-, and WFS-based services |
||
Convert responses from PyGeoOGC’s supported web services to datasets |
PyGeoUtils: Utilities for (Geo)JSON and (Geo)TIFF Conversion
Features
PyGeoUtils is a part of HyRiver software stack that is designed to aid in watershed 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 GroPandas dataframe.
arcgis2geojson: For converting ESRIGeoJSON objects to standard GeoJSON format.
gtiff2xarray: For converting (Geo)TIFF objects to xarray datasets.
All these functions handle all necessary CRS transformations.
You can find some example notebooks here.
Please note that since this project is in early development stages, while the provided functionalities should be stable, changes in APIs are possible in new releases. But we appreciate it if you give this project a try and provide feedback. Contributions are most welcome.
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). Moreover, PyGeoUtils has an optional dependency for using persistent caching, requests-cache. We highly recommend to install this package as it can significantly speedup send/receive queries. You don’t have to change anything in your code, since PyGeoUtils under-the-hood looks for requests-cache and if available, it will automatically use persistent caching:
$ 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 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
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.11.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a7f9a52f6f446c39dd6357174cd96d09ae4119aea715aa9ca28203ad8bdbb83 |
|
MD5 | cb169ea6d99b860472445f7c0cc4dac6 |
|
BLAKE2b-256 | dc5f521761a3ef469cd25f75f238e43a1691af775eac97ef128cea03fc447975 |