An interface to web services based on ArcGIS RESTful, WFS, and WMS.
Project description
Features
PyGeoOGC is a part of Hydrodata software stack and provides interfaces to web services that are based on ArcGIS RESTful, WMS, and 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 Hydrodata 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
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 ArcGISREST, WFS, wms_bybox, MatchCRS
from hydrodata import NLDI, utils
basin_geom = NLDI().getfeature_byid(
"nwissite",
"USGS-11092450",
basin=True
).geometry[0]
rest_url = "https://hydro.nationalmap.gov/arcgis/rest/services/wbd/MapServer/4"
wbd8 = ArcGISRESTful(rest_url)
wbd8.get_featureids(basin_geom)
resp = wbd8.get_features()
huc8 = utils.json_togeodf(resp[0])
huc8 = huc8.append([utils.json_togeodf(r) for r in resp[1:]])
url_wms = "https://www.fws.gov/wetlands/arcgis/services/Wetlands_Raster/ImageServer/WMSServer"
layer = "0"
r_dict = wms_bybox(
url_wms,
layer,
basin_geom.bounds,
1e3,
"image/tiff",
box_crs="epsg:4326",
crs="epsg:3857",
)
geom = MatchCRS.geometry(basin_geom, "epsg:4326", "epsg:3857")
wetlands = utils.wms_toxarray(r_dict, geom, "epsg:3857")
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(basin_geom.bounds, box_crs="epsg:4326")
flood = utils.json_togeodf(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
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 pygeoogc-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f063b17ca4881ad1e87332abbede712cfaa786f90d61bcf3c9b24073bccb1b3 |
|
MD5 | 28bb5ec1865ba404fa35c3f43d21192f |
|
BLAKE2b-256 | 5bbfcf1d330c04b79bb93775a07f9d9e7cb595a3be455f73fb45c875167becca |