Changeset 4690


Ignore:
Timestamp:
19/12/08 14:05:47 (11 years ago)
Author:
domlowe
Message:

adding stub describecoverage template

Location:
cows/branches/wcsmerge/cows/pylons
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • cows/branches/wcsmerge/cows/pylons/wcs_controller.py

    r4685 r4690  
    210210                c.descriptions.append(ds) 
    211211        response.headers['content-type']='text/xml' 
    212         return response.write(c.descriptions) 
    213  
    214  
    215     def GetFeatureInfo(self): #TODO: This should be DescribeCoverage 
    216         # Housekeeping 
    217         version = self.getOwsParam('version', default=self.validVersions[0]) 
    218         if version not in self.validVersions: 
    219             raise InvalidParameterValue('Version %s not supported' % version, 
    220                                         'version') 
    221  
    222         # Coordinate parameters 
    223         bbox = tuple(float(x) for x in self.getOwsParam('bbox').split(',')) 
    224         width = int(self.getOwsParam('width')) 
    225         height = int(self.getOwsParam('height')) 
    226            
    227         # Get pixel location 
    228         i = int(self.getOwsParam('i')) 
    229         j = int(self.getOwsParam('j')) 
    230  
    231         # Translate to geo-coordinates 
    232         x, y = bbox_util.pixelToGeo(i, j, bbox, width, height) 
    233         #start preparing GetFeatureInfo response. Assumes "HTML" output format 
    234  
    235         htmlResponse = "<html><body><p> <b>Feature Information about pixel position: "+self.getOwsParam('i')+","+self.getOwsParam('j')+"/geo position: "+str(x)+","+str(y) +"<b/></p>" 
    236          
    237          
    238         layers = self._getLayerParam('query_layers') 
    239         #Adjusts response for multiple layers 
    240         if len(layers) > 1: 
    241             htmlResponse = htmlResponse+" Multiple possible features found as follows:" 
    242    
    243         htmlResponse = htmlResponse+"<ul>" 
    244          
    245         format = self.getOwsParam('info_format', default='text/html') 
    246         for layerName, layerObj in layers.iteritems(): 
    247             log.debug('Format: %s' % format) 
    248             log.debug('Title: %s' % layerObj.title) 
    249             log.debug('FeatureInfoFormats: %s' % layerObj.featureInfoFormats) 
    250         if format not in layerObj.featureInfoFormats: 
    251             raise InvalidParameterValue('Layer %s does not support GetFeatureInfo in format %s' %(layerName, format), 'info_format') 
    252  
    253         if version == '1.1.1': 
    254                 srs = self.getOwsParam('srs') 
    255         else: 
    256             srs = self.getOwsParam('crs') 
    257  
    258         if srs not in layerObj.crss: 
    259             raise InvalidParameterValue('Layer %s does not support SRS %s' % 
    260                                         (layerName, srs)) 
    261  
    262         # Dimension handling 
    263         dimValues = {} 
    264         for dimName, dim in layerObj.dimensions.items(): 
    265             defaultValue = dim.extent[0] 
    266             dimValues[dimName] = self.getOwsParam(dimName, default=defaultValue) 
    267          
    268         response.headers['Content-Type'] = format 
    269         response.write(layerObj.getFeatureInfo(format, srs, (x, y), dimValues)) 
     212        t = ows_controller.templateLoader.load('wcs_describecoverage_1_0_0.xml') 
     213        return t.generate(c=c).render()                 
     214 
     215 
    270216 
    271217 
Note: See TracChangeset for help on using the changeset viewer.