Changeset 3587 for DPPP


Ignore:
Timestamp:
11/03/08 17:10:42 (11 years ago)
Author:
mkochan
Message:

Made csmlGrapher configurable using the same config file as station2kml.

Location:
DPPP/kml/csml2kml
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • DPPP/kml/csml2kml/python/pylonsstack/development.ini

    r3280 r3587  
    2323beaker.session.secret = somesecret 
    2424xml_dir = %(here)s/xml 
     25csmlGrapher.configfile = /home/users/mkochan/svn-root/kml/csml2kml/testdata/midas.csml2kml.conf.xml 
    2526 
    2627# If you'd like to fine-tune the individual locations of the cache data dirs 
  • DPPP/kml/csml2kml/python/pylonsstack/pylonsstack/controllers/csmlGrapher.py

    r3581 r3587  
    2222 
    2323# [TODO] . Add security (especially checking of input parameters). 
    24 #        . Add configurable URL for the data source web service (preferably explicitly on localhost) 
    2524class CsmlgrapherController(BaseController): 
     25 
     26    def __call__(self, environ, start_response): 
     27        ''' 
     28        Initialise the web service by overriding a method that always get called upon controller construction. 
     29        More specifically, read in the config file. 
     30        ''' 
     31 
     32        # The name of the config file is set in the server's "development.ini" file. 
     33        configFileName = config['app_conf']['csmlGrapher.configfile'] 
     34         
     35        # Load the configuration XML element (but only the part pertaining to the web service) 
     36        grapherConfig = (ElementTree().parse(configFileName)).find('GrapherWebService') 
     37 
     38        # Set the configurable variables 
     39        self.displayIntervalStart = grapherConfig.find('DisplayIntervalStart').text 
     40        self.displayIntervalEnd = grapherConfig.find('DisplayIntervalEnd').text 
     41        self.geoServerUrl = grapherConfig.find('GeoServerURL').text 
     42 
     43        # Call the __call__ method of the parent class  
     44        return BaseController.__call__(self, environ, start_response) 
    2645 
    2746    def _retrieveCsmlPointSeriesFeature(self, station_name, feature_id): 
     
    3150        ''' 
    3251 
    33         # The time boundaries are hard-coded now, i.e. we run the service for demonstration purposes. 
    34         lowerTimeBoundary = '1-JAN-2003' 
    35         upperTimeBoundary = '31-JAN-2003' 
    36  
    3752        # Prepare the request for the GeoServer. 
    38         geoServerRequestUrl = urllib.quote('http://130.246.76.98:8084/geoserver/wfs?request=getfeature&service=wfs&version=1.1.0&typename=csml:PointSeriesFeature&filter=<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><ogc:And><ogc:PropertyIsEqualTo><ogc:PropertyName>gml:description</ogc:PropertyName><ogc:Literal>'+ station_name +'</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>csml:parameter/swe:Phenomenon/gml:name</ogc:PropertyName><ogc:Literal>'+ feature_id +'</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsBetween><ogc:PropertyName>csml:value/csml:PointSeriesCoverage/csml:pointSeriesDomain/csml:TimeSeries/csml:timePositionList</ogc:PropertyName><ogc:LowerBoundary><ogc:Literal>'+ lowerTimeBoundary +'</ogc:Literal></ogc:LowerBoundary><ogc:UpperBoundary><ogc:Literal>'+ upperTimeBoundary +'</ogc:Literal></ogc:UpperBoundary></ogc:PropertyIsBetween></ogc:And></ogc:Filter>', '/._:?&=') 
     53        geoServerRequestUrl = urllib.quote(self.geoServerUrl + '?request=getfeature&service=wfs&version=1.1.0&typename=csml:PointSeriesFeature&filter=<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><ogc:And><ogc:PropertyIsEqualTo><ogc:PropertyName>gml:description</ogc:PropertyName><ogc:Literal>'+ station_name +'</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>csml:parameter/swe:Phenomenon/gml:name</ogc:PropertyName><ogc:Literal>'+ feature_id +'</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsBetween><ogc:PropertyName>csml:value/csml:PointSeriesCoverage/csml:pointSeriesDomain/csml:TimeSeries/csml:timePositionList</ogc:PropertyName><ogc:LowerBoundary><ogc:Literal>'+ self.displayIntervalStart +'</ogc:Literal></ogc:LowerBoundary><ogc:UpperBoundary><ogc:Literal>'+ self.displayIntervalEnd +'</ogc:Literal></ogc:UpperBoundary></ogc:PropertyIsBetween></ogc:And></ogc:Filter>', '/._:?&=') 
    3954 
    4055        # Acquire the GeoServer response and parse it into a CSMLFeatureCollection object 
     
    6479        Retrieves the data from a web service, which should preferably run on the same machine.  
    6580 
    66         Request parameters:    EITHER "feature_id" OR "station_id" 
    67         where: 
    68                                feature_id    Unique identifier of a requested CSML PointSeries feature. 
    69                                station_id    Unique identifier of a requested station. 
    70  
    71         Response:              If feature_id is supplied, an image/png of the time series for the CSML PointSeries feature; 
    72                                if station_id is supplied, nothing. 
     81        Request parameters: 
     82                               feature_id      Unique identifier of the requested CSML PointSeries feature. 
     83                               station_name    Name of the requested station. 
     84                                
     85        Response:              An image/png of the time series for the CSML PointSeries feature. 
    7386        ''' 
    7487        def _plot_feature(feature): 
     
    169182 
    170183    def list(self): 
    171         '''Handler for generating a list of CSML features per station, with dynamic links to the plot service.''' 
     184        ''' 
     185        Handler for generating a list of CSML features per station, with dynamic links to the plot service. 
     186        Request parameters: 
     187                               station_name    Name of the requested station. 
     188                                
     189        Response:              A text/html with the page containing links to the plot service on the same server. 
     190        ''' 
    172191 
    173192        # Get parameters from the request object 
     
    179198        # Prepare the request for the GeoServer -- to return a collection of np:Station, containing a single np:Station, 
    180199        # which contains a list of CSML features. 
    181         geoServerRequestUrl = urllib.quote('http://130.246.76.98:8084/geoserver/wfs?request=getFeature&service=wfs&version=1.1.0&typename=np:Station&filter=<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><ogc:PropertyIsEqualTo><ogc:PropertyName>stationName</ogc:PropertyName><ogc:Literal>' + station_name + '</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>', '/._:?&=') 
     200        geoServerRequestUrl = urllib.quote(self.geoServerUrl + '?request=getFeature&service=wfs&version=1.1.0&typename=np:Station&filter=<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><ogc:PropertyIsEqualTo><ogc:PropertyName>stationName</ogc:PropertyName><ogc:Literal>' + station_name + '</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>', '/._:?&=') 
    182201 
    183202        # Acquire the GeoServer response and parse it into a WFSStationCollection object 
  • DPPP/kml/csml2kml/testdata/midas.csml2kml.conf.xml

    r3582 r3587  
    1111  <OutputKmzFilename>/home/users/mkochan/svn-root/kml/csml2kml/output/exampleps_stations.4.kmz</OutputKmzFilename> 
    1212  </NPStations2KML> 
     13  <GrapherWebService> 
     14     <DisplayIntervalStart>1-JAN-2003</DisplayIntervalStart> 
     15     <DisplayIntervalEnd>31-JAN-2003</DisplayIntervalEnd> 
     16     <GeoServerURL>http://130.246.76.98:8084/geoserver/wfs</GeoServerURL> 
     17  </GrapherWebService> 
    1318</CSML2KMLConfig> 
Note: See TracChangeset for help on using the changeset viewer.