In [ ]:
#https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288?service=wfs&request=getcapabilities&version=1.0.0

In [1]:
endpoint='https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288'

In [15]:
from owslib.wfs import WebFeatureService
import fiona

In [3]:
wfs = WebFeatureService(endpoint)

In [5]:
wfs.version


Out[5]:
'1.0.0'

In [8]:
print wfs.contents


{'sb:Project_Area': <owslib.feature.wfs100.ContentMetadata instance at 0x3d92368>, 'sb:footprint': <owslib.feature.wfs100.ContentMetadata instance at 0x3d922d8>}

In [13]:
shapefiles = wfs.contents.keys()

In [14]:
feature = wfs.getfeature(typename=shapefiles[0], maxfeatures=1, propertyname=None)
gml = etree.parse(feature)
gml_root=gml.getroot()
name_spaces = gml_root.nsmap


---------------------------------------------------------------------------
ServiceException                          Traceback (most recent call last)
<ipython-input-14-3935d93b4d41> in <module>()
----> 1 feature = wfs.getfeature(typename=shapefiles[0], maxfeatures=1, propertyname=None)
      2 gml = etree.parse(feature)
      3 gml_root=gml.getroot()
      4 name_spaces = gml_root.nsmap

/home/local/python27_epd/lib/python2.7/site-packages/owslib/feature/wfs100.pyc in getfeature(self, typename, filter, bbox, featureid, featureversion, propertyname, maxfeatures, srsname, method)
    210             if tree.tag == "{%s}ServiceExceptionReport" % OGC_NAMESPACE:
    211                 se = tree.find(nspath('ServiceException', OGC_NAMESPACE))
--> 212                 raise ServiceException, str(se.text).strip()
    213 
    214             return StringIO(data)

ServiceException: msWFSGetFeature(): WFS server error. TYPENAME 'P' doesn't exist in this server.  Please check the capabilities and reformulate your request.

In [ ]:
response = wfs.getfeature(typename=['IBA'], maxfeatures=5)

In [9]:
wfs = WebFeatureService('http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?', version='1.0.0')

In [10]:
response = wfs.getfeature(typename=['IBA'], maxfeatures=5)

In [11]:
response.read().find('<wfs:FeatureCollection')


Out[11]:
46

In [19]:
endpoint='https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288'

In [20]:
c = fiona.open(endpoint)


---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-20-1b09193bb5d8> in <module>()
----> 1 c = fiona.open(endpoint)

/home/local/python27_epd/lib/python2.7/site-packages/fiona/__init__.pyc in open(path, mode, driver, schema, crs, encoding, layer, vfs)
    126                 raise IOError("no such archive file: %r" % archive)
    127         elif not os.path.exists(path):
--> 128             raise IOError("no such file or directory: %r" % path)
    129         c = Collection(path, mode, 
    130                 encoding=encoding, layer=layer, vsi=vsi, archive=archive)

IOError: no such file or directory: 'www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288'

In [16]:
c = fiona.open('WFS:'+endpoint, 'r')


---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-16-eb943f2b85ab> in <module>()
----> 1 c = fiona.open('WFS:'+endpoint, 'r')

/home/local/python27_epd/lib/python2.7/site-packages/fiona/__init__.pyc in open(path, mode, driver, schema, crs, encoding, layer, vfs)
    126                 raise IOError("no such archive file: %r" % archive)
    127         elif not os.path.exists(path):
--> 128             raise IOError("no such file or directory: %r" % path)
    129         c = Collection(path, mode, 
    130                 encoding=encoding, layer=layer, vsi=vsi, archive=archive)

IOError: no such file or directory: 'www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288'

In [ ]: