Skip to main content

A set of utilities for manipulating (Geo)JSON and GeoTIFF data.

Project description

https://raw.githubusercontent.com/cheginit/hydrodata/develop/docs/_static/pygeoogc_logo.png

PyPi Conda Version CodeCov Github Actions Binder

CodeFactor black pre-commit

🚨 This package is under heavy development and breaking changes are likely to happen. 🚨

Features

PyGeoOGC is a part of Hydrodata software stack and provides interfaces to web services that are based on ArcGIS RESTful, WMS, and WFS. There is also an invetory of URLs for some of these web services in form of a class called ServiceURL. These URLs are in three categories: ServiceURL().resful, ServiceURL().wms, and ServiceURL().wfs.

You can try using PyGeoOGC without installing it on you system by clicking on the binder badge below the PyGeoOGC banner. A Jupyter notebook instance with the Hydrodata software stack pre-installed will be launched in your web browser and you can start coding!

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

Installation

You can install PyGeoOGC using pip:

$ pip install pygeoogc

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

$ conda install -c conda-forge pygeoogc

Quickstart

We can access Watershed Boundary Dataset via RESTful service, National Wetlands Inventory from WMS, and FEMA National Flood Hazard via WFS. The output for these functions are of type requests.Response that can be converted to GeoDataFrame or xarray.Dataset using Hydrodata.

from pygeoogc import ArcGISRESTful, WFS, WMS, ServiceURL
import pygeoutils as geoutils
from hydrodata import NLDI

basin_geom = NLDI().getfeature_byid(
    "nwissite",
    "USGS-11092450",
    basin=True
).geometry[0]

wbd12 = ArcGISRESTful(f"{ServiceURL().restful.wbd}/6")
wbd12.get_featureids(basin_geom)
resp = wbd12.get_features()
huc12 = geoutils.json2geodf(resp)

wms = WMS(
    ServiceURL().wms.fws,
    layers="0",
    outformat="image/tiff",
    crs="epsg:3857",
)
r_dict = wms.getmap_bybox(
    basin_geom.bounds,
    1e3,
    box_crs="epsg:4326",
)
wetlands = geoutils.gtiff2xarray(r_dict, basin_geom, "epsg:4326")

wfs = WFS(
    ServiceURL().wfs.fema,
    layer="public_NFHL:Base_Flood_Elevations",
    outformat="esrigeojson",
    crs="epsg:4269",
)
r = wfs.getfeature_bybox(basin_geom.bounds, 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 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

pygeoogc-0.1.4.tar.gz (29.1 kB view hashes)

Uploaded Source

Built Distribution

pygeoogc-0.1.4-py2.py3-none-any.whl (16.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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