How to use the owslib.common.util.testXMLValue function in OWSLib

To help you get started, we’ve selected a few OWSLib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geopython / OWSLib / owslib.wcs / owslib / coverage / wcs100.py View on Github external
def __init__(self,elem):
        # properties              
        self.type='OGC:WCS'
        self.version='1.0.0'
        self.service = testXMLValue(elem.find(ns('name')))
        self.abstract = testXMLValue(elem.find(ns('description')))
        self.title = testXMLValue(elem.find(ns('name')))     
        self.keywords = [f.text for f in elem.findall(ns('keywords')+'/'+ns('keyword'))]
        #note: differs from 'rights' in interface
        self.fees=elem.find(ns('fees')).text
        self.accessConstraints=elem.find(ns('accessConstraints')).text
github geopython / OWSLib / namespacePkgsTest / owslib.common / owslib / common / iso.py View on Github external
def __init__(self, md, identtype):
        self.identtype = identtype
        val = md.find(util.nspath('citation/CI_Citation/title', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.title = util.testXMLValue(val)

        val = md.find(util.nspath('citation/CI_Citation/date/CI_Date/date', namespaces['gmd']) + '/' + util.nspath('DateTime', namespaces['gco']))
        self.date = util.testXMLValue(val)

        val = md.find(util.nspath('citation/CI_Citation/date/CI_Date/dateType/CI_DateTypeCode', namespaces['gmd'])).attrib.get('codeListValue')
        self.datetype = util.testXMLValue(val, True)

        val = md.find(util.nspath('abstract', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.abstract = util.testXMLValue(val)

        val = md.find(util.nspath('purpose', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.purpose = util.testXMLValue(val, True)

        val = md.find(util.nspath('status/MD_ProgressCode', namespaces['gmd'])).attrib.get('codeListValue')
        self.status = util.testXMLValue(val, True)

        val = md.find(util.nspath('pointOfContact/CI_ResponsibleParty', namespaces['gmd']))

        if val:
            self.contact = CI_ResponsibleParty(val)
        else:
            self.contact = None

        self.keywords = {}

        val = md.find(util.nspath('descriptiveKeywords/MD_Keywords/type/MD_KeywordTypeCode', namespaces['gmd'])).attrib.get('codeListValue')
        self.keywords['type'] = util.testXMLValue(val, True)
github geopython / OWSLib / namespacePkgsTest / owslib.common / owslib / common / iso.py View on Github external
def __init__(self,md):
        val = md.find(util.nspath('linkage/URL', namespaces['gmd']))
        self.url = util.testXMLValue(val)

        val = md.find(util.nspath('protocol', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.protocol = util.testXMLValue(val)

        val = md.find(util.nspath('name', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.name = util.testXMLValue(val)

        val = md.find(util.nspath('description', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.description = util.testXMLValue(val)

        val = md.find(util.nspath('function', namespaces['gmd']))
        if val:
            self.function = val.find(util.nspath('CI_OnLineFunctionCode', namespaces['gmd'])).attrib.get('codeListValue')
        else:
            self.function = None
github geopython / OWSLib / owslib.wcs / owslib / coverage / wcs100.py View on Github external
def __init__(self,elem):
        #it's not uncommon for the service provider info to be missing
        #so handle case where None is passed in
        if elem is None:
            self.name=None
            self.url=None
            self.contact = None
        else:
            self.name=testXMLValue(elem.find(ns('organisationName')))
            self.url=self.name #there is no definitive place for url  WCS, repeat organisationName
            self.contact=ContactMetadata(elem)
github geopython / OWSLib / namespacePkgsTest / owslib.common / owslib / common / iso.py View on Github external
def __init__(self, md):
        val = md.find(util.nspath('geographicElement/EX_GeographicBoundingBox/westBoundLongitude', namespaces['gmd']) + '/' + util.nspath('Decimal', namespaces['gco']))
        self.minx = util.testXMLValue(val)
        val = md.find(util.nspath('geographicElement/EX_GeographicBoundingBox/eastBoundLongitude', namespaces['gmd']) + '/' + util.nspath('Decimal', namespaces['gco']))
        self.maxx = util.testXMLValue(val)
        val = md.find(util.nspath('geographicElement/EX_GeographicBoundingBox/southBoundLatitude', namespaces['gmd']) + '/' + util.nspath('Decimal', namespaces['gco']))
        self.miny = util.testXMLValue(val)
        val = md.find(util.nspath('geographicElement/EX_GeographicBoundingBox/northBoundLatitude', namespaces['gmd']) + '/' + util.nspath('Decimal', namespaces['gco']))
        self.maxy = util.testXMLValue(val)
github geopython / OWSLib / namespacePkgsTest / owslib.common / owslib / common / iso.py View on Github external
val = md.find(util.nspath('pointOfContact/CI_ResponsibleParty', namespaces['gmd']))

        if val:
            self.contact = CI_ResponsibleParty(val)
        else:
            self.contact = None

        self.keywords = {}

        val = md.find(util.nspath('descriptiveKeywords/MD_Keywords/type/MD_KeywordTypeCode', namespaces['gmd'])).attrib.get('codeListValue')
        self.keywords['type'] = util.testXMLValue(val, True)

        self.keywords['list'] = [] 
        for i in md.findall(util.nspath('descriptiveKeywords/MD_Keywords/keyword', namespaces['gmd'])):
            k = i.find(util.nspath('CharacterString', namespaces['gco']))
            self.keywords['list'].append(util.testXMLValue(k))

        val = md.find(util.nspath('topicCategory/MD_TopicCategoryCode', namespaces['gmd']))
        self.topiccategory = util.testXMLValue(val)

        val = md.find(util.nspath('extent/EX_Extent', namespaces['gmd']))

        if val:
            self.bbox = EX_Extent(val)
        else:
            self.bbox = None
github geopython / OWSLib / namespacePkgsTest / owslib.common / owslib / common / iso.py View on Github external
def __init__(self, md, identtype):
        self.identtype = identtype
        val = md.find(util.nspath('citation/CI_Citation/title', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.title = util.testXMLValue(val)

        val = md.find(util.nspath('citation/CI_Citation/date/CI_Date/date', namespaces['gmd']) + '/' + util.nspath('DateTime', namespaces['gco']))
        self.date = util.testXMLValue(val)

        val = md.find(util.nspath('citation/CI_Citation/date/CI_Date/dateType/CI_DateTypeCode', namespaces['gmd'])).attrib.get('codeListValue')
        self.datetype = util.testXMLValue(val, True)

        val = md.find(util.nspath('abstract', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.abstract = util.testXMLValue(val)

        val = md.find(util.nspath('purpose', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.purpose = util.testXMLValue(val, True)

        val = md.find(util.nspath('status/MD_ProgressCode', namespaces['gmd'])).attrib.get('codeListValue')
        self.status = util.testXMLValue(val, True)

        val = md.find(util.nspath('pointOfContact/CI_ResponsibleParty', namespaces['gmd']))

        if val:
github geopython / OWSLib / namespacePkgsTest / owslib.common / owslib / common / iso.py View on Github external
def __init__(self, md, identtype):
        self.identtype = identtype
        val = md.find(util.nspath('citation/CI_Citation/title', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.title = util.testXMLValue(val)

        val = md.find(util.nspath('citation/CI_Citation/date/CI_Date/date', namespaces['gmd']) + '/' + util.nspath('DateTime', namespaces['gco']))
        self.date = util.testXMLValue(val)

        val = md.find(util.nspath('citation/CI_Citation/date/CI_Date/dateType/CI_DateTypeCode', namespaces['gmd'])).attrib.get('codeListValue')
        self.datetype = util.testXMLValue(val, True)

        val = md.find(util.nspath('abstract', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.abstract = util.testXMLValue(val)

        val = md.find(util.nspath('purpose', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.purpose = util.testXMLValue(val, True)

        val = md.find(util.nspath('status/MD_ProgressCode', namespaces['gmd'])).attrib.get('codeListValue')
        self.status = util.testXMLValue(val, True)

        val = md.find(util.nspath('pointOfContact/CI_ResponsibleParty', namespaces['gmd']))

        if val:
            self.contact = CI_ResponsibleParty(val)
        else:
            self.contact = None
github geopython / OWSLib / namespacePkgsTest / owslib.common / owslib / common / iso.py View on Github external
self.charset = util.testXMLValue(val, True)
  
        val = md.find(util.nspath('hierarchyLevel/MD_ScopeCode', namespaces['gmd'])).attrib.get('codeListValue')
        self.hierarchy = util.testXMLValue(val, True)

        val = md.find(util.nspath('contact/CI_ResponsibleParty', namespaces['gmd']))
        if val:
            self.contact = CI_ResponsibleParty(val)
        else:
            self.contact = None

        val = md.find(util.nspath('dateStamp', namespaces['gmd']) + '/' + util.nspath('DateTime', namespaces['gco']))
        self.datestamp = util.testXMLValue(val)
        
        val = md.find(util.nspath('metadataStandardName', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.stdname = util.testXMLValue(val)

        val = md.find(util.nspath('metadataStandardVersion', namespaces['gmd']) + '/' + util.nspath('CharacterString', namespaces['gco']))
        self.stdver = util.testXMLValue(val)

        val = md.find(util.nspath('referenceSystemInfo/MD_ReferenceSystem', namespaces['gmd']))
        if val:
            self.referencesystem = MD_ReferenceSystem(val)
        else:
            self.referencesystem = None

        val = md.find(util.nspath('identificationInfo/MD_DataIdentification', namespaces['gmd']))
        val2 = md.find(util.nspath('identificationInfo', namespaces['gmd']) + '/' + util.nspath('SV_ServiceIdentification', namespaces['srv']))

        if val:
            self.identification = MD_DataIdentification(val, 'dataset')
        elif val2:
github geopython / OWSLib / namespacePkgsTest / owslib.common / owslib / common / iso.py View on Github external
else:
            self.bbox = None

        val = md.find(util.nspath('couplingType/SV_CouplingType', namespaces['srv'])).attrib.get('codeListValue')
        self.couplingtype = util.testXMLValue(val, True)

        self.operations = []

        for i in md.findall(util.nspath('containsOperations', namespaces['srv'])):
            tmp = {}
            val = i.find(util.nspath('SV_OperationMetadata/operationName', namespaces['srv']) + '/' + util.nspath('CharacterString', namespaces['gco']))
            tmp['name'] = util.testXMLValue(val)
            tmp['dcplist'] = []
            for d in i.findall(util.nspath('SV_OperationMetadata/DCP', namespaces['srv'])):
                tmp2 = d.find(util.nspath('DCPList', namespaces['srv'])).attrib.get('codeListValue')
                tmp['dcplist'].append(util.testXMLValue(tmp2, True))
         
            tmp['connectpoint'] = []
 
            for d in i.findall(util.nspath('SV_OperationMetadata/connectPoint', namespaces['srv'])):
                tmp3 = d.find(util.nspath('CI_OnlineResource', namespaces['gmd']))
                tmp['connectpoint'].append(CI_OnlineResource(tmp3))
            self.operations.append(tmp)

        self.operateson = []
         
        for i in md.findall(util.nspath('operatesOn', namespaces['srv'])):
            tmp = {}
            tmp['uuidref'] = i.attrib.get('uuidref')
            tmp['href'] = i.attrib.get(util.nspath('href', namespaces['xlink']))
            tmp['title'] = i.attrib.get(util.nspath('title', namespaces['xlink']))
            self.operateson.append(tmp)