How to use the owslib.util.nspath_eval 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 / owscontext / atom.py View on Github external
context_base_dict['properties'].update({"title": title})

    #  ..
    # 		
    #       
    vals = feed_root.findall(util.nspath_eval('atom:author', ns))
    authors = []
    for val in vals:
        val_name = val.find(util.nspath_eval('atom:name', ns))
        val_email = val.find(util.nspath_eval('atom:email', ns))
        val_uri = val.find(util.nspath_eval('atom:uri', ns))
        name = util.testXMLValue(val_name)
        email = util.testXMLValue(val_email)
        uri = util.testXMLValue(val_uri)
        author = {
            "name": name,
            "email": email,
            "uri": uri
        }
        # log.debug("author %s :: %s", author, vals)
        if not is_empty(author):
            authors.append(author)

    context_base_dict['properties'].update({"authors": authors})

    # 
github geopython / OWSLib / owslib / iso_che.py View on Github external
self.type = None
            val = md.find(util.nspath_eval('gmd:type/gmd:MD_KeywordTypeCode', namespaces))
            self.type = util.testXMLAttribute(val, 'codeListValue')

            self.thesaurus = None
            val = md.find(util.nspath_eval('gmd:thesaurusName/gmd:CI_Citation', namespaces))
            if val is not None:
                self.thesaurus = {}

                thesaurus = val.find(util.nspath_eval('gmd:title/gco:CharacterString', namespaces))
                self.thesaurus['title'] = util.testXMLValue(thesaurus)

                thesaurus = val.find(util.nspath_eval('gmd:date/gmd:CI_Date/gmd:date/gco:Date', namespaces))
                self.thesaurus['date'] = util.testXMLValue(thesaurus)

                thesaurus = val.find(util.nspath_eval('gmd:date/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode', namespaces))
                self.thesaurus['datetype'] = util.testXMLAttribute(thesaurus, 'codeListValue')
github geopython / OWSLib / owslib / iso.py View on Github external
self.identificationinfo.append(MD_DataIdentification(val, 'service'))
                    elif tagval == 'SV_ServiceIdentification':
                        self.identificationinfo.append(SV_ServiceIdentification(val))

            self.contentinfo = []
            for contentinfo in md.findall(util.nspath_eval('gmd:contentInfo/gmd:MD_FeatureCatalogueDescription', namespaces)):
                self.contentinfo.append(MD_FeatureCatalogueDescription(contentinfo))

            val = md.find(util.nspath_eval('gmd:distributionInfo/gmd:MD_Distribution', namespaces))

            if val is not None:
                self.distribution = MD_Distribution(val)
            else:
                self.distribution = None

            val = md.find(util.nspath_eval('gmd:dataQualityInfo/gmd:DQ_DataQuality', namespaces))
            if val is not None:
                self.dataquality = DQ_DataQuality(val)
            else:
                self.dataquality = None
github geopython / OWSLib / owslib / swe / observation / sos200.py View on Github external
# LOOK: Support swe:Phenomenon here
        # this includes compound properties
        self.observed_properties = []
        for op in self._root.findall(nspath_eval('swes:observableProperty', namespaces)):
            self.observed_properties.append(testXMLValue(op))

        self.features_of_interest = []
        for fot in self._root.findall(nspath_eval('sos:featureOfInterest', namespaces)):
            self.features_of_interest.append(testXMLValue(fot.attrib.get(nspath_eval('xlink:href', namespaces)), True))

        self.response_formats = []
        for rf in self._root.findall(nspath_eval('sos:responseFormat', namespaces)):
            self.response_formats.append(testXMLValue(rf))

        self.observation_models = []
        for om in self._root.findall(nspath_eval('sos:observationType', namespaces)):
            self.observation_models.append(testXMLValue(om))
