Changeset 3209


Ignore:
Timestamp:
14/01/08 11:44:34 (12 years ago)
Author:
mkochan
Message:

Created config file entries for longitude and latitude constraints (the MINUS_180_TO_PLUS_180 is supported in code). Made sure that WMS is passed time steps with the "Z" for "Zulu" appended

Location:
DPPP/kml/csml2kml
Files:
3 edited

Legend:

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

    r3204 r3209  
    5252        return (startDate, endDate) 
    5353 
    54     def _coordWithin180(self, x): 
     54    def _longitudeWithinMinusPlus180(self, x): 
    5555        ''' Put the x coordinate within bounds of the period (-180, 180)''' 
    56         #if x != 180: 
    57         #    x = ((x + 180) % 360) - 180 
     56        if x != 180: 
     57            x = ((x + 180) % 360) - 180 
    5858        return x 
    5959     
    60     # [UNTESTED] 
     60    # Use this whenever it is undesirable to force coordinates into bounds 
     61    # or momentarily it seems to be best to leave them as they are. 
     62    def _longitudeUnconstrained(self, x): 
     63        return x 
     64 
     65    # [UNFINISHED] The Z postfix for time, various longitute coordinate bounds. 
    6166    def _buildWMSRequest(self, timeStep): 
    6267        ''' Build a WMS request ''' 
     
    7378        filenameWithoutPath = self.parentFilename.split('/')[-1] 
    7479        filenameExcludingSuffix = string.join(filenameWithoutPath.split('.')[:-1], '.') 
    75         print '%', filenameExcludingSuffix, self.name 
    7680        layerName = layerName.replace('#FILENAME_EXCL_SUFFIX#', filenameExcludingSuffix) 
    7781        layerName = layerName.replace('#FEATURE_NAME#', self.name) 
    7882 
    79         # Make sure that the bounding box is within (-180, 180) bounds for longitude and (-90, 90) for latitude 
    80         self.bBox.east = self._coordWithin180(self.bBox.east) 
    81         self.bBox.west = self._coordWithin180(self.bBox.west) 
     83        # If timeStep contains a time part, make sure that the "Z" for "Zulu" is appended, as required by WMS 
     84        if re.search("T\d+\:\d+:\d+(\.\d+)$", timeStep): 
     85            timeStep = timeStep + 'Z' 
     86 
     87        # If required, make sure the longitude part of the bounding box is within (-180, 180) 
     88        if c.get('LongitudeBounds') == 'MINUS_180_TO_PLUS_180': 
     89            self.bBox.east = self._longitudeWithinMinusPlus180(self.bBox.east) 
     90            self.bBox.west = self._longitudeWithinMinusPlus180(self.bBox.west) 
    8291         
    83  
    84         wmsRequest = '%s?request=GetMap&SERVICE=%s&FORMAT=%s&LAYERS=%s&BBOX=%s&WIDTH=%s&HEIGHT=%s&CRS=%s&TIME=%s' % (url, serviceVersion, imageFormat, layerName, self.bBox.str(), imageWidth, imageHeight, crs, timeStep+'Z') 
     92        wmsRequest = '%s?request=GetMap&SERVICE=%s&FORMAT=%s&LAYERS=%s&BBOX=%s&WIDTH=%s&HEIGHT=%s&CRS=%s&TIME=%s' % (url, serviceVersion, imageFormat, layerName, self.bBox.str(), imageWidth, imageHeight, crs, timeStep) 
    8593 
    8694        return wmsRequest 
  • DPPP/kml/csml2kml/python/notes.txt

    r3198 r3209  
     1Notes: 
     2 
    13* We can infer WMS address from CSML document id & prefix which is static 
    24  (the address of the concrete WMS service; not part of the CSML document). 
     
    1214--------------------------------------- 
    1315 
    14 Tasks: 
    15  
    16 * Always convert out of long:(-180,180) to inside it. 
    17  
    18 --------------------------------------- 
    19  
    2016Ideas: 
    2117 
     
    2319        using the FeatureDescriptor construct? That would make existence of a config file 
    2420        unneccessary. 
    25 * CSML does not require a specific CRS, but for portals it's gonna be WGS. 
     21        - No, because CSML file should not be linked to any WMS service (they change a lot, 
     22          even within BADC). It would make CSML "not what it's supposed to be". 
     23* CSML does not require a specific CRS, but for portals it's gonna be "WGS" (world geodetic system). 
     24 
     25--------------------------------------- 
     26 
     27Long term issues: 
     28 
     29* The way coordinate bounds are specified. Both systems (-180, 180) or (0, 360) have 
     30  a problem with singularity, which WMS cannot account for. We cannot a map returned which 
     31  has the west coordinate higher than the east coordinate -- the server will not return a 
     32  map spanning the singularity. Hence we probably need to do 2 calls to WMS by using two 
     33  regions in KML on the map. 
  • DPPP/kml/csml2kml/testdata/clim_10.csml2kml.conf.xml

    r3204 r3209  
    55  <ImageWidth>640</ImageWidth> 
    66  <ImageHeight>480</ImageHeight> 
     7  <TimeFormat>xxxx-xx-xxT00:00:00.0</TimeFormat> 
    78  <CRS>EPSG:4326</CRS> 
    89  <LayerName>#FILENAME_EXCL_SUFFIX#/#FEATURE_NAME#</LayerName> 
     10  <LongitudeBounds>UNCONSTRAINED</LongitudeBounds> 
     11  <LatitudeBounds>UNCONSTRAINED</LatitudeBounds> 
    912</CSMLGridSeriesFeatureWMSRequest> 
Note: See TracChangeset for help on using the changeset viewer.