NCPP / ocgis

OpenClimateGIS is a set of geoprocessing and calculation tools for CF-compliant climate datasets.
Other
70 stars 19 forks source link

Add WFS interface for geometry access #465

Open bekozi opened 6 years ago

bekozi commented 6 years ago

Working with geometries retrieved from a WFS (web feature service) requires formatting a URL and creating a geometry dictionary. This could be streamlined by supporting WFS URLs similar to how shapefile/geodatabase access is handled in ocgis.

Some example code and recommendations from @huard:

conn = WebFeatureService(url=geoserver, version='2.0.0')
resp = conn.getfeature([typename], featureid=features,outputFormat='application/json')
feature = json.loads(resp.read())
crs_code = owslib.crs.Crs(feature['crs']['properties']['name']).code
crs = ocgis.CoordinateReferenceSystem(epsg=crs_code)
geom = [
{'geom': shape(f['geometry']), 'crs': crs,
'properties': f['properties']}
for f in feature['features']]

Parameters to include at the very least: server, typename, featureid