github geopython / OWSLib / owslib / iso.py View on Github external
self.name = util.testXMLValue(val)
        val = ct.find(util.nspath_eval('gmx:scope/gco:CharacterString', namespaces))
        self.scope = util.testXMLValue(val)
        val = ct.find(util.nspath_eval('gmx:fieldOfApplication/gco:CharacterString', namespaces))
        self.fieldapp = util.testXMLValue(val)
        val = ct.find(util.nspath_eval('gmx:versionNumber/gco:CharacterString', namespaces))
        self.version = util.testXMLValue(val)
        val = ct.find(util.nspath_eval('gmx:versionDate/gco:Date', namespaces))
        self.date = util.testXMLValue(val)

        self.dictionaries = {}

        for i in ct.findall(util.nspath_eval('gmx:codelistItem/gmx:CodeListDictionary', namespaces)):
            id = i.attrib.get(util.nspath_eval('gml32:id', namespaces))
            self.dictionaries[id] = {}
            val = i.find(util.nspath_eval('gml32:description', namespaces))
            self.dictionaries[id]['description'] = util.testXMLValue(val)
            val = i.find(util.nspath_eval('gml32:identifier', namespaces))
            self.dictionaries[id]['identifier'] = util.testXMLValue(val)
            self.dictionaries[id]['entries'] = {}

            for j in i.findall(util.nspath_eval('gmx:codeEntry', namespaces)):
                id2 = j.find(util.nspath_eval('gmx:CodeDefinition', namespaces)).attrib.get(util.nspath_eval('gml32:id', namespaces))
                self.dictionaries[id]['entries'][id2] = {}
                val = j.find(util.nspath_eval('gmx:CodeDefinition/gml32:description', namespaces))
                self.dictionaries[id]['entries'][id2]['description'] = util.testXMLValue(val)

                val = j.find(util.nspath_eval('gmx:CodeDefinition/gml32:identifier', namespaces))
                self.dictionaries[id]['entries'][id2]['identifier'] = util.testXMLValue(val)

                val = j.find(util.nspath_eval('gmx:CodeDefinition', namespaces)).attrib.get('codeSpace')
                self.dictionaries[id]['entries'][id2]['codespace'] = util.testXMLValue(val, True)
github geopython / OWSLib / owslib / dif.py View on Github external
self.data_resolution = []
        for el in md.findall(util.nspath_eval('dif:Data_Resolution', namespaces)):
            self.data_resolution.append(Data_Resolution(el))

        self.project = []
        for el in md.findall(util.nspath_eval('dif:Project', namespaces)):
            self.project.append(Name(el))

        val = md.find(util.nspath_eval('dif:Quality', namespaces))
        self.quality = util.testXMLValue(val)

        val = md.find(util.nspath_eval('dif:Access_Constraints', namespaces))
        self.access_constraints = util.testXMLValue(val)

        val = md.find(util.nspath_eval('dif:Use_Constraints', namespaces))
        self.use_constraints = util.testXMLValue(val)

        self.language = []
        for el in md.findall(util.nspath_eval('dif:Data_Set_Language', namespaces)):
            self.language.append(util.testXMLValue(el))

        self.originating_center = []
        for el in md.findall(util.nspath_eval('dif:Originating_Center', namespaces)):
            self.originating_center.append(util.testXMLValue(el))

        self.data_center = []
        for el in md.findall(util.nspath_eval('dif:Data_Center', namespaces)):         
            self.data_center.append(Data_Center(el))

        self.distribution = []
        for el in md.findall(util.nspath_eval('dif:Distribution', namespaces)):
