Ignore:
Timestamp:
27/06/07 14:34:23 (12 years ago)
Author:
domlowe
Message:

changes to getCapabilites and mime handling

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wcs.py

    r2650 r2653  
    4343         
    4444        # Create the container (outer) email message. 
    45         msg = MIMEMultipart() 
     45        msg = MIMEMultipart()         
     46         
     47        xmlfile =StringIO.StringIO(xml) 
     48        xmlfile.readline(), xmlfile.readline() #don't read in first 2 lines (the content type) as MIMEBase also provides it. 
     49             
    4650         
    4751        #add the XML part 
    48         submsg=MIMEText(StringIO.StringIO(xml).read(), _subtype='xml') 
     52        submsg=MIMEText(xmlfile.read(), _subtype='xml') 
     53        submsg.add_header('Content-ID', '<coverage.xml>') 
    4954        msg.attach(submsg) 
    5055 
    5156         
    5257        #add the NetCDF part 
    53         submsg= MIMEBase('application', 'netcdf') 
     58        submsg= MIMEBase('application', 'CF-netcdf') #check in ogc docs 
    5459        submsg.set_payload(netcdf.read()) 
     60        submsg.set_type('application/CF-netcdf; name="coverage.nc"') 
     61        submsg.add_header('Content-ID', '<coverage.nc>') 
    5562        netcdf.close() 
    5663        # Encode the payload using Base64 
     
    7885    def _loadFeatureSummary(self, feature): 
    7986        dims = self._loadFeatureDimensions(feature) 
     87        #TODO - need to ensure proper values for Name. ID and Description are populated. 
     88        cvgTitle=[feature.description.CONTENT] 
     89        cvgDescription=feature.description.CONTENT 
     90        cvgAbstract=[feature.description.CONTENT] 
     91        bbox=c.dataset.getBoundingBox()  #TODO, use the bounding box of the feature not the dataset. 
    8092        return WcsDatasetSummary(identifier=feature.id, 
    81                                  titles=[feature.description.CONTENT], 
    82                                  boundingBoxes=[BoundingBox([-180,-90], [180,90], 
    83                                                             crs='CRS:84')], 
    84                                  dimensions=dims, description=feature.description.CONTENT             
     93                                 titles=cvgTitle, 
     94                                 boundingBoxes=[BoundingBox([bbox[0],bbox[1]], [bbox[2],bbox[3]], 
     95                                 crs='CRS:84')], dimensions=dims,  description=cvgDescription,abstracts=cvgAbstract 
    8596                                 ) 
    8697 
     
    150161                filename = extractToNetCDF(feature, sel) 
    151162             
     163            #use the randomly allocated filename as a basis for an identifier 
     164            f=os.path.basename(filename) 
     165            c.fileID=os.path.splitext(f)[0] 
     166             
    152167            #Depending on if the 'store' parameter is set, either return the netcdf file + coverage xml as a multipart mime or return a coverage document containing a link. 
     168                       
    153169            if store: 
    154170                if status: 
     
    161177                    #STORE=true, STATUS = false: Return Coverage XML document with link to file. 
    162178                    #use the temp file name (minus extension) as an ID 
    163                     f=os.path.basename(filename) 
    164                     c.fileID=os.path.splitext(f)[0] 
    165179                    c.hyperlink = 'http://'+request.environ['HTTP_HOST']+'/'+os.path.basename(request.environ['paste.config']['app_conf']['publish_dir'])+'/'+os.path.basename(filename) 
    166180                    r=render_response('wcs_getCoverageResponse', format='xml') 
     
    170184                #STORE = FALSE, STATUS therefore irrelevant, return Multipart Mime. 
    171185                netcdfFile=open(filename, 'r') 
     186                c.hyperlink="cid:coverage.nc" 
    172187                xmlfile=render_response('wcs_getCoverageResponse', format='xml') 
    173188                xmlfile.headers['content-type'] = 'text/xml' 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/ows/wcs_capabilities.kid

    r2592 r2653  
    5353    <Identifier py:if="ds.identifier is not None" py:content="ds.identifier"/> 
    5454    <Description py:if="ds.description is not None" py:content="ds.description"/> 
    55     <ows:Title></ows:Title> 
    56     <ows:Abstract></ows:Abstract> 
     55    <ows:Title py:if="ds.titles is not None" py:content="ds.titles"/>         
     56    <ows:Abstract py:if="ds.abstracts is not None" py:content="ds.abstracts"/>     
    5757    <ows:Metadata></ows:Metadata> 
    5858    <ows:WGS84BoundingBox></ows:WGS84BoundingBox> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/wcs_getCoverageResponse.kid

    r2649 r2653  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <GetCoverage xmlns="http://www.opengis.net/wcs/1.1"  
     2<Coverages xmlns="http://www.opengis.net/wcs/1.1"  
    33        xmlns:py="http://purl.org/kid/ns#" 
    44        xmlns:ows="http://www.opengis.net/ows"  
    5         xmlns:xlink="http://www.w3.org/1999/xlink" 
    6         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    7         xsi:schemaLocation="http://www.opengis.net/wcs/1.1/ows ../owsCoverages.xsd http://www.opengis.net/ows ../../../ows/1.0.0/ows19115subset.xsd"> 
     5        xmlns:xlink="http://www.w3.org/1999/xlink" > 
    86    <Coverage> 
    97        <ows:Title>Coverage ${c.fileID}</ows:Title> 
    108        <ows:Abstract>Created from getCoverage request to NDG WCS</ows:Abstract> 
    119        <Identifier>${c.fileID}</Identifier> 
    12         <Reference>xlink:href"${c.hyperlink}" xlink:role="urn:ogc:def:role:WCS:1.1:metadata</Reference> 
     10        <Reference>xlink:href="${c.hyperlink}" xlink:role="urn:ogc:def:role:WCS:1.1:metadata"</Reference> 
    1311    </Coverage> 
    14 </GetCoverage> 
     12</Coverages> 
Note: See TracChangeset for help on using the changeset viewer.