Skip to content

Commit

Permalink
improve WebFeatureService docstrings, change name of the committers file
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillies committed Oct 18, 2006
1 parent 13a52df commit 16a0381
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
File renamed without changes.
44 changes: 29 additions & 15 deletions owslib/wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import cgi
from cStringIO import StringIO
import sys
from urllib import urlencode
from urllib2 import urlopen

Expand Down Expand Up @@ -50,10 +49,6 @@ def nspath(path, ns=WFS_NAMESPACE):
components.append(component)
return "/".join(components)

#return "/".join(['{%s}%s' % (ns, component)
# for component
# in path.split("/")])


class ServiceException(Exception):
pass
Expand Down Expand Up @@ -82,14 +77,41 @@ def _getcapproperty(self):
capabilities = property(_getcapproperty, None)

def getcapabilities(self):
"""Request and return capabilities document from the WFS."""
"""Request and return capabilities document from the WFS as a
file-like object."""
reader = WFSCapabilitiesReader(self.version)
return urlopen(reader.capabilities_url(self.url))

def getfeature(self, typename=None, filter=None, bbox=None, featureid=None,
featureversion=None, propertyname=['*'], maxfeatures=None,
method='{http://www.opengis.net/wfs}Get'):
"""Request and return feature data."""
"""Request and return feature data as a file-like object.
Parameters
----------
typename : list
List of typenames (string)
filter : string
XML-encoded OGC filter expression.
bbox : tuple
(left, bottom, right, top) in the feature type's coordinates.
featureid : list
List of unique feature ids (string)
featureversion : string
Default is most recent feature version.
propertyname : list
List of feature property names. '*' matches all.
maxfeatures : int
Maximum number of features to be returned.
method : string
Qualified name of the HTTP DCP method to use.
There are 3 different modes of use
1) typename and bbox (simple spatial query)
2) typename and filter (more expressive)
3) featureid (direct access to known features)
"""
md = self.capabilities
base_url = md.getOperationByName('{http://www.opengis.net/wfs}GetFeature').methods[method]['url']
request = {'service': 'WFS', 'version': self.version, 'request': 'GetFeature'}
Expand Down Expand Up @@ -138,7 +160,6 @@ class ServiceMetadata(object):
def __init__(self, infoset):
"""Initialize from an element tree."""
self._root = infoset.getRoot()
#print >> sys.stderr, self._root
# properties
self.service = self._root.find(nspath('Service/Name')).text
self.title = self._root.find(nspath('Service/Title')).text
Expand Down Expand Up @@ -169,13 +190,6 @@ def getOperationByName(self, name):
return item
raise KeyError, "No operation named %s" % name

#def toXML(self):
# """x
# """
# top = etree.Element('a')
# top.text = self.getName()
# return etree.tostring(top)


class ContentMetadata:
"""Abstraction for WMS metadata.
Expand Down

0 comments on commit 16a0381

Please sign in to comment.