コード例 #1
0
ファイル: wfsfilter.py プロジェクト: marisn/gislab-web
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["ogc"])
    ns[None] = n.get_namespace("ogc")
    return ns
コード例 #2
0
ファイル: dif.py プロジェクト: bgisb/gis-support-plugin
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces("dif")
    ns[None] = n.get_namespace("dif")
    return ns
コード例 #3
0
def get_namespaces():
    n = Namespaces()
    return n.get_namespaces()
コード例 #4
0
from owslib.namespaces import Namespaces
from owslib.etree import etree
from owslib.util import openURL, testXMLValue, nspath_eval, xmltag_split, dict_union, extract_xml_list

nsmap = Namespaces().get_namespaces()


def SOSElement(tag, nsmap=nsmap):
    t = etree.QName(nsmap['sos'], tag)
    return etree.Element(t, nsmap=nsmap)


def OMElement(tag, nsmap=nsmap):
    t = etree.QName(nsmap['om'], tag)
    return etree.Element(t, nsmap=nsmap)


def SWEElement(tag, nsmap=nsmap):
    t = etree.QName(nsmap['swe'], tag)
    return etree.Element(t, nsmap=nsmap)


def GMLElement(tag, nsmap=nsmap):
    t = etree.QName(nsmap['gml'], tag)
    return etree.Element(t, nsmap=nsmap)
コード例 #5
0
ファイル: api.py プロジェクト: IREA-CNR-MI/TELLme-Hub
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.utils.safestring import mark_safe
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView, DeleteView

from geosk.skregistration.views import get_key
from geosk.skregistration.models import SkRegistration
from geonode.utils import http_client, _get_basic_auth_info, json_response
from geosk.osk.models import Sensor
from geosk import UnregisteredSKException

namespaces = Namespaces().get_namespaces('ows110')


def lastediml(request):
    s = Sensor.objects.order_by('-id').all()[0]
    return HttpResponse(s.ediml, mimetype='application/xml')


def lastsensorml(request):
    s = Sensor.objects.order_by('-id').all()[0]
    return HttpResponse(s.sensorml, mimetype='application/xml')


class UploadView(TemplateView):
    template_name = 'osk/osk_upload.html'
コード例 #6
0
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["ogc", "sml", "gml", "sos", "swe", "xlink"])
    ns["ows"] = n.get_namespace("ows110")
    return ns
コード例 #7
0
ファイル: wfs200.py プロジェクト: blockspacer/Qgis_TST
from owslib.etree import etree
from owslib.util import nspath, testXMLValue
from owslib.crs import Crs
from owslib.feature import WebFeatureService_
from owslib.namespaces import Namespaces

#other imports
import cgi
from cStringIO import StringIO
from urllib import urlencode
from urllib2 import urlopen

import logging
from owslib.util import log

n = Namespaces()
WFS_NAMESPACE = n.get_namespace("wfs20")
OWS_NAMESPACE = n.get_namespace("ows110")
OGC_NAMESPACE = n.get_namespace("ogc")
GML_NAMESPACE = n.get_namespace("gml")
FES_NAMESPACE = n.get_namespace("fes")


class ServiceException(Exception):
    pass


