Changeset 3561


Ignore:
Timestamp:
07/03/08 10:28:58 (11 years ago)
Author:
spascoe
Message:

Several bugs that were making the Capabilities document invalid.

The DDP test WMS server is now viewable through Cadcorp's Map Browser.

Location:
TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/model/contents.py

    r3553 r3561  
    2020 
    2121    """ 
    22     def __init__(self, datasetSummaries=[], otherSources=[]): 
    23         self.datasetSummaries = datasetSummaries 
    24         self.otherSources = otherSources 
     22    def __init__(self, datasetSummaries=None, otherSources=None): 
     23        if datasetSummaries is None: 
     24            self.datasetSummaries = [] 
     25        else: 
     26            self.datasetSummaries = datasetSummaries 
     27        if otherSources is None: 
     28            self.otherSources = [] 
     29        else: 
     30            self.otherSources = otherSources 
    2531 
    2632class DatasetSummary(Description): 
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/model/service_identification.py

    r3553 r3561  
    1919    @ivar profiles 
    2020    @type profiles: iterable of str 
    21     @ivar fees 
    22     @type fees: None or str 
    23     @ivar accessConstraints 
    24     @type accessConstraints: None or str 
     21    @ivar fees: defaults to 'none' 
     22    @type fees: str 
     23    @ivar accessConstraints: defaults to 'none' 
     24    @type accessConstraints: str 
    2525 
    2626    """ 
    2727    def __init__(self, serviceType, serviceTypeVersions=[], 
    28                  profiles=[], fees=None, accessConstraints=None, **kwargs): 
     28                 profiles=[], fees="none", accessConstraints="none", **kwargs): 
    2929        """ 
    3030        All parameters set default attributes of the instance. 
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/ows_controller.py

    r3553 r3561  
    150150    # Load the basic ServiceMetadata from a config file 
    151151    configFile = config.get('ows_server.capabilities_config') 
     152    if configFile is None: 
     153        raise RuntimeError('No OWS configuration file') 
     154     
    152155    c.capabilities = loadConfigFile(configFile) 
    153156 
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/templates/wms_capabilities_1_1_1.xml

    r3548 r3561  
    99from genshi import QName 
    1010import webhelpers as h 
     11import sets 
    1112 
    1213?> 
     
    4445    <Title py:content="ds.titles[0]"/> 
    4546    <Abstract py:if="len(ds.abstracts)>0" py:content="ds.abstracts[0]"/> 
     47    <SRS py:for="crs in ds.CRSs" py:content="crs"/> 
    4648    <py:for each="bb in ds.boundingBoxes"> 
    4749      <BoundingBox SRS="${bb.crs}" 
    48                    minx="${bb.lowerCorner[0]}" 
    49                    miny="${bb.lowerCorner[1]}" 
    50                    maxx="${bb.upperCorner[0]}" 
    51                    maxy="${bb.upperCorner[1]}"/> 
     50                   minx="${'%.2f'%bb.lowerCorner[0]}" 
     51                   miny="${'%.2f'%bb.lowerCorner[1]}" 
     52                   maxx="${'%.2f'%bb.upperCorner[0]}" 
     53                   maxy="${'%.2f'%bb.upperCorner[1]}"/> 
    5254    </py:for> 
    5355 
     
    6062    <!-- TODO Style --> 
    6163    <!-- TODO ScaleHint --> 
    62     <py:for each="d_n, d in ds.dimensions.iteritems()"> 
    63       <Dimension name="${d_n}" units="${d.valuesUnit}" 
    64                  unitSymbol="${d.unitSymbol}"/> 
    65       <Extent name="${d_n}" default="${d.defaultValue}" nearestValue="${int(d.nearestValue)}" 
    66               py:content="','.join(d.possibleValues.allowedValues)"/> 
    67     </py:for> 
     64 
     65<!-- 
     66    <Dimension py:for="d_n, d in ds.dimensions.iteritems()" 
     67               name="${d_n}" units="${d.valuesUnit}" 
     68               unitSymbol="${d.unitSymbol}"/> 
     69    <Extent py:for="d_n, d in ds.dimensions.iteritems()" name="${d_n}" default="${d.defaultValue}" nearestValue="${int(d.nearestValue)}" 
     70            py:content="','.join(d.possibleValues.allowedValues)"/> 
     71--> 
     72 
    6873  </Layer> 
    6974 
     
    7277 
    7378  <Service py:with="sm=c.capabilities; si=c.capabilities.serviceIdentification"> 
    74     <Name>WMS</Name> 
     79    <Name>OGC:WMS</Name> 
    7580    <Title py:content="si.titles[0]"/> 
    7681    <Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/> 
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/wms_controller.py

    r3554 r3561  
    3737        'image/tiff': 'TIFF' 
    3838        } 
     39    _layerSlabCache = {} 
    3940 
    4041    #------------------------------------------------------------------------- 
     
    9495            ds = WmsDatasetSummary(identifier=layerName, 
    9596                                   titles=[layer.title], 
     97                                   CRSs=layer.crss, 
    9698                                   boundingBoxes=bboxObjs, 
    97                                    abstracts=[layer.abstract]) 
     99                                   abstracts=[layer.abstract], 
     100                                   dimensions=dims) 
    98101 
    99102            c.capabilities.contents.datasetSummaries.append(ds) 
     
    123126            raise InvalidParameterValue('Layer %s not found' % layerName, 'layers') 
    124127 
    125                  
     128         
    126129        # Coordinate parameters 
    127130        bbox = tuple(float(x) for x in self.getOwsParam('bbox').split(',')) 
     
    142145        for dimName, dim in layerObj.dimensions.items(): 
    143146            defaultValue = dim.extent[0] 
    144             dimValues[dimName] = self.getOwsParam('time', default=defaultValue) 
    145  
     147            dimValues[dimName] = self.getOwsParam(dimName, default=defaultValue) 
     148             
     149        #--------------------------------------------------------------------- 
    146150        # The real work 
    147151        #!TODO: Minimum and maximum values 
    148         slab = layerObj.getSlab(srs, dimValues, dict(minValue=0, maxValue=100)) 
     152         
     153        # Find the slab in the cache first 
     154        cacheKey = layerObj.getCacheKey(srs, dimValues) 
     155        try: 
     156            slab = self._layerSlabCache[cacheKey] 
     157        except KeyError: 
     158            slab = layerObj.getSlab(srs, dimValues, dict(minValue=0, maxValue=100)) 
     159            self._layerSlabCache[cacheKey] = slab 
    149160 
    150161        # We must request a bbox within the layer's bbox. 
     
    156167        log.debug('ibbox = %s' % (ibbox,)) 
    157168 
    158         # If bbox is not within layerObj.bbox then we need to calculate the pixel 
    159         # offset of the inner bbox, request the right width/height and paste the 
    160         # image into a blank background 
     169        # If bbox is not within layerObj.bbox then we need to calculate the 
     170        # pixel offset of the inner bbox, request the right width/height 
     171        # and paste the image into a blank background 
    161172        if bbox == ibbox: 
    162173            img = slab.getImage(bbox, width, height) 
Note: See TracChangeset for help on using the changeset viewer.