Skip to main content

An interface to ArcGIS RESTful-, WFS-, and WMS-based services.

Project description

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

Package

Description

Hydrodata

Access NWIS, HCDN 2009, NLCD, and SSEBop databases

PyGeoOGC

Query data from any ArcGIS RESTful-, WMS-, and WFS-based services

PyGeoUtils

Convert responses from PyGeoOGC’s supported web services to datasets

PyNHD

Access NLDI and WaterData web services for navigating the NHDPlus database

Py3DEP

Access topographic data through the 3D Elevation Program (3DEP) web service

PyDaymet

Access the Daymet database for daily climate data

PyGeoOGC: Query ArcGIS RESTful, WMS, and WFS

PyPi Conda Version CodeCov Github Actions Binder

Security Status 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. It is noted that although, all these web service have limits on the number of objects (e.g., 1000 objectIDs for RESTful) or pixels (e.g., 8 million pixels) per requests, PyGeoOGC takes care of dividing the requests into smaller chunks under-the-hood and then merges them.

There is also an inventory of URLs for some of these web services in form of a class called ServiceURL. These URLs are in three categories: ServiceURL().restful, 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 additional 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

Quick start

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 pynhd 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

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

pygeoogc-0.1.10.tar.gz (33.5 kB view hashes)

Uploaded Source

Built Distribution

pygeoogc-0.1.10-py2.py3-none-any.whl (18.7 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