Changeset 3582 for DPPP


Ignore:
Timestamp:
11/03/08 14:45:00 (11 years ago)
Author:
mkochan
Message:

Created the script stations2kml.py runnable from command line.

Location:
DPPP/kml/csml2kml
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • DPPP/kml/csml2kml/python/csml2kml/csml2kml/StationConvertor.py

    r3576 r3582  
    1616    ''' 
    1717     
    18     def __init__(self, config, kmlFilename): 
     18    def __init__(self, config): 
    1919        '''Initialize the convertor and set it up according to the config file.''' 
    2020         
    2121        self.config = config 
    22         self.kmlFilename = kmlFilename 
    2322 
    24         # Read config document name 
    25         self.documentName = self.config.find('name').text 
     23        # Read the KMZ file name 
     24        self.kmlFilename = self.config.find('OutputKmzFilename').text 
     25 
     26        # Read the document name 
     27        self.documentName = self.config.find('DocumentName').text 
    2628 
    2729        # URL of GeoServer to get a <wfs:StationCollection> from 
    28         self.geoServerUrl = self.config.find('GeoServerRequest/URL').text 
     30        self.geoServerRequestUrl = self.config.find('GetAllStationsRequestURL').text 
    2931 
    3032        # Get template for placemark balloons; create a KML style for placemarks 
    31         self.balloonTemplate = self.config.find('GeoServerRequest/BalloonTemplate').text 
     33        self.balloonTemplate = self.config.find('BalloonTemplate').text 
    3234        self.placemarkKmlStyle = createDefaultPlacemarKMLStyle(balloonTemplate = self.balloonTemplate) 
    3335 
    3436        # Initialize placemark data -- i.e. values to be substituted for placeholders in the balloon template 
    3537        self.stationData = {} 
    36         data = self.config.findall('GeoServerRequest/StationData/Datum') 
     38        data = self.config.findall('StationData/Datum') 
    3739        for datum in data: 
    3840            datumName = datum.get('name') 
     
    118120 
    119121        # Get a collection of stations from a GeoServer, and put the stations into a list 
    120         geoServerResponse = wget(self.geoServerUrl) 
     122        geoServerResponse = wget(self.geoServerRequestUrl) 
    121123        wfsStationsCollection = WFSStationCollection() 
    122124        wfsStationsCollection.parseString(geoServerResponse) 
  • DPPP/kml/csml2kml/testdata/midas.csml2kml.conf.xml

    r3576 r3582  
    11<CSML2KMLConfig> 
    22  <NPStations2KML> 
    3     <name>MIDAS stations (first 100 of them)</name> 
     3    <DocumentName>MIDAS stations (first 100 of them)</DocumentName> 
    44    <UseRegions>yes</UseRegions> 
    5     <GeoServerRequest> 
    6       <URL><![CDATA[http://130.246.76.98:8084/geoserver/wfs?request=getFeature&service=wfs&version=1.1.0&typename=np:Station&maxFeatures=100]]></URL> 
    7       <BalloonTemplate>&lt;h2&gt;Station $[station_name]&lt;/h2&gt;Click here to see the list of &lt;a href=&quot;http://bond.badc.rl.ac.uk:8089/csmlGrapher/list?station_name=$[station_name]&quot;&gt;CSML features associated with this station&lt;/a&gt; (this will open a window of your default web browser).</BalloonTemplate> 
    8       <StationData> 
    9         <Datum name="station_id">#ID#</Datum> 
    10         <Datum name="station_name">#NAME#</Datum> 
    11       </StationData> 
    12     </GeoServerRequest> 
     5    <GetAllStationsRequestURL><![CDATA[http://130.246.76.98:8084/geoserver/wfs?request=getFeature&service=wfs&version=1.1.0&typename=np:Station&maxFeatures=100]]></GetAllStationsRequestURL> 
     6    <BalloonTemplate>&lt;h2&gt;Station $[station_name]&lt;/h2&gt;Click here to see the list of &lt;a href=&quot;http://bond.badc.rl.ac.uk:8089/csmlGrapher/list?station_name=$[station_name]&quot;&gt;CSML features associated with this station&lt;/a&gt; (this will open a window of your default web browser).</BalloonTemplate> 
     7    <StationData> 
     8      <Datum name="station_id">#ID#</Datum> 
     9      <Datum name="station_name">#NAME#</Datum> 
     10    </StationData> 
     11  <OutputKmzFilename>/home/users/mkochan/svn-root/kml/csml2kml/output/exampleps_stations.4.kmz</OutputKmzFilename> 
    1312  </NPStations2KML> 
    1413</CSML2KMLConfig> 
Note: See TracChangeset for help on using the changeset viewer.