source: DPPP/kml/csml2kml/python/csml2kml/csml2kml/tests/testStation.py @ 3581

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/DPPP/kml/csml2kml/python/csml2kml/csml2kml/tests/testStation.py@3581
Revision 3581, 1.1 KB checked in by mkochan, 13 years ago (diff)

Added tabular formatting to the csmlGrapher lister. Added testing of existence of CSML features per station -- this is neccessary at the moment, due to a "feature" in GeoServer?.

Line 
1'''A test for classes contained in the Station.py module.'''
2
3from Station import NPStation, WFSStationCollection
4from utils import wget
5
6# Get XML response from a GeoServer via HTTP
7geoServerUrl = 'http://130.246.76.98:8084/geoserver/wfs?request=getfeature&service=wfs&version=1.1.0&typename=np:Station&filter=%3Cogc:Filter%20xmlns:ogc=%22http://ogc.org%22%20xmlns:gml=%22http://www.opengis.net/gml%22%3E%3Cogc:BBOX%3E%3Cogc:PropertyName%3Enp:location%3C/ogc:PropertyName%3E%3Cgml:Box%20srsName=%22http://www.opengis.net/gml/srs/epsg.xml%22%3E%3Cgml:coordinates%3E-75,40%20-68,45%3C/gml:coordinates%3E%3C/gml:Box%3E%3C/ogc:BBOX%3E%3C/ogc:Filter%3E'
8geoServerResponse = wget(geoServerUrl)
9
10# Create a WFSStationCollection object, which is a representation of a <wfs:StationCollection> XML element.
11wfsStationsCollection = WFSStationCollection()
12wfsStationsCollection.parseString(geoServerResponse)
13
14# Extract the stations from the collection
15npStations = wfsStationsCollection.stations
16
17# Each station is a NPStation object, which is a representation of a <np:Station> XML element.
18print str(len(npStations)) + ' stations.'
19for npStation in npStations:
20    print npStation
Note: See TracBrowser for help on using the repository browser.