A set of utilities for manipulating (Geo)JSON and GeoTIFF data.
Project description
Features
PyGeoUtils is a part of Hydrodata software stack and 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.
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.
from pygeoogc import WFS, wms_bybox, MatchCRS
from shapely.geometry import Polygon
import pygeoutils as geoutils
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"
layer = "0"
r_dict = wms_bybox(
url_wms,
layer,
geometry.bounds,
1e3,
"image/tiff",
box_crs="epsg:4326",
crs="epsg:3857",
)
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",
)
bbox = geometry.bounds
bbox = (bbox[1], bbox[0], bbox[3], bbox[2])
r = wfs.getfeature_bybox(bbox, box_crs="epsg:4326")
flood = geoutils.json2geodf(r.json(), "epsg:4269", "epsg:4326")
Contributing
Contirbutions are very welcomed. Please read CODE_OF_CONDUCT.rst and CONTRIBUTING.rst files 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.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e606e7e319c8c25bada46b8b6f5755473fec4fb53d6cba6887fe793d4742a4a9 |
|
MD5 | e60fc3eac2593353b9a2c91d8dbed5ec |
|
BLAKE2b-256 | 1269acb368438bca5ed97352771142041a4aed2f34be849a87e05d142105b346 |