Changeset 5173


Ignore:
Timestamp:
06/04/09 13:41:16 (10 years ago)
Author:
domlowe
Message:

WCS urls now generated in WebMapContext? documents

Location:
cows/trunk/cows
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cows/trunk/cows/model/wms.py

    r4912 r5173  
    3535    @type authorityURLs: iterable of AuthorityUrl objects 
    3636    @ivar dataURLs 
    37     @type dataURLs: iterable of DataUrl objects 
     37    @type dataURLs: dictionary mapping layer names to DataUrl objects 
    3838    @ivar featureListURLs 
    3939    @type featureListURLS: iterable of FeatureListURL objects 
     
    4444    @ivar queryable 
    4545    @type queryable: Boolean 
    46  
    4746    """ 
    4847    def __init__(self, CRSs=[], styles=[''], dimensions={}, attribution=None, authorityURLs=[], 
    49                  dataURLs=[], featureListURLs=[], 
     48                 dataURLs={}, featureListURLs=[], 
    5049                 minScaleDenominator=None, maxScaleDenominator=None, 
    5150                 queryable=False, **kw): 
     
    139138        self.unitSymbol = unitSymbol 
    140139 
     140class DataURL(FormattedURL): 
     141    """ 
     142    @ivar width 
     143    @type width: None or int 
     144    @ivar height: 
     145    @type height: None or int 
     146    """ 
     147    def __init__(self, width=None, height=None, **kw): 
     148        super(DataURL, self).__init__(**kw) 
     149        self.width = width 
     150        self.height = height 
     151         
    141152# 
    142153#!TODO: Other objects referenced by WmsDatasetSummary 
  • cows/trunk/cows/pylons/project_templates/cows_server/+package+/config/routing.py

    r5066 r5173  
    1919    # CUSTOM ROUTES HERE 
    2020    map.connect(':fileoruri/wms', controller='csmlwms') 
    21     map.connect(':fileoruri/wcs', controller='csmlwcs') 
     21    map.connect('wcsroute', ':fileoruri/wcs', controller='csmlwcs') #wcsroute is a named route. 
    2222    map.connect(':fileoruri/wfs', controller='csmlwfs') 
    2323    #filestore - used for fetching files referenced by (csml) StorageDescriptors (WFS), and  'store' in wcs if implemented 
  • cows/trunk/cows/pylons/templates/catalogue.xml

    r5059 r5173  
    2626                            request='GetCapabilities', service='WCS')}" 
    2727                            >WCS</a>] 
    28         <!--! WFS disabled for now 
    2928        [<a href="${url_for(controller='csmlwfs', fileoruri=fc, id=None,  
    3029                            request='GetCapabilities', service='WFS')}" 
    3130                            >WFS</a>] 
    32         --> 
    3331        [<a href="${url_for(controller='demo', fileoruri=fc)}" 
    3432                            >Demo</a>] 
  • cows/trunk/cows/pylons/templates/wms_context_1_1_1.xml

    r4911 r5173  
    5050    </py:for> 
    5151    </DimensionList> 
     52    <DataURL> 
     53                <OnlineResource py:if="len(ds.dataURLs)>0" format="${ds.dataURLs[0].format}" xlink:href="${ds.dataURLs[0].onlineResource}"/> 
     54        </DataURL> 
     55     
    5256  </Layer> 
    5357 
  • cows/trunk/cows/pylons/wfs_controller.py

    r5133 r5173  
    240240            if key not in ['query', 'request', 'service', 'version', 'storedquery_id', 'typename', 'valuereference']: 
    241241                otherparams[key]=self._owsParams[key]      
    242         featureresultset, additionalobjects =self._runQuery(queryxml, storedqueryid, typename **otherparams)         
     242        featureresultset, additionalobjects =self._runQuery(queryxml, storedqueryid, typename, **otherparams)         
    243243        
    244244        #Now need to take account of valueReferencexpath, and distill the  
     
    254254        """ GetFeature request 
    255255        """ 
     256        log.info('GET FEATURE Request made: %s'%request) 
    256257        version = self.getOwsParam('version', default=self.validVersions[0]) 
    257258        if version not in self.validVersions: 
  • cows/trunk/cows/pylons/wms_controller.py

    r5122 r5173  
    1818from matplotlib.cm import get_cmap 
    1919from pylons import request, response, c 
     20from routes import url_for 
     21from routes.util import GenerationException 
    2022 
    2123import logging 
     
    2527from genshi.template import NewTextTemplate 
    2628 
    27 from cows.model.wms import WmsDatasetSummary, Dimension 
     29from cows.model.wms import WmsDatasetSummary, Dimension, DataURL 
    2830from cows.model import PossibleValues, WGS84BoundingBox, BoundingBox, Contents 
    2931from cows.pylons import ows_controller 
     
    135137                queryable = False 
    136138                 
     139            #URL to WCS - uses named route 'wcsroute' 
     140            #TODO: Allow for a WCS blacklist to opt out of providing dataurls for certain datasets? 
     141            #TODO: How to make this more configurable - what if WCS is not coupled with WMS? 
     142            try: 
     143                version='1.0.0' #wcs version 
     144                wcsbaseurl=url_for('wcsroute', fileoruri=c.fileoruri,qualified=True)+'?' 
     145                dataURLs=[DataURL(format='WCS:CoverageDescription', onlineResource='%sService=WCS&Request=DescribeCoverage&Coverage=%s&Version=%s'%(wcsbaseurl, layerName, version))] 
     146            except GenerationException: 
     147                log.info("dataURLs not populated: could not generate WCS url with url_for('wcsroute', filedoruri=%s,qualified=True)"%c.fileoruri) 
     148                dataURLs=[] 
    137149            # Create the cows object 
    138150            ds = WmsDatasetSummary(identifier=layerName, 
     
    143155                                   abstracts=[layer.abstract], 
    144156                                   dimensions=dims, 
    145                                    queryable=queryable) 
     157                                   queryable=queryable, 
     158                                   dataURLs=dataURLs) 
    146159 
    147160            # Stuff that should go in the capabilities tree eventually 
Note: See TracChangeset for help on using the changeset viewer.