Mercurial > gemma
annotate pkg/wfs/capabilities.go @ 1665:da0d1a19ebe6
Fairway availability import: Made schedulable, too.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 23 Dec 2018 13:30:33 +0100 |
parents | efc409e330a6 |
children | 2dc7768be0e4 |
rev | line source |
---|---|
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 // This is Free Software under GNU Affero General Public License v >= 3.0 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 // without warranty, see README.md and license for details. |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 // |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 // SPDX-License-Identifier: AGPL-3.0-or-later |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 // License-Filename: LICENSES/AGPL-3.0.txt |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 // |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 // Copyright (C) 2018 by via donau |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 // – Österreichische Wasserstraßen-Gesellschaft mbH |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 // Software engineering by Intevation GmbH |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 // |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 // Author(s): |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de> |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 package wfs |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import ( |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 "encoding/xml" |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 "io" |
1608
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
19 "regexp" |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
20 "strconv" |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 "golang.org/x/net/html/charset" |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 ) |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
1600
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
25 type Keyword struct { |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
26 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 Keyword"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
27 Value string `xml:",cdata"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
28 } |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
29 type Keywords struct { |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
30 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 Keywords"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
31 Keywords []Keyword `xml:"Keyword"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
32 } |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
33 |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 type ServiceIdentification struct { |
1600
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
35 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 ServiceIdentification"` |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 Title string |
1600
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
37 Abstract string |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
38 Keywords Keywords `xml:"Keywords"` |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 ServiceType string |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 ServiceTypeVersion string |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 type Get struct { |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 Get"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 HRef string `xml:"http://www.w3.org/1999/xlink href,attr"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 type Post struct { |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 Post"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 HRef string `xml:"http://www.w3.org/1999/xlink href,attr"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 type HTTP struct { |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 HTTP"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 Get *Get `xml:"Get"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 Post *Post `xml:"Post"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 type DCP struct { |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 DCP"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 HTTP HTTP `xml:"HTTP"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 |
1599
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
64 type Value struct { |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 Value"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 Value string `xml:",cdata"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 type AllowedValues struct { |
1599
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
70 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 AllowedValues"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
71 Values []Value `xml:"Value"` |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 type Parameter struct { |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 Parameter"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 Name string `xml:"name,attr"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 AllowedValues AllowedValues `xml:"AllowedValues"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 |
1599
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
80 type DefaultValue struct { |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
81 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 DefaultValue"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
82 Value string `xml:",cdata"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
83 } |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
84 |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
85 type Constraint struct { |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
86 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 Constraint"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
87 Name string `xml:"name,attr"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
88 AllowedValues AllowedValues `xml:"AllowedValues"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
89 DefaultValue *DefaultValue `xml:"DefaultValue"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
90 } |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
91 |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 type Operation struct { |
1599
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
93 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 Operation"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
94 Name string `xml:"name,attr"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
95 DCP DCP `xml:"DCP"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
96 Parameters []*Parameter `xml:"Parameter"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
97 Constraints []*Constraint `xml:"Constraint"` |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 type OperationsMetadata struct { |
1599
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
101 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 OperationsMetadata"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
102 Operations []*Operation `xml:"Operation"` |
5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1596
diff
changeset
|
103 Constraints []*Constraint `xml:"Constraint"` |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 |
1600
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
106 type WGS84BoundingBox struct { |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
107 XMLName xml.Name `xml:"http://www.opengis.net/ows/1.1 WGS84BoundingBox"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
108 LowerCorner string `xml:"LowerCorner"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
109 UpperCorner string `xml:"UpperCorner"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
110 } |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
111 |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
112 type FeatureType struct { |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
113 XMLName xml.Name `xml:"http://www.opengis.net/wfs/2.0 FeatureType"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
114 Name string `xml:"Name"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
115 Title string `xml:"Title"` |
1602
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
116 Abstract string `xml:"Abstract"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
117 Keywords Keywords `xml:"Keywords"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
118 DefaultCRS string `xml:"DefaultCRS"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
119 OtherCRSs []string `xml:"OtherCRS"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
120 WGS84BoundingBox *WGS84BoundingBox `xml:"WGS84BoundingBox"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
121 Namespaces []xml.Name `xml:"-"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
122 } |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
123 |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
124 // shadowFeatureType is used to prevent recursive UnmarshalXML for FeatureType. |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
125 type shadowFeatureType struct { |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
126 XMLName xml.Name `xml:"http://www.opengis.net/wfs/2.0 FeatureType"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
127 Name string `xml:"Name"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
128 Title string `xml:"Title"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
129 Abstract string `xml:"Abstract"` |
1600
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
130 Keywords Keywords `xml:"Keywords"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
131 DefaultCRS string `xml:"DefaultCRS"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
132 OtherCRSs []string `xml:"OtherCRS"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
133 WGS84BoundingBox *WGS84BoundingBox `xml:"WGS84BoundingBox"` |
1602
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
134 Namespaces []xml.Name `xml:"-"` |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
135 } |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
136 |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
137 func (ft *FeatureType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
138 // Filter out the namespaces for this feature type. |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
139 var ns []xml.Name |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
140 for _, attr := range start.Attr { |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
141 if attr.Name.Space == "xmlns" { |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
142 ns = append(ns, xml.Name{Space: attr.Name.Local, Local: attr.Value}) |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
143 } |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
144 } |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
145 var sft shadowFeatureType |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
146 if err := d.DecodeElement(&sft, &start); err != nil { |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
147 return err |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
148 } |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
149 *ft = FeatureType(sft) |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
150 ft.Namespaces = ns |
e80e35b26f17
WFS Capabilities parser: Wrote a custom xml.Unmarshaler to extract the namespaces of FeatureTypes, too. They are needed in GetFeature requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1600
diff
changeset
|
151 return nil |
1600
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
152 } |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
153 |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
154 type FeatureTypeList struct { |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
155 XMLName xml.Name `xml:"http://www.opengis.net/wfs/2.0 FeatureTypeList"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
156 FeatureTypes []*FeatureType `xml:"FeatureType"` |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
157 } |
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
158 |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 type Capabilities struct { |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 XMLName xml.Name `xml:"http://www.opengis.net/wfs/2.0 WFS_Capabilities"` |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 |
1608
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
162 BaseURL string `xml:"-"` |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
163 |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 ServiceIdentification ServiceIdentification |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 OperationsMetadata OperationsMetadata |
1600
658c1ebc1707
WFS Capabilities parser: Parse FeatureTypeList, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1599
diff
changeset
|
166 FeatureTypeList FeatureTypeList |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
167 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
168 |
1608
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
169 func (c *Capabilities) FindOperation(name string) *Operation { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
170 for _, op := range c.OperationsMetadata.Operations { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
171 if op.Name == name { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
172 return op |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
173 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
174 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
175 return nil |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
176 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
177 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
178 func (o *Operation) SupportsHits() bool { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
179 for _, p := range o.Parameters { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
180 if p.Name == "resultType" { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
181 for _, av := range p.AllowedValues.Values { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
182 if av.Value == "hits" { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
183 return true |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
184 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
185 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
186 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
187 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
188 return false |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
189 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
190 |
1614
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
191 func (o *Operation) SupportsOutputFormat(formats ...string) bool { |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
192 for _, p := range o.Parameters { |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
193 if p.Name == "outputFormat" { |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
194 for _, av := range p.AllowedValues.Values { |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
195 for _, f := range formats { |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
196 if av.Value == f { |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
197 return true |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
198 } |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
199 } |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
200 } |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
201 } |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
202 } |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
203 return false |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
204 } |
efc409e330a6
WFS downloader: Propagate namespaces of feature type into GetFeature request.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1608
diff
changeset
|
205 |
1608
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
206 func (o *Operation) FeaturesPerPage() (int, bool) { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
207 for _, c := range o.Constraints { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
208 if c.Name == "CountDefault" { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
209 if c.DefaultValue != nil { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
210 if v, err := strconv.Atoi(c.DefaultValue.Value); err == nil { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
211 return v, true |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
212 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
213 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
214 for _, av := range c.AllowedValues.Values { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
215 if v, err := strconv.Atoi(av.Value); err == nil { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
216 return v, true |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
217 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
218 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
219 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
220 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
221 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
222 return 0, false |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
223 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
224 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
225 func (c *Capabilities) FindFeatureType(name string) *FeatureType { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
226 for _, ft := range c.FeatureTypeList.FeatureTypes { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
227 if ft.Name == name { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
228 return ft |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
229 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
230 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
231 return nil |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
232 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
233 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
234 func (op *Operation) FindParameter(name string) *Parameter { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
235 for _, p := range op.Parameters { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
236 if p.Name == name { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
237 return p |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
238 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
239 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
240 return nil |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
241 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
242 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
243 const WFS2_0_0 = "2.0.0" |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
244 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
245 var versionRe = regexp.MustCompile(`(\d+)\.(\d+)\.(\d+)`) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
246 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
247 func versionIsLess(a, b string) bool { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
248 am := versionRe.FindStringSubmatch(a) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
249 bm := versionRe.FindStringSubmatch(b) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
250 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
251 var n int |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
252 if len(am) < len(bm) { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
253 n = len(am) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
254 } else { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
255 n = len(bm) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
256 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
257 n-- |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
258 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
259 for i := 0; i < n; i++ { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
260 ai, _ := strconv.Atoi(am[i+1]) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
261 bi, _ := strconv.Atoi(bm[i+1]) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
262 switch { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
263 case ai < bi: |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
264 return true |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
265 case ai > bi: |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
266 return false |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
267 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
268 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
269 return false |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
270 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
271 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
272 func maxVersion(a, b string) string { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
273 am := versionRe.FindStringSubmatch(a) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
274 bm := versionRe.FindStringSubmatch(b) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
275 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
276 var n int |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
277 if len(am) < len(bm) { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
278 n = len(am) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
279 } else { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
280 n = len(bm) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
281 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
282 n-- |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
283 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
284 for i := 0; i < n; i++ { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
285 ai, _ := strconv.Atoi(am[i+1]) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
286 bi, _ := strconv.Atoi(bm[i+1]) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
287 switch { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
288 case ai > bi: |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
289 return a |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
290 case bi > ai: |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
291 return b |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
292 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
293 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
294 return a |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
295 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
296 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
297 func (c *Capabilities) HighestWFSVersion(def string) string { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
298 op := c.FindOperation("GetCapabilities") |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
299 if op == nil { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
300 return def |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
301 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
302 p := op.FindParameter("AcceptVersions") |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
303 if p == nil { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
304 return def |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
305 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
306 if len(p.AllowedValues.Values) == 0 { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
307 return def |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
308 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
309 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
310 max := p.AllowedValues.Values[0].Value |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
311 for _, v := range p.AllowedValues.Values[1:] { |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
312 max = maxVersion(max, v.Value) |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
313 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
314 |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
315 return max |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
316 } |
427f9010b4a9
WFS download: Started with GET downloader (paged and unpaged).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1602
diff
changeset
|
317 |
1596
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
318 func ParseCapabilities(r io.Reader) (*Capabilities, error) { |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
319 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
320 decoder := xml.NewDecoder(r) |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
321 decoder.CharsetReader = charset.NewReaderLabel |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
322 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
323 var capabilities Capabilities |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
324 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
325 if err := decoder.Decode(&capabilities); err != nil { |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
326 return nil, err |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
327 } |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
328 |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
329 return &capabilities, nil |
74413d52c439
Started with WFS Capabilities parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
330 } |