class WebFeatureService_2_0_0(WebFeatureService_):
    """Abstraction for OGC Web Feature Service (WFS).

    Implements IWebFeatureService.
コード例 #8
0
def get_namespaces():
    n = Namespaces()
    namespaces = n.get_namespaces(["sml", "gml", "xlink"])
    namespaces["ism"] = "urn:us:gov:ic:ism:v2"
    return namespaces
コード例 #9
0
ファイル: get_observation.py プロジェクト: jameshgrn/pyoos
def get_namespaces():
    ns = Namespaces()
    return ns.get_namespaces(["om10", "swe101", "swe20", "gml311", "xlink"])
コード例 #10
0
def get_namespaces():
    n = Namespaces()
    return n.get_namespaces(["gml", "ogc", "ows", "wfs"])
コード例 #11
0
ファイル: ioos.py プロジェクト: haytastan/compliance-checker
class IOOSSOSDSCheck(BaseSOSDSCheck, IOOSBaseSOSCheck):

    # set up namespaces for XPath
    ns = Namespaces().get_namespaces(['sml', 'swe', 'gml', 'xlink'])

    @check_has(BaseCheck.HIGH)
    def check_high(self, ds):
        return [
            ('platform_sponsor',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:classification/sml:ClassifierList/sml:classifier[@name='sponsor']/sml:Term/sml:value",
                 namespaces=self.ns)),
            ('platform_type',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:classification/sml:ClassifierList/sml:classifier[@name='platformType']/sml:Term/sml:value",
                 namespaces=self.ns)),
            ('station_publisher_name',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:contact/sml:ContactList/sml:member[@xlink:role='http://mmisw.org/ont/ioos/definition/publisher']/sml:ResponsibleParty/sml:organizationName",
                 namespaces=self.ns)),
            ('station_publisher_email',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:contact/sml:ContactList/sml:member[@xlink:role='http://mmisw.org/ont/ioos/definition/publisher']/sml:ResponsibleParty/sml:contactInfo/address/sml:electronicMailAddress",
                 namespaces=self.ns)),
            ('station_id',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:identification/sml:IdentifierList/sml:identifier[@name='stationID']/sml:Term/sml:value",
                 namespaces=self.ns)),
            ('station_long_name',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:identification/sml:IdentifierList/sml:identifier[@name='longName']/sml:Term/sml:value",
                 namespaces=self.ns)),
            ('station_short_name',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:identification/sml:IdentifierList/sml:identifier[@name='shortName']/sml:Term/sml:value",
                 namespaces=self.ns)),
            ('station_wmo_id',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:identification/sml:IdentifierList/sml:identifier/sml:Term[@definition=\"http://mmisw.org/ont/ioos/definition/wmoID\"]/sml:value",
                 namespaces=self.ns)),
            ('time_period',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:capabilities[@name='observationTimeRange']/swe:DataRecord/swe:field[@name='observationTimeRange']/swe:TimeRange/swe:value",
                 namespaces=self.ns)),
            ('operator_email',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:contact/sml:ContactList/sml:member[@xlink:role='http://mmisw.org/ont/ioos/definition/operator']/sml:ResponsibleParty/sml:contactInfo/address/sml:electronicMailAddress",
                 namespaces=self.ns)),
            ('operator_name',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:contact/sml:ContactList/sml:member[@xlink:role='http://mmisw.org/ont/ioos/definition/operator']/sml:ResponsibleParty/sml:organizationName",
                 namespaces=self.ns)),
            ('station_description',
             XPath("/sml:SensorML/sml:member/sml:System/gml:description",
                   namespaces=self.ns)),
            # replaced with lon/lat with point
            ('station_location_point',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:location/gml:Point/gml:pos",
                 namespaces=self.ns))
        ]

    @check_has(BaseCheck.MEDIUM)
    def check_recommended(self, ds):
        return [
            ('sensor_descriptions',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/sml:System/gml:description",
                 namespaces=self.ns)),
            ('sensor_ids',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/sml:System/@gml:id",
                 namespaces=self.ns)),
            ('sensor_names',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/@name",
                 namespaces=self.ns)),
            ('data_format_template_version',
             XPath(
                 "/sml:SensorML/sml:capabilities/swe:SimpleDataRecord/swe:field[@name='ioosTemplateVersion']/swe:Text/swe:value",
                 namespaces=self.ns)),
            ('variable_names',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/sml:System/sml:outputs/sml:OutputList/sml:output/swe:Quantity/@definition",
                 namespaces=self.ns)),
            ('variable_units',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/sml:System/sml:outputs/sml:OutputList/sml:output/swe:Quantity/swe:uom/@code",
                 namespaces=self.ns)),
            ('network_id',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:capabilities[@name='networkProcedures']/swe:SimpleDataRecord/gml:metaDataProperty/@xlink:href",
                 namespaces=self.ns)),
            ('operator_sector',
             XPath(
                 "/sml:SensorML/sml:member/sml:System/sml:classification/sml:ClassifierList/sml:classifier[@name='operatorSector']/sml:Term/sml:value",
                 namespaces=self.ns)),
        ]

    @check_has(BaseCheck.LOW)
    def check_suggested(self, ds):
        return []
コード例 #12
0
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["gco","gmd","gml","gml32","gmx","gts","srv","xlink"])
    ns[None] = n.get_namespace("gmd")
    return ns
コード例 #13
0
ファイル: fes.py プロジェクト: zhangmingda/OWSLib
def get_namespaces():
    n = Namespaces()
    ns = n.get_namespaces(["dif", "fes", "gml", "ogc", "xs", "xsi"])
    ns[None] = n.get_namespace("ogc")
    return ns
コード例 #14
0
ファイル: describe_sensor.py プロジェクト: jameshgrn/pyoos
def get_namespaces():
    n = Namespaces()
    return n.get_namespaces(["sml101", "gml", "xlink", "swe101"])
コード例 #15
0
from owslib.util import nspath as nsp
from owslib.util import nspath_eval as nspv
from owslib.namespaces import Namespaces
from owslib.util import testXMLAttribute, testXMLValue
from owslib.crs import Crs
import csv
import StringIO
import copy

ns = Namespaces()


def get_field_object(element, swe_ns):

    field_tag = nsp("field", swe_ns)
    data_choice_tag = nsp("DataChoice", swe_ns)

    if element.tag == field_tag:
        name = testXMLAttribute(element, "name")
        if name == "location":
            return SweVector(element.find(nsp("Vector", swe_ns)), swe_ns)
        elif name == "time":
            return SweTime(element.find(nsp("Time", swe_ns)), swe_ns)
        else:
            return SweField(element, swe_ns)
    elif element.tag == data_choice_tag:
        return SweDataChoice(element, swe_ns)
    else:
        return None