Ejemplo n.º 1
0
    def __init__(self, url, xml, cookies, auth=None, timeout=30, headers=None):
        super(WebCoverageService_1_0_0, self).__init__(auth, headers=headers)
        self.version = '1.0.0'
        self.url = url
        self.cookies = cookies
        self.timeout = timeout
        # initialize from saved capability document or access the server
        reader = WCSCapabilitiesReader(self.version,
                                       self.cookies,
                                       self.auth,
                                       headers=self.headers)
        if xml:
            self._capabilities = reader.readString(xml)
        else:
            self._capabilities = reader.read(self.url, self.timeout)

        # check for exceptions
        se = self._capabilities.find('ServiceException')

        if se is not None:
            err_message = str(se.text).strip()
            raise ServiceException(err_message, xml)

        self.updateSequence = self._capabilities.attrib.get('updateSequence')

        # serviceIdentification metadata
        subelem = self._capabilities.find(ns('Service'))
        self.identification = ServiceIdentification(subelem)

        # serviceProvider metadata
        subelem = self._capabilities.find(
            ns('Service/') + ns('responsibleParty'))
        self.provider = ServiceProvider(subelem)

        # serviceOperations metadata
        self.operations = []
        for elem in self._capabilities.find(ns('Capability/') +
                                            ns('Request'))[:]:
            self.operations.append(OperationMetadata(elem))

        # serviceContents metadata
        self.contents = {}
        for elem in self._capabilities.findall(
                ns('ContentMetadata/') + ns('CoverageOfferingBrief')):
            cm = ContentMetadata(elem, self)
            self.contents[cm.id] = cm

        # Some WCS servers (wrongly) advertise 'Content' OfferingBrief instead.
        if self.contents == {}:
            for elem in self._capabilities.findall(
                    ns('ContentMetadata/') + ns('ContentOfferingBrief')):
                cm = ContentMetadata(elem, self)
                self.contents[cm.id] = cm

        # exceptions
        self.exceptions = [
            f.text
            for f in self._capabilities.findall('Capability/Exception/Format')
        ]
Ejemplo n.º 2
0
    def __init__(self, url, xml, cookies, auth=None, timeout=30, headers=None):
        super(WebCoverageService_2_0_0, self).__init__(auth=auth,
                                                       timeout=timeout,
                                                       headers=headers)
        self.version = "2.0.0"
        self.url = url
        self.cookies = cookies
        self.timeout = timeout
        self.ows_common = OwsCommon(version="2.0.0")
        # initialize from saved capability document or access the server
        reader = WCSCapabilitiesReader(self.version,
                                       self.cookies,
                                       self.auth,
                                       headers=self.headers)
        if xml:
            self._capabilities = reader.readString(xml)
        else:
            self._capabilities = reader.read(self.url, self.timeout)

        # check for exceptions
        se = self._capabilities.find("ServiceException")

        if se is not None:
            err_message = str(se.text).strip()
            raise ServiceException(err_message, xml)

        # serviceIdentification metadata
        subelem = self._capabilities.find(ns("ServiceIdentification"))
        self.identification = ServiceIdentification(
            subelem, namespace=self.ows_common.namespace)

        # serviceProvider metadata
        serviceproviderelem = self._capabilities.find(ns("ServiceProvider"))
        self.provider = ServiceProvider(serviceproviderelem,
                                        namespace=self.ows_common.namespace)

        # serviceOperations metadata
        self.operations = []
        for elem in self._capabilities.find(ns("OperationsMetadata"))[:]:
            if elem.tag != ns("ExtendedCapabilities"):
                self.operations.append(
                    OperationsMetadata(elem,
                                       namespace=self.ows_common.namespace))

        # serviceContents metadata
        self.contents = {}
        for elem in self._capabilities.findall(
                nsWCS2("Contents/") + nsWCS2("CoverageSummary")):
            cm = ContentMetadata(elem, self)
            self.contents[cm.id] = cm

        # exceptions
        self.exceptions = [
            f.text
            for f in self._capabilities.findall("Capability/Exception/Format")
        ]
