forked from PellervoK/simplewcs2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coverage.py
48 lines (32 loc) · 1.42 KB
/
coverage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
Simple WCS 2 - QGIS Plugin
Basic support for OGC WCS 2.X
created by Landesvermessung und Geobasisinformation Brandenburg
email: [email protected]
licence: GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
"""
import os.path, urllib, xml.etree.ElementTree
class Coverage:
def __init__(self, coverage):
wcs = '{http://www.opengis.net/wcs/2.0}'
gml = '{http://www.opengis.net/gml/3.2}'
gmlcov = '{http://www.opengis.net/gmlcov/1.0}'
swe = '{http://www.opengis.net/swe/2.0}'
self.coverage = coverage
envelope = self.coverage.find(wcs + 'CoverageDescription/' + gml + 'boundedBy/' + gml + 'Envelope')
if envelope is None:
envelope = self.coverage.find(wcs + 'CoverageDescription/' + gml + 'boundedBy/' + gml + 'EnvelopeWithTimePeriod')
self.axisLabels = envelope.attrib['axisLabels'].split(" ")
self.range = []
contents = self.coverage.find(wcs + 'CoverageDescription')
for field in contents.findall('.//' + gmlcov + 'rangeType/' + swe + 'DataRecord/' + swe + 'field'):
name = field.get('name')
self.range.append(name)
def getAxisLabels(self):
return self.axisLabels
def setAxisLabels(self, axisLabels):
self.axisLabels = axisLabels
def getRange(self):
return self.range
def setRange(self, range):
self.range = range