Changeset 3499


Ignore:
Timestamp:
21/02/08 16:50:50 (12 years ago)
Author:
mkochan
Message:

Started writing the WMSCapabilities.BottomWMSLayer.toKML() method. Added (as far empty) class WMSCapabilities.View.

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

Legend:

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

    r3497 r3499  
    7575        return self._parseName()[2] 
    7676 
    77     def toKML(self): 
    78         # Return a KML.KMLFolder object representing a <kml:Folder> element with lots of <kml:GroundOverlay> elements, 
    79         # each standing for a different  
     77    def toKML(self, views): 
     78        ''' 
     79        @param views: A list of View objects, which define how we are going to look at the data. 
     80        @return: a KML.KMLFolder object representing a <kml:Folder> element with lots of <kml:GroundOverlay> elements, 
     81        each standing for a different time segment. 
     82        [NOTE] Should replace timeStep with a timedate object? 
     83        [NOTE] Please! Use dates.datetime all around here -- the self.times are of such type! 
     84        [NOTE] Let us have this function one the class View is defined:  
     85                 (startDatetime, endDatetime) = view.getLogicalTimespan(datetime) 
     86        ''' 
     87 
     88        def buildWMSRequest(timeStep): 
     89            ''' Build a WMS request ''' 
     90 
     91            # We will be using configuration for WMS request 
     92            c = self.config.find('CSMLGridSeriesFeatureWMSRequest') 
     93 
     94            # Set request configuration parameters 
     95            url = c.find('URL').text 
     96            serviceVersion = c.find('ServiceVersion').text 
     97            imageFormat = c.find('ImageFormat').text 
     98            imageWidth = c.find('ImageWidth').text 
     99            imageHeight = c.find('ImageHeight').text 
     100            crs = c.find('CRS').text 
     101 
     102            # If timeStep contains a time part, make sure that the "Z" for "Zulu" is appended, as required by WMS 
     103            if re.search("T\d+\:\d+:\d+(\.\d+)$", timeStep): 
     104                timeStep = timeStep + 'Z' 
     105 
     106            bBox = '-180,-90,180,90' 
     107             
     108            wmsRequest = '%s?request=GetMap&amp;SERVICE=%s&amp;FORMAT=%s&amp;LAYERS=%s&amp;BBOX=%s&amp;WIDTH=%s&amp;HEIGHT=%s&amp;CRS=%s&TIME=%s' % (url, serviceVersion, imageFormat, layerName, bBox, imageWidth, imageHeight, crs, timeStep) 
     109 
     110            return wmsRequest 
     111         
     112        # ------------ 
     113 
     114        for view in views: 
     115            ... 
     116            kmlFolder = # representation of time points using this view 
     117            
     118class View: 
     119    ''' 
     120    Determines how data can be viewed. That is, in practice, how it can be converted into KML so it can be viewed 
     121    in Google Earth. In particular, it defines logical transforms of time-points into time-spans. 
     122    ''' 
     123    pass 
    80124 
    81125class WMSCapabilities: 
  • DPPP/kml/csml2kml/python/notes.txt

    r3497 r3499  
    1212[o] Consider whether it is appropriate for WMSLayersConvertor to be in the "csml2kml" package, given that it 
    1313     does *not* involve CSML along the way (possibly CSML could later get involved, so better to keep it as an example). 
     14[o] For now, keeping a config file (using 'ar4.conf.xml'), for some stuff at least, but consider whether not to dump this 
     15    and pass everything in Python -- consult with Stephen during presentation. 
    1416 
    1517---------------------------------------------------------------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.