Ignore:
Timestamp:
11/01/08 17:01:10 (13 years ago)
Author:
mkochan
Message:

Added config per CSML file

File:
1 edited

Legend:

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

    r3198 r3204  
    11import os 
    2 from cElementTree import ElementTree, Element, SubElement, tostring 
     2from cElementTree import ElementTree, Element, SubElement, tostring, dump 
    33 
    44import csml.parser 
    55import kmlfeatures 
    66from csmlwrappers import GridSeriesFeatureWrapper 
     7from configuration import Configuration 
    78 
    89''' Defines a class which performs conversion of a CSML file to a KML file.''' 
     
    1011# [UNSAFE] No exception handling. 
    1112class Convertor: 
    12     def __init__(self, csmlFilename, kmlFilename): 
     13    def __init__(self, csmlFilename, configFilename, kmlFilename): 
    1314        self.csmlFilename = csmlFilename 
    1415        self.kmlFilename = kmlFilename 
    15         self.ds=csml.parser.Dataset()        # empty csml "Dataset" object 
    16         self.ds.parse(self.csmlFilename)     # parse the CSML file into this object 
     16        self.ds=csml.parser.Dataset()                # empty csml "Dataset" object 
     17        self.ds.parse(self.csmlFilename)             # parse the CSML file into this object 
     18        self.config = Configuration(configFilename)  # read in the config file (on per CSML file basis) 
    1719 
    1820    # Auxiliary function, indents XML 
     
    5557 
    5658            # Instantiate a GridSeriesKML object with this information 
    57             gsKML = kmlfeatures.GridSeriesKML(description, name, bBox, timeSteps, timeBounds) 
     59            gsKML = kmlfeatures.GridSeriesKML(self.config, self.csmlFilename, name, description, bBox, timeSteps, timeBounds) 
    5860 
    5961            # Call the outputKML method of this object to generate a populated KML Folder element 
    60             kml_folder = gsKML.outputKML(kmlfeatures.GridSeriesKML.getDecadeSince1900) 
     62            kml_folder = gsKML.outputKML(kmlfeatures.getDecadeSince1900) 
    6163 
    6264            # Append the folder to the kml document. 
Note: See TracChangeset for help on using the changeset viewer.