当前位置: 首页>>代码示例>>Python>>正文


Python namespaces.Namespaces类代码示例

本文整理汇总了Python中owslib.namespaces.Namespaces的典型用法代码示例。如果您正苦于以下问题:Python Namespaces类的具体用法?Python Namespaces怎么用?Python Namespaces使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Namespaces类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: patch_well_known_namespaces

def patch_well_known_namespaces(etree_module):

    from owslib.namespaces import Namespaces
    ns = Namespaces()

    """Monkey patches the etree module to add some well-known namespaces."""
    etree_module._namespace_map.update(ns.get_namespaces())
开发者ID:sbrunner,项目名称:OWSLib,代码行数:7,代码来源:etree.py

示例2: patch_well_known_namespaces

def patch_well_known_namespaces(etree_module):

    from owslib.namespaces import Namespaces
    ns = Namespaces()

    """Monkey patches the etree module to add some well-known namespaces."""
    for k,v in ns.get_namespaces().iteritems():
        etree_module.register_namespace(k, v)
开发者ID:asascience-open,项目名称:OWSLib,代码行数:8,代码来源:etree.py

示例3: get_namespaces

 def get_namespaces():
     """
     Returns specified namespaces using owslib Namespaces function.
     """
     n = Namespaces()
     ns = n.get_namespaces(
         ["gco", "gmd", "gml", "gml32", "gmx", "gts", "srv", "xlink", "dc"])
     return ns
开发者ID:kimdurante,项目名称:metadataWorkshop,代码行数:8,代码来源:update.py

示例4: get_namespaces_io100

def get_namespaces_io100():
    n = Namespaces()
    ns = n.get_namespaces(["ogc","swes","sml","xlink","xsi"])
    ns["ows"] = n.get_namespace("ows110")
    ns["sos"] = n.get_namespace("sos20")
    ns["gml"] = n.get_namespace("gml32")
    ns["om"] = n.get_namespace("om20")
    ns['swe'] = 'http://www.opengis.net/swe/2.0'
    ns["sams"] = "http://www.opengis.net/samplingSpatial/2.0"
    ns["sf"] = "http://www.opengis.net/sampling/2.0"
    return ns
开发者ID:ABasoni,项目名称:starterkit,代码行数:11,代码来源:extension_sos200.py

示例5: patch_well_known_namespaces

def patch_well_known_namespaces(etree_module):

    import warnings
    from owslib.namespaces import Namespaces
    ns = Namespaces()

    """Monkey patches the etree module to add some well-known namespaces."""

    try:
        register_namespace = etree_module.register_namespace
    except AttributeError:
        try:
            etree_module._namespace_map

            def register_namespace(prefix, uri):
                etree_module._namespace_map[uri] = prefix
        except AttributeError:
            def register_namespace(prefix, uri):
                pass
            warnings.warn("Only 'lxml.etree' >= 2.3 and 'xml.etree.ElementTree' >= 1.3 are fully supported!")

    for k, v in ns.get_namespaces().iteritems():
        register_namespace(k, v)
开发者ID:ACorradini,项目名称:QGIS,代码行数:23,代码来源:etree.py

示例6: add_namespaces

def add_namespaces(root, ns_keys):
    if isinstance(ns_keys, six.string_types):
        ns_keys = [ns_keys]

    namespaces = Namespaces()

    ns_keys = [(x, namespaces.get_namespace(x)) for x in ns_keys]

    if etree.__name__ != 'lxml.etree':
        # We can just add more namespaces when not using lxml.
        # We can't re-add an existing namespaces.  Get a list of current
        # namespaces in use
        existing_namespaces = set()
        for elem in root.getiterator():
            if elem.tag[0] == "{":
                uri, tag = elem.tag[1:].split("}")
                existing_namespaces.add(namespaces.get_namespace_from_url(uri))
        for key, link in ns_keys:
            if link is not None and key not in existing_namespaces:
                root.set("xmlns:%s" % key, link)
        return root
    else:
        # lxml does not support setting xmlns attributes
        # Update the elements nsmap with new namespaces
        new_map = root.nsmap
        for key, link in ns_keys:
            if link is not None:
                new_map[key] = link
        # Recreate the root element with updated nsmap
        new_root = etree.Element(root.tag, nsmap=new_map)
        # Carry over attributes
        for a, v in list(root.items()):
            new_root.set(a, v)
        # Carry over children
        for child in root:
            new_root.append(deepcopy(child))
        return new_root
开发者ID:,项目名称:,代码行数:37,代码来源:

示例7: Namespaces

