How to use the owslib.namespaces.Namespaces 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 / tests / test_iso_parsing.py View on Github external
def get_md_resource(file_path):
    """Read the file and parse into an XML tree.

    Parameters
    ----------
    file_path : str
        Path of the file to read.

    Returns
    -------
    etree.ElementTree
        XML tree of the resource on disk.

    """
    namespaces = Namespaces().get_namespaces(keys=('gmd', 'gmi'))

    with io.open(file_path, mode='r', encoding='utf-8') as f:
        data = f.read().encode('utf-8')
        data = etree.fromstring(data)
        mdelem = data.find('.//' + util.nspath_eval(
            'gmd:MD_Metadata', namespaces)) or data.find(
            './/' + util.nspath_eval('gmi:MI_Metadata', namespaces))

        if mdelem is None and data.tag == '{http://www.isotc211.org/2005/gmd}MD_Metadata':
            mdelem = data

    return mdelem
github ioos / compliance-checker / compliance_checker / ioos.py View on Github external
class IOOSBaseSOSCheck(BaseCheck):
    _cc_spec = "ioos_sos"
    _cc_spec_version = "0.1"
    _cc_description = (
        "IOOS Inventory Metadata checks for the Sensor Observation System (SOS). "
        "Checks SOS functions GetCapabilities and DescribeSensor."
    )
    register_checker = True
    # requires login
    _cc_url = "http://sdf.ndbc.noaa.gov/sos/"


class IOOSSOSGCCheck(BaseSOSGCCheck, IOOSBaseSOSCheck):

    # set up namespaces for XPath
    ns = Namespaces().get_namespaces(["sos", "gml", "xlink"])
    ns["ows"] = Namespaces().get_namespace("ows110")

    @check_has(BaseCheck.HIGH)
    def check_high(self, ds):
        return []

    @check_has(BaseCheck.MEDIUM)
    def check_recommended(self, ds):
        return [
            (
                "service_contact_email",
                XPath(
                    "/sos:Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:ElectronicMailAddress",
                    namespaces=self.ns,
                ),
            ),
github geopython / OWSLib / owslib / owscontext / atom.py View on Github external
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["atom", "dc", "gml", "gml32", "xlink"])
    ns.update(add_namespaces)
    ns[None] = n.get_namespace("atom")
    return ns
github geopython / OWSLib / owslib / iso_che.py View on Github external
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["gco","gmd","gml","gml32","gmx","gts","srv","xlink"])
    ns["che"] = 'http://www.geocat.ch/2008/che'
    ns[None] = n.get_namespace("gmd")
    return ns
namespaces = get_namespaces()
github geopython / OWSLib / owslib / csw.py View on Github external
def get_namespaces():
    n = Namespaces()
    return n.get_namespaces()
namespaces = get_namespaces()
github geopython / OWSLib / owslib / gm03.py View on Github external
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["gm03"])
    ns[None] = n.get_namespace("gm03")
    return ns
github geopython / OWSLib / owslib / iso.py View on Github external
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["gco","gfc","gmd","gml","gml32","gmx","gts","srv","xlink"])
    ns[None] = n.get_namespace("gmd")
    return ns
namespaces = get_namespaces()
github geopython / OWSLib / owslib / feature / wfs110.py View on Github external
def get_namespaces():
    n = Namespaces()
    return n.get_namespaces(["gmd", "gml", "gmi", "ogc","ows","wfs"])
namespaces = get_namespaces()
github geopython / OWSLib / owslib / dif.py View on Github external
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces("dif")
    ns[None] = n.get_namespace("dif")
    return ns
namespaces = get_namespaces()
github ESGF / esgf-compute-api / cwt / wps.py View on Github external
from owslib.etree import etree
from owslib.ows import DEFAULT_OWS_NAMESPACE, XLINK_NAMESPACE
from owslib.ows import ServiceIdentification, ServiceProvider, OperationsMetadata, BoundingBox
from time import sleep
from owslib.util import (testXMLValue, testXMLAttribute, build_get_url, clean_ows_url, dump, getTypedValue,
                         getNamespace, element_to_string, nspath, openURL, nspath_eval, log)
from xml.dom.minidom import parseString
from owslib.namespaces import Namespaces
try:                    # Python 3
    from urllib.parse import urlparse
except ImportError:     # Python 2
    from urlparse import urlparse

import six, traceback
# namespace definition
n = Namespaces()

# These static namespaces are DEPRECIATED.  Please don't use them.
# No great way of printing a message since there are at the file level
WPS_DEFAULT_NAMESPACE = n.get_namespace("wps")
WFS_NAMESPACE = n.get_namespace("wfs")
OGC_NAMESPACE = n.get_namespace("ogc")
GML_NAMESPACE = n.get_namespace("gml")
DRAW_NAMESPACE = n.get_namespace("draw")

GML_SCHEMA_LOCATION = "http://schemas.opengis.net/gml/3.1.1/base/feature.xsd"
DRAW_SCHEMA_LOCATION = 'http://cida.usgs.gov/climate/derivative/xsd/draw.xsd'
WFS_SCHEMA_LOCATION = 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd'
WPS_DEFAULT_SCHEMA_LOCATION = 'http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd'
WPS_DEFAULT_VERSION = '1.0.0'

# WPS execution modes