Ignore:
Timestamp:
18/02/08 16:52:06 (12 years ago)
Author:
mkochan
Message:

Changing GridSeriesConvertor? to use KML (unfinished).

File:
1 edited

Legend:

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

    r3439 r3451  
    228228        regionElement.append(lodElement) 
    229229        return regionElement 
     230 
     231class KMLGroundOverlay(KMLElement): 
     232    '''Represents the <kml:GroundOverlay> tag.''' 
     233 
     234    def __init__(self, name, sourceUrl, timespanStart, timespanEnd, west, south, east, north): 
     235        self.name = name 
     236        self.timespanStart = timespanStart 
     237        self.timespanEnd = timespanEnd 
     238        self.sourceUrl = sourceUrl 
     239        self.west = west 
     240        self.south = south 
     241        self.east = east 
     242        self.north = north 
     243 
     244    def build(self): 
     245 
     246        groundOverlayElement = Element('GroundOverlay') 
     247 
     248        SubElement(groundOverlayElement, 'name').text = self.name 
     249        SubElement(groundOverlayElement, 'open').text = '0' 
     250        SubElement(groundOverlayElement, 'visibility').text = '0' 
     251 
     252        timespanElement = SubElement(groundOverlayElement, 'TimeSpan') 
     253        SubElement(timespanElement, 'begin').text = ('%04d-%02d-%02d') % timespanStart.utctimetuple()[0:3] 
     254        SubElement(timespanElement, 'end').text = ('%04d-%02d-%02d') % timespanEnd.utctimetuple()[0:3] 
     255 
     256        # Include the WMS service call address 
     257        iconElement = SubElement(groundOverlayElement, 'icon') 
     258        SubElement(iconElement, 'href').text = sourceUrl 
     259        SubElement(iconElement, 'refreshMode').text = 'onExpire' 
     260 
     261        latlonboxElement=SubElement(groundOverlayElement, 'LatLonBox') 
     262        SubElement(latlonboxElement, 'north').text = str(self.north) 
     263        SubElement(latlonboxElement, 'south').text = str(self.south) 
     264        SubElement(latlonboxElement, 'east' ).text = str(self.east) 
     265        SubElement(latlonboxElement, 'west' ).text = str(self.west) 
     266 
     267        return groundOverlayElement 
     268         
Note: See TracChangeset for help on using the changeset viewer.