Changeset 3308 for DPPP


Ignore:
Timestamp:
04/02/08 23:57:40 (12 years ago)
Author:
mkochan
Message:

Removed dependency on configuration.py from the GridSeriesConvertor? module, in order to make it more like the PointSeriesConvertor? module.

Location:
DPPP/kml/csml2kml/python/csml2kml
Files:
1 deleted
2 edited

Legend:

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

    r3307 r3308  
    1313 
    1414    def __init__(self, csmlFilename, configFilename, kmlFilename): 
     15 
    1516        self.csmlFilename = csmlFilename 
    1617        self.kmlFilename = kmlFilename 
    1718        self.ds=csml.parser.Dataset()                # empty csml "Dataset" object 
    1819        self.ds.parse(self.csmlFilename)             # parse the CSML file into this object 
    19         self.config = Configuration(configFilename)  # read in the config file (on per CSML file basis) 
     20 
     21        # Read in the config file, this as simple XML element. Can be different for each CSML dataset; 
     22        # it depends on how the convertor is run. 
     23        configTree = ElementTree()  
     24        configTree.parse(configFilename) 
     25        self.config = configTree.getroot() 
    2026 
    2127    # Auxiliary function, indents XML 
     
    4551 
    4652        # Create and populate a separate folder for each view 
    47         for viewConfig in self.config.getRoot().findall('View'): 
     53        for viewConfig in self.config.findall('View'): 
    4854            kmlViewElement = Element('Folder') 
    4955            SubElement(kmlViewElement, 'name').text=viewConfig.get('name') 
  • DPPP/kml/csml2kml/python/csml2kml/kmlfeatures.py

    r3301 r3308  
    8585        ''' Build a WMS request ''' 
    8686 
     87        # We will be using configuration for WMS request 
     88        c = self.config.find('CSMLGridSeriesFeatureWMSRequest') 
     89 
    8790        # Set request configuration parameters 
    88         c = self.config 
    89         xDir = 'CSMLGridSeriesFeatureWMSRequest/' 
    90         url = c.get(xDir + 'URL') 
    91         serviceVersion = c.get(xDir + 'ServiceVersion') 
    92         imageFormat = c.get(xDir + 'ImageFormat') 
    93         imageWidth = c.get(xDir + 'ImageWidth') 
    94         imageHeight = c.get(xDir + 'ImageHeight') 
    95         crs = c.get(xDir + 'CRS') 
    96         layerName = c.get(xDir + 'LayerName') 
     91        url = c.find('URL').text 
     92        serviceVersion = c.find('ServiceVersion').text 
     93        imageFormat = c.find('ImageFormat').text 
     94        imageWidth = c.find('ImageWidth').text 
     95        imageHeight = c.find('ImageHeight').text 
     96        crs = c.find('CRS').text 
     97        layerName = c.find('LayerName').text 
    9798        filenameWithoutPath = self.parentFilename.split('/')[-1] 
    9899        filenameExcludingSuffix = string.join(filenameWithoutPath.split('.')[:-1], '.') 
     
    105106 
    106107        # If required, make sure the longitude part of the bounding box is within (-180, 180) 
    107         if c.get('LongitudeBounds') == 'MINUS_180_TO_PLUS_180': 
     108        if c.find('LongitudeBounds').text == 'MINUS_180_TO_PLUS_180': 
    108109            self.bBox.east = self.longitudeWithinMinusPlus180(self.bBox.east) 
    109110            self.bBox.west = self.longitudeWithinMinusPlus180(self.bBox.west) 
Note: See TracChangeset for help on using the changeset viewer.