from __future__ import absolute_import, division, print_function

from owslib.namespaces import Namespaces

from pyoos.utils.etree import ElementType, etree

ns = Namespaces()
SML_NS = ns.get_versioned_namespace("sml", "1.0.1")
SWE_NS = [ns.get_versioned_namespace("swe", "1.0.1")]


class IoosDescribeSensor(object):
    def __new__(cls, element):
        if isinstance(element, ElementType):
            root = element
        else:
            root = etree.fromstring(element)

        sml_str = ".//{{{0}}}identifier/{{{0}}}Term[@definition='http://mmisw.org/ont/ioos/definition/%s']".format(
            SML_NS
        )

        if hasattr(root, "getroot"):
            root = root.getroot()

        # Circular dependencies are bad. consider a reorganization
        # find the the proper type for the DescribeSensor.
        from pyoos.parsers.ioos.one.describe_sensor import (
            NetworkDS,
            StationDS,
            SensorDS,
开发者ID:ioos,项目名称:pyoos,代码行数:31,代码来源:describe_sensor.py

示例8: get_namespaces

def get_namespaces():
    ns = Namespaces()
    return ns.get_namespaces(["swe20"])
开发者ID:DanielJMaher,项目名称:pyoos,代码行数:3,代码来源:timeseries.py

示例9: get_namespaces

def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["gm03"])
    ns[None] = n.get_namespace("gm03")
    return ns
开发者ID:Gustry,项目名称:QGIS,代码行数:5,代码来源:gm03.py

示例10: Common

"""
API for OGC Web Services Common (OWS) constructs and metadata.

OWS Common: http://www.opengeospatial.org/standards/common

Currently supports version 1.1.0 (06-121r3).
"""

from __future__ import absolute_import, division, print_function

from owslib.etree import etree
from owslib import crs, util
from owslib.namespaces import Namespaces

n = Namespaces()

OWS_NAMESPACE_1_0_0 = n.get_namespace("ows")
OWS_NAMESPACE_1_1_0 = n.get_namespace("ows110")
OWS_NAMESPACE_2_0 = n.get_namespace("ows200")
XSI_NAMESPACE = n.get_namespace("xsi")
XLINK_NAMESPACE = n.get_namespace("xlink")

DEFAULT_OWS_NAMESPACE = OWS_NAMESPACE_1_1_0  # Use this as default for OWSCommon objects


class OwsCommon(object):
    """Initialize OWS Common object"""

    def __init__(self, version):
        self.version = version
开发者ID:bird-house,项目名称:OWSLib,代码行数:30,代码来源:ows.py

示例11: get_namespaces

def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces("dif")
    ns[None] = n.get_namespace("dif")
    return ns
开发者ID:ACorradini,项目名称:QGIS,代码行数:5,代码来源:dif.py

示例12: get_namespaces

def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["dif","fes","gml","ogc","xs","xsi"])
    ns[None] = n.get_namespace("ogc")
    return ns
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:5,代码来源:fes.py

示例13: get_namespaces

def get_namespaces():
    n = Namespaces()
    return n.get_namespaces(["sml101", "gml", "xlink", "swe101"])
开发者ID:emiliom,项目名称:pyoos,代码行数:3,代码来源:describe_sensor.py

示例14: import

import warnings
import six
from owslib.etree import etree
from owslib.util import (openURL, ServiceException, testXMLValue,
                         extract_xml_list, xmltag_split, OrderedDict, nspath,
                         bind_url)
from owslib.util import nspath
from owslib.fgdc import Metadata
from owslib.iso import MD_Metadata
from owslib.crs import Crs
from owslib.namespaces import Namespaces
from owslib.map.common import WMSCapabilitiesReader

from owslib.util import log

n = Namespaces()
WMS_NAMESPACE = n.get_namespace("wms")
OGC_NAMESPACE = n.get_namespace('ogc')


class WebMapService_1_3_0(object):

    def __getitem__(self, name):
        ''' check contents dictionary to allow dict
        like access to service layers
        '''
        if name in self.__getattribute__('contents'):
            return self.__getattribute__('contents')[name]
        else:
            raise KeyError("No content named %s" % name)
开发者ID:KeyproOy,项目名称:OWSLib,代码行数:30,代码来源:wms130.py

示例15: get_namespaces

def get_namespaces():
    n = Namespaces()
    return n.get_namespaces()
开发者ID:Jonathankaoma,项目名称:QGIS,代码行数:3,代码来源:csw.py


注:本文中的owslib.namespaces.Namespaces类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。