Ejemplo n.º 3
0
    def __init__(self,url,xml, cookies):
        self.version='1.0.0'
        self.url = url   
        self.cookies=cookies
        # initialize from saved capability document or access the server
        reader = WCSCapabilitiesReader(self.version, self.cookies)
        if xml:
            self._capabilities = reader.readString(xml)
        else:
            self._capabilities = reader.read(self.url)

        # check for exceptions
        se = self._capabilities.find('ServiceException')

        if se is not None:
            err_message = str(se.text).strip()  
            raise ServiceException(err_message, xml) 

        self.updateSequence = self._capabilities.attrib.get('updateSequence')

        #serviceIdentification metadata
        subelem=self._capabilities.find(ns('Service'))
        self.identification=ServiceIdentification(subelem)                               
                   
        #serviceProvider metadata
        subelem=self._capabilities.find(ns('Service/')+ns('responsibleParty'))
        self.provider=ServiceProvider(subelem)   
        
        #serviceOperations metadata
        self.operations=[]
        for elem in self._capabilities.find(ns('Capability/')+ns('Request'))[:]:
            self.operations.append(OperationMetadata(elem))
          
        #serviceContents metadata
        self.contents={}
        for elem in self._capabilities.findall(ns('ContentMetadata/')+ns('CoverageOfferingBrief')): 
            cm=ContentMetadata(elem, self)
            self.contents[cm.id]=cm
        
        #Some WCS servers (wrongly) advertise 'Content' OfferingBrief instead.
        if self.contents=={}:
            for elem in self._capabilities.findall(ns('ContentMetadata/')+ns('ContentOfferingBrief')): 
                cm=ContentMetadata(elem, self)
                self.contents[cm.id]=cm
        
        #exceptions
        self.exceptions = [f.text for f \
                in self._capabilities.findall('Capability/Exception/Format')]
Ejemplo n.º 4
0
    def __init__(self, url, xml, cookies, auth=None):
        super(WebCoverageService_2_0_1, self).__init__(auth=auth)
        self.version = '2.0.1'
        self.url = url
        self.cookies = cookies
        self.ows_common = OwsCommon(version='2.0.1')
        # initialize from saved capability document or access the server
        reader = WCSCapabilitiesReader(self.version, self.cookies, self.auth)
        if xml:
            self._capabilities = reader.readString(xml)
        else:
            self._capabilities = reader.read(self.url)

        # check for exceptions
        se = self._capabilities.find('ServiceException')

        if se is not None:
            err_message = str(se.text).strip()
            raise ServiceException(err_message, xml)

        #serviceIdentification metadata
        subelem = self._capabilities.find(ns('ServiceIdentification'))
        self.identification = ServiceIdentification(
            subelem, namespace=self.ows_common.namespace)

        #serviceProvider metadata
        serviceproviderelem = self._capabilities.find(ns('ServiceProvider'))
        self.provider = ServiceProvider(serviceproviderelem,
                                        namespace=self.ows_common.namespace)

        #serviceOperations metadata
        self.operations = []
        for elem in self._capabilities.find(ns('OperationsMetadata'))[:]:
            if elem.tag != ns('ExtendedCapabilities'):
                self.operations.append(
                    OperationsMetadata(elem,
                                       namespace=self.ows_common.namespace))

        #serviceContents metadata
        self.contents = {}
        for elem in self._capabilities.findall(
                nsWCS2('Contents/') + nsWCS2('CoverageSummary')):
            cm = ContentMetadata(elem, self)
            self.contents[cm.id] = cm

        #exceptions
        self.exceptions = [f.text for f \
                in self._capabilities.findall('Capability/Exception/Format')]
Ejemplo n.º 5
0
    def __init__(self,url,xml, cookies):
        self.version='2.0.1'
        self.url = url
        self.cookies=cookies
        self.ows_common = OwsCommon(version='2.0.1')
        # initialize from saved capability document or access the server
        reader = WCSCapabilitiesReader(self.version, self.cookies)
        if xml:
            self._capabilities = reader.readString(xml)
        else:
            self._capabilities = reader.read(self.url)

        # check for exceptions
        se = self._capabilities.find('ServiceException')

        if se is not None:
            err_message = str(se.text).strip()
            raise ServiceException(err_message, xml)

        #serviceIdentification metadata
        subelem=self._capabilities.find(ns('ServiceIdentification'))
        self.identification=ServiceIdentification(subelem, namespace=self.ows_common.namespace)

        #serviceProvider metadata
        serviceproviderelem=self._capabilities.find(ns('ServiceProvider'))
        self.provider=ServiceProvider(serviceproviderelem, namespace=self.ows_common.namespace)

        #serviceOperations metadata
        self.operations=[]
        for elem in self._capabilities.find(ns('OperationsMetadata'))[:]:
            if elem.tag !=ns('ExtendedCapabilities'):
                self.operations.append(OperationsMetadata(elem, namespace=self.ows_common.namespace))

        #serviceContents metadata
        self.contents={}
        for elem in self._capabilities.findall(nsWCS2('Contents/')+nsWCS2('CoverageSummary')):
            cm=ContentMetadata(elem, self)
            self.contents[cm.id]=cm



        #exceptions
        self.exceptions = [f.text for f \
                in self._capabilities.findall('Capability/Exception/Format')]