| Home | Trees | Indices | Help |
|
|---|
|
|
1 #------------------------------------------------------------------------------- 2 # $Id: desccov.py 2224 2013-02-01 14:30:32Z schindlerf $ 3 # 4 # Project: EOxServer <http://eoxserver.org> 5 # Authors: Stephan Krause <stephan.krause@eox.at> 6 # Stephan Meissl <stephan.meissl@eox.at> 7 # 8 #------------------------------------------------------------------------------- 9 # Copyright (C) 2011 EOX IT Services GmbH 10 # 11 # Permission is hereby granted, free of charge, to any person obtaining a copy 12 # of this software and associated documentation files (the "Software"), to deal 13 # in the Software without restriction, including without limitation the rights 14 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 # copies of the Software, and to permit persons to whom the Software is 16 # furnished to do so, subject to the following conditions: 17 # 18 # The above copyright notice and this permission notice shall be included in all 19 # copies of this Software or works derived from this Software. 20 # 21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 # THE SOFTWARE. 28 #------------------------------------------------------------------------------- 29 30 """ 31 This module contains the handler for WCS 2.0 / EO-WCS DescribeCoverage requests. 32 """ 33 34 from eoxserver.core.system import System 35 from eoxserver.core.util.xmltools import DOMElementToXML 36 from eoxserver.services.base import BaseRequestHandler 37 from eoxserver.services.requests import Response 38 from eoxserver.services.exceptions import InvalidRequestException 39 from eoxserver.services.ows.wcs.encoders import WCS20EOAPEncoder 4042 """ 43 This handler generates responses to WCS 2.0 / EO-WCS DescribeCoverage 44 requests. It inherits directly from :class:`~.BaseRequestHandler` and 45 does NOT reuse MapServer. 46 47 The workflow implemented by the handler starts with the 48 :meth:`createCoverages` method and generates the coverage descriptions 49 using the :class:`~.WCS20EOAPEncoder` method 50 :meth:`~.WCS20EOAPEncoder.encodeCoverageDescriptions`. 51 """ 52 53 REGISTRY_CONF = { 54 "name": "WCS 2.0 DescribeCoverage Handler", 55 "impl_id": "services.ows.wcs20.WCS20DescribeCoverageHandler", 56 "registry_values": { 57 "services.interfaces.service": "wcs", 58 "services.interfaces.version": "2.0.0", 59 "services.interfaces.operation": "describecoverage" 60 } 61 } 62 63 PARAM_SCHEMA = { 64 "service": {"xml_location": "/@service", "xml_type": "string", "kvp_key": "service", "kvp_type": "string"}, 65 "version": {"xml_location": "/@version", "xml_type": "string", "kvp_key": "version", "kvp_type": "string"}, 66 "operation": {"xml_location": "/", "xml_type": "localName", "kvp_key": "request", "kvp_type": "string"}, 67 "coverageids": {"xml_location": "/{http://www.opengis.net/wcs/2.0}CoverageId", "xml_type": "string[]", "kvp_key": "coverageid", "kvp_type": "stringlist"} 68 } 6910871 req.setSchema(self.PARAM_SCHEMA) 72 73 self.createCoverages(req) 74 75 encoder = WCS20EOAPEncoder() 76 77 return Response( 78 content=DOMElementToXML(encoder.encodeCoverageDescriptions(req.coverages, True)), # TODO: Distinguish between encodeEOCoverageDescriptions and encodeCoverageDescription? 79 content_type="text/xml", 80 status=200 81 )8284 """ 85 This method retrieves the coverage metadata for the coverages denoted 86 by the coverageid parameter of the request. It raises an 87 :exc:`~.InvalidRequestException` if the coverageid parameter is 88 missing or if it contains an unknown coverage ID. 89 """ 90 coverage_ids = req.getParamValue("coverageids") 91 92 if coverage_ids is None: 93 raise InvalidRequestException("Missing 'coverageid' parameter.", "MissingParameterValue", "coverageid") 94 else: 95 for coverage_id in coverage_ids: 96 coverage = System.getRegistry().getFromFactory( 97 "resources.coverages.wrappers.EOCoverageFactory", 98 {"obj_id": coverage_id} 99 ) 100 if coverage is None: 101 raise InvalidRequestException( 102 "No coverage with coverage id '%s' found" % coverage_id, 103 "NoSuchCoverage", 104 coverage_id 105 ) 106 107 req.coverages.append(coverage)110 REGISTRY_CONF = { 111 "name": "WCS 2.0 DescribeCoverage Handler", 112 "impl_id": "services.ows.wcs20.WCS20CorrigendumDescribeCoverageHandler", 113 "registry_values": { 114 "services.interfaces.service": "wcs", 115 "services.interfaces.version": "2.0.1", 116 "services.interfaces.operation": "describecoverage" 117 } 118 }119
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Wed May 15 14:50:20 2013 | http://epydoc.sourceforge.net |