github geopython / OWSLib / owslib / csw.py View on Github external
"""

        # construct request
        node0 = etree.Element(util.nspath_eval('csw:Harvest', namespaces))
        node0.set('version', self.version)
        node0.set('service', self.service)
        node0.set(util.nspath_eval('xsi:schemaLocation', namespaces), schema_location)
        etree.SubElement(node0, util.nspath_eval('csw:Source', namespaces)).text = source
        etree.SubElement(node0, util.nspath_eval('csw:ResourceType', namespaces)).text = resourcetype
        if resourceformat is not None:
            etree.SubElement(node0, util.nspath_eval('csw:ResourceFormat', namespaces)).text = resourceformat
        if harvestinterval is not None:
            etree.SubElement(node0, util.nspath_eval('csw:HarvestInterval', namespaces)).text = harvestinterval
        if responsehandler is not None:
            etree.SubElement(node0, util.nspath_eval('csw:ResponseHandler', namespaces)).text = responsehandler
       
        self.request = util.xml2string(etree.tostring(node0))

        self._invoke()
        self.results = {}

        if self.exceptionreport is None:
            val = self._exml.find(util.nspath_eval('csw:Acknowledgement', namespaces))
            if util.testXMLValue(val) is not None:
                ts = val.attrib.get('timeStamp')
                self.timestamp = util.testXMLValue(ts, True)
                id = val.find(util.nspath_eval('csw:RequestId', namespaces))
                self.id = util.testXMLValue(id) 
            else:
                self._parsetransactionsummary()
                self._parseinsertresult()
github geopython / OWSLib / owslib / dif.py View on Github external
val = md.find(util.nspath_eval('dif:Reference', namespaces))
        self.reference = util.testXMLValue(val)

        val = md.find(util.nspath_eval('dif:Summary', namespaces))
        self.summary = util.testXMLValue(val)

        self.related_url = []
        for el in md.findall(util.nspath_eval('dif:Related_URL', namespaces)):
            self.related_url.append(Related_URL(el))

        self.parent_dif = []
        for el in md.findall(util.nspath_eval('dif:Parent_DIF', namespaces)):
            self.parent_dif.append(util.testXMLValue(el))

        self.idn_node = []
        for el in md.findall(util.nspath_eval('dif:IDN_Node', namespaces)):
            self.idn_node.append(Name(el))

        val = md.find(util.nspath_eval('dif:Originating_Metadata_Node', namespaces))
        self.originating_metadata_node = util.testXMLValue(val)

        val = md.find(util.nspath_eval('dif:Metadata_Name', namespaces))
        self.metadata_name = util.testXMLValue(val)

        val = md.find(util.nspath_eval('dif:Metadata_Version', namespaces))
        self.metadata_version = util.testXMLValue(val)

        val = md.find(util.nspath_eval('dif:DIF_Creation_Date', namespaces))
        self.dif_creation_date = util.testXMLValue(val)

        val = md.find(util.nspath_eval('dif:Last_DIF_Revision_Date', namespaces))
        self.last_dif_revision_date = util.testXMLValue(val)
github geopython / OWSLib / owslib / gm03.py View on Github external
if val is not None:
            self.metadata = MD_Metadata(val)

        val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_RepresentativeFraction', namespaces))
        if val is not None:
            self.representative_fraction = MD_RepresentativeFraction(val)

        val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Resolution', namespaces))
        if val is not None:
            self.resolution = MD_Resolution(val)

        val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_BoundingPolygon', namespaces))
        if val is not None:
            self.bounding_polygon = EX_BoundingPolygon(val)

        val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_GeographicBoundingBox', namespaces))
        if val is not None:
            self.geographic_bounding_box = EX_GeographicBoundingBox(val)

        val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_GeographicDescription', namespaces))
        if val is not None:
            self.geographic_description = EX_GeographicDescription(val)

        val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_TemporalExtent', namespaces))
        if val is not None:
            self.temporal_extent = EX_TemporalExtent(val)

        val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_DistributiondistributionFormat', namespaces))
        if val is not None:
            self.distribution_distribution_format = MD_DistributiondistributionFormat(val)

        val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.referenceSystemInfoMD_Metadata', namespaces))
github geopython / OWSLib / owslib / gm03.py View on Github external
val = md.find(util.nspath_eval('gm03:MD_Metadata', namespaces))
        self.metadata = _GenericObjectProperty(val)

        val = md.find(util.nspath_eval('gm03:citation', namespaces))
        self.citation = _GenericObjectProperty(val)

        val = md.find(util.nspath_eval('gm03:spatialRepresentationType', namespaces))
        if val is not None:
            self.spatial_representation_type = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_SpatialRepresentationTypeCode_/gm03:value', namespaces)))

        val = md.find(util.nspath_eval('gm03:language', namespaces))
        if val is not None:
            self.language = util.testXMLValue(val.find(util.nspath_eval('gm03:CodeISO.LanguageCodeISO_/gm03:value', namespaces)))

        val = md.find(util.nspath_eval('gm03:characterSet', namespaces))
        if val is not None:
            self.character_set = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_CharacterSetCode_/gm03:value', namespaces)))

        val = md.find(util.nspath_eval('gm03:topicCategory', namespaces))
        if val is not None:
            self.topic_category = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_TopicCategoryCode_/gm03:value', namespaces)))