Skip to content

Commit a2b6f86

Browse files
authored
Merge pull request #49 from PDOK/1.x
1.x
2 parents e4e0232 + 6402df1 commit a2b6f86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1033
-698
lines changed

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
name: Run on Ubuntu
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Clone the code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Running Tests
21+
run: |
22+
go mod tidy
23+
go test ./... -covermode=atomic

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/pdok/ogc-specifications
22

3-
go 1.16
3+
go 1.24
44

5-
require gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
5+
require gopkg.in/yaml.v3 v3.0.1

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+
22
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
33
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
44
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
5+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
6+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

pkg/common/exception.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package common
2+
3+
type ExceptionDetails struct {
4+
ExceptionText string `xml:",chardata" yaml:"exception"`
5+
ExceptionCode string `xml:"code,attr" yaml:"exceptionCode"`
6+
LocatorCode string `xml:"locator,attr,omitempty" yaml:"locatorCode"`
7+
}

pkg/wcs201/capabilities.go

Lines changed: 86 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,87 +12,121 @@ func (c *Capabilities) ParseYAML(doc []byte) error {
1212

1313
// Capabilities struct
1414
type Capabilities struct {
15-
OperationsMetadata OperationsMetadata `xml:"ows:OperationsMetadata" yaml:"operationsmetadata"`
16-
ServiceMetadata ServiceMetadata `xml:"wcs:ServiceMetadata" yaml:"servicemetadata"`
15+
OperationsMetadata OperationsMetadata `xml:"ows:OperationsMetadata" yaml:"operationsMetadata"`
16+
ServiceMetadata ServiceMetadata `xml:"wcs:ServiceMetadata" yaml:"serviceMetadata"`
1717
Contents Contents `xml:"wcs:Contents" yaml:"contents"`
1818
}
1919

2020
// OperationsMetadata struct for the WCS 2.0.1
2121
type OperationsMetadata struct {
2222
Operation []Operation `xml:"ows:Operation" yaml:"operation"`
23-
ExtendedCapabilities *ExtendedCapabilities `xml:"ows:ExtendedCapabilities" yaml:"extendedcapabilities"`
23+
ExtendedCapabilities *ExtendedCapabilities `xml:"ows:ExtendedCapabilities" yaml:"extendedCapabilities"`
2424
}
2525

2626
// Operation in struct for repeatability
2727
type Operation struct {
2828
Name string `xml:"name,attr" yaml:"name"`
29-
DCP struct {
30-
HTTP struct {
31-
Get struct {
32-
Type string `xml:"xlink:type,attr" yaml:"type"`
33-
Href string `xml:"xlink:href,attr" yaml:"href"`
34-
} `xml:"ows:Get" yaml:"get"`
35-
Post *Post `xml:"ows:Post" yaml:"post"`
36-
} `xml:"ows:HTTP" yaml:"http"`
37-
} `xml:"ows:DCP" yaml:"dcp"`
29+
DCP DCP `xml:"ows:DCP" yaml:"dcp"`
30+
}
31+
32+
// DCP struct for the WCS 2.0.1
33+
type DCP struct {
34+
HTTP HTTP `xml:"ows:HTTP" yaml:"http"`
35+
}
36+
37+
// HTTP struct for the WCS 2.0.1
38+
type HTTP struct {
39+
Get Get `xml:"ows:Get" yaml:"get"`
40+
Post *Post `xml:"ows:Post" yaml:"post"`
41+
}
42+
43+
// Get struct for the WCS 2.0.1
44+
type Get struct {
45+
Type string `xml:"xlink:type,attr" yaml:"type"`
46+
Href string `xml:"xlink:href,attr" yaml:"href"`
3847
}
3948

4049
// Post in separated struct so to use it as a Pointer
4150
type Post struct {
42-
Type string `xml:"xlink:type,attr" yaml:"type"`
43-
Href string `xml:"xlink:href,attr" yaml:"href"`
44-
Constraint struct {
45-
Name string `xml:"name,attr" yaml:"name"`
46-
AllowedValues struct {
47-
Value []string `xml:"ows:Value" yaml:"value"`
48-
} `xml:"ows:AllowedValues" yaml:"allowedvalues"`
49-
} `xml:"ows:Constraint" yaml:"constraint"`
51+
Type string `xml:"xlink:type,attr" yaml:"type"`
52+
Href string `xml:"xlink:href,attr" yaml:"href"`
53+
Constraint Constraint `xml:"ows:Constraint" yaml:"constraint"`
54+
}
55+
56+
// Constraint struct for the WCS 2.0.1
57+
type Constraint struct {
58+
Name string `xml:"name,attr" yaml:"name"`
59+
AllowedValues AllowedValues `xml:"ows:AllowedValues" yaml:"allowedValues"`
60+
}
61+
62+
// AllowedValues struct for the WCS 2.0.1
63+
type AllowedValues struct {
64+
Value []string `xml:"ows:Value" yaml:"value"`
5065
}
5166

5267
// ExtendedCapabilities struct for the WCS 2.0.1
5368
type ExtendedCapabilities struct {
54-
ExtendedCapabilities struct {
55-
MetadataURL struct {
56-
URL string `xml:"inspire_common:URL"`
57-
MediaType string `xml:"inspire_common:MediaType"`
58-
} `xml:"inspire_common:MetadataUrl"`
59-
SupportedLanguages struct {
60-
DefaultLanguage struct {
61-
Language string `xml:"inspire_common:Language"`
62-
} `xml:"inspire_common:DefaultLanguage"`
63-
SupportedLanguage *[]struct {
64-
Language string `xml:"inspire_common:Language" yaml:"language"`
65-
} `xml:"inspire_common:SupportedLanguage" yaml:"supportedlanguage"`
66-
} `xml:"inspire_common:SupportedLanguages"`
67-
ResponseLanguage struct {
68-
Language string `xml:"inspire_common:Language"`
69-
} `xml:"inspire_common:ResponseLanguage"`
70-
SpatialDataSetIdentifier struct {
71-
Code string `xml:"Code"`
72-
} `xml:"inspire_dls:SpatialDataSetIdentifier"`
73-
} `xml:"inspire_dls:ExtendedCapabilities"`
69+
ExtendedCapabilities NestedExtendedCapabilities `xml:"inspire_dls:ExtendedCapabilities" yaml:"extendedCapabilities"`
70+
}
71+
72+
// NestedExtendedCapabilities struct for the WCS 2.0.1
73+
type NestedExtendedCapabilities struct {
74+
MetadataURL MetadataURL `xml:"inspire_common:MetadataUrl"`
75+
ResponseLanguage Language `xml:"inspire_common:ResponseLanguage" yaml:"responseLanguage"`
76+
SpatialDataSetIdentifier SpatialDataSetIdentifier `xml:"inspire_dls:SpatialDataSetIdentifier" yaml:"spatialDataSetIdentifier"`
77+
}
78+
79+
// MetadataURL struct { struct for the WCS 2.0.1
80+
type MetadataURL struct {
81+
URL string `xml:"inspire_common:URL" yaml:"url"`
82+
MediaType string `xml:"inspire_common:MediaType" yaml:"mediaType"`
83+
}
84+
85+
// SupportedLanguages struct for the struct for the WCS 2.0.1
86+
type SupportedLanguages struct {
87+
DefaultLanguage Language `xml:"inspire_common:DefaultLanguage" yaml:"defaultLanguage"`
88+
SupportedLanguage *[]Language `xml:"inspire_common:SupportedLanguage" yaml:"supportedLanguage"`
89+
}
90+
91+
// Language struct for the WCS 2.0.1
92+
type Language struct {
93+
Language string `xml:"inspire_common:Language" yaml:"language"`
94+
}
95+
96+
// SpatialDataSetIdentifier struct for the WCS 2.0.1
97+
type SpatialDataSetIdentifier struct {
98+
Code string `xml:"Code" yaml:"code"`
7499
}
75100

76101
// ServiceMetadata struct for the WCS 2.0.1
77102
type ServiceMetadata struct {
78-
FormatSupported []string `xml:"wcs:formatSupported"`
79-
Extension struct {
80-
InterpolationMetadata struct {
81-
InterpolationSupported []string `xml:"int:InterpolationSupported"`
82-
} `xml:"int:InterpolationMetadata"`
83-
CrsMetadata struct {
84-
CrsSupported []string `xml:"crs:crsSupported"`
85-
} `xml:"crs:CrsMetadata"`
86-
} `xml:"wcs:Extension"`
103+
FormatSupported []string `xml:"wcs:formatSupported" yaml:"formatSupported"`
104+
Extension Extension `xml:"wcs:Extension" yaml:"extension"`
105+
}
106+
107+
// Extension struct for the WCS 2.0.1
108+
type Extension struct {
109+
InterpolationMetadata InterpolationMetadata `xml:"int:InterpolationMetadata" yaml:"interpolationMetadata"`
110+
CrsMetadata CrsMetadata `xml:"crs:CrsMetadata" yaml:"crsMetadata"`
111+
}
112+
113+
// InterpolationMetadata struct for the WCS 2.0.1
114+
type InterpolationMetadata struct {
115+
InterpolationSupported []string `xml:"int:InterpolationSupported" yaml:"interpolationSupported"`
116+
}
117+
118+
// CrsMetadata struct for the WCS 2.0.1
119+
type CrsMetadata struct {
120+
CrsSupported []string `xml:"crs:crsSupported" yaml:"crsSupported"`
87121
}
88122

89123
// Contents in struct for repeatability
90124
type Contents struct {
91-
CoverageSummary []CoverageSummary `xml:"wcs:CoverageSummary"`
125+
CoverageSummary []CoverageSummary `xml:"wcs:CoverageSummary" yaml:"coverageSummary"`
92126
}
93127

94128
// CoverageSummary in struct for repeatability
95129
type CoverageSummary struct {
96-
CoverageID string `xml:"wcs:CoverageId"`
97-
CoverageSubtype string `xml:"wcs:CoverageSubtype"`
130+
CoverageID string `xml:"wcs:CoverageId" yaml:"coverageId"`
131+
CoverageSubtype string `xml:"wcs:CoverageSubtype" yaml:"coverageSubtype"`
98132
}

pkg/wcs201/getcapabilities_request.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ func (gc GetCapabilitiesRequest) ToXML() []byte {
8686

8787
// GetCapabilitiesRequest struct with the needed parameters/attributes needed for making a GetCapabilities request
8888
type GetCapabilitiesRequest struct {
89-
XMLName xml.Name `xml:"GetCapabilities" yaml:"getcapabilities"`
89+
XMLName xml.Name `xml:"GetCapabilities" yaml:"getCapabilities"`
9090
Service string `xml:"service,attr" yaml:"service"`
9191
Version string `xml:"version,attr" yaml:"version"`
92-
Attr utils.XMLAttribute `xml:",attr"`
92+
Attr utils.XMLAttribute `xml:",attr" yaml:"attr"`
9393
}

pkg/wcs201/getcapabilities_response.go

Lines changed: 72 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ func (gc GetCapabilitiesResponse) ToXML() []byte {
3131

3232
// GetCapabilitiesResponse base struct
3333
type GetCapabilitiesResponse struct {
34-
XMLName xml.Name `xml:"wcs:Capabilities"`
35-
Namespaces `yaml:"namespaces"`
36-
ServiceIdentification ServiceIdentification `xml:"ows:ServiceIdentification" yaml:"serviceidentification"`
37-
ServiceProvider ServiceProvider `xml:"ows:ServiceProvider" yaml:"serviceprovider"`
38-
Capabilities
34+
XMLName xml.Name `xml:"wcs:Capabilities" yaml:"wcsCapabilities"`
35+
Namespaces
36+
ServiceIdentification ServiceIdentification `xml:"ows:ServiceIdentification" yaml:"serviceIdentification"`
37+
ServiceProvider ServiceProvider `xml:"ows:ServiceProvider" yaml:"serviceProvider"`
38+
OperationsMetadata OperationsMetadata `xml:"ows:OperationsMetadata" yaml:"operationsMetadata"`
39+
ServiceMetadata ServiceMetadata `xml:"wcs:ServiceMetadata" yaml:"serviceMetadata"`
40+
Contents Contents `xml:"wcs:Contents" yaml:"contents"`
3941
}
4042

4143
// Namespaces struct containing the namespaces needed for the XML document
@@ -48,59 +50,80 @@ type Namespaces struct {
4850
XmlnsGML string `xml:"xmlns:gml,attr" yaml:"gml"` //http://www.opengis.net/gml/3.2
4951
XmlnsGMLcov string `xml:"xmlns:gmlcov,attr" yaml:"gmlcov"` //http://www.opengis.net/gmlcov/1.0
5052
XmlnsSWE string `xml:"xmlns:swe,attr" yaml:"swe"` //http://www.opengis.net/swe/2.0
51-
XmlnsInspireCommon string `xml:"xmlns:inspire_common,attr,omitempty" yaml:"inspirecommon"` //http://inspire.ec.europa.eu/schemas/common/1.0
52-
XmlnsInspireDls string `xml:"xmlns:inspire_dls,attr,omitempty" yaml:"inspiredls"` //http://inspire.ec.europa.eu/schemas/inspire_dls/1.0
53+
XmlnsInspireCommon string `xml:"xmlns:inspire_common,attr,omitempty" yaml:"inspireCommon"` //http://inspire.ec.europa.eu/schemas/common/1.0
54+
XmlnsInspireDls string `xml:"xmlns:inspire_dls,attr,omitempty" yaml:"inspireDls"` //http://inspire.ec.europa.eu/schemas/inspire_dls/1.0
5355
XmlnsCrs string `xml:"xmlns:crs,attr" yaml:"crs"` //http://www.opengis.net/wcs/crs/1.0
5456
XmlnsInt string `xml:"xmlns:int,attr" yaml:"int"` //http://www.opengis.net/wcs/interpolation/1.0
5557
Version string `xml:"version,attr" yaml:"version"`
56-
SchemaLocation string `xml:"xsi:schemaLocation,attr" yaml:"schemalocation"`
58+
SchemaLocation string `xml:"xsi:schemaLocation,attr" yaml:"schemaLocation"`
5759
}
5860

5961
// ServiceIdentification struct should only be fill by the "template" configuration wcs201.yaml
6062
type ServiceIdentification struct {
61-
Title string `xml:"ows:Title" yaml:"title"`
62-
Abstract string `xml:"ows:Abstract" yaml:"abstract"`
63-
Keywords *wsc200.Keywords `xml:"ows:Keywords" yaml:"keywords"`
64-
ServiceType struct {
65-
Text string `xml:",chardata" yaml:"text"`
66-
CodeSpace string `xml:"codeSpace,attr" yaml:"codespace"`
67-
} `xml:"ows:ServiceType" yaml:"servicetype"`
68-
ServiceTypeVersion []string `xml:"ows:ServiceTypeVersion" yaml:"servicetypeversion"`
69-
Profile []string `xml:"ows:Profile" yaml:"profile"`
70-
Fees string `xml:"ows:Fees" yaml:"fees"`
71-
AccessConstraints string `xml:"ows:AccessConstraints" yaml:"accessconstraints"`
63+
Title string `xml:"ows:Title" yaml:"title"`
64+
Abstract string `xml:"ows:Abstract" yaml:"abstract"`
65+
Keywords *wsc200.Keywords `xml:"ows:Keywords" yaml:"keywords"`
66+
ServiceType ServiceType `xml:"ows:ServiceType" yaml:"serviceType"`
67+
ServiceTypeVersion []string `xml:"ows:ServiceTypeVersion" yaml:"serviceTypeVersion"`
68+
Profile []string `xml:"ows:Profile" yaml:"profile"`
69+
Fees string `xml:"ows:Fees" yaml:"fees"`
70+
AccessConstraints string `xml:"ows:AccessConstraints" yaml:"accessConstraints"`
71+
}
72+
73+
// ServiceType struct containing the service type
74+
type ServiceType struct {
75+
Text string `xml:",chardata" yaml:"text"`
76+
CodeSpace string `xml:"codeSpace,attr" yaml:"codeSpace"`
7277
}
7378

7479
// ServiceProvider struct containing the provider/organization information should only be fill by the "template" configuration wcs201.yaml
7580
type ServiceProvider struct {
76-
ProviderName string `xml:"ows:ProviderName" yaml:"providername"`
77-
ProviderSite struct {
78-
Type string `xml:"xlink:type,attr" yaml:"type"`
79-
Href string `xml:"xlink:href,attr" yaml:"href"`
80-
} `xml:"ows:ProviderSite" yaml:"providersite"`
81-
ServiceContact struct {
82-
IndividualName string `xml:"ows:IndividualName" yaml:"individualname"`
83-
PositionName string `xml:"ows:PositionName" yaml:"positionname"`
84-
ContactInfo struct {
85-
Phone struct {
86-
Voice string `xml:"ows:Voice" yaml:"voice"`
87-
Facsimile string `xml:"ows:Facsimile" yaml:"facsimile"`
88-
} `xml:"ows:Phone" yaml:"phone"`
89-
Address struct {
90-
DeliveryPoint string `xml:"ows:DeliveryPoint" yaml:"deliverypoint"`
91-
City string `xml:"ows:City" yaml:"city"`
92-
AdministrativeArea string `xml:"ows:AdministrativeArea" yaml:"administrativearea"`
93-
PostalCode string `xml:"ows:PostalCode" yaml:"postalcode"`
94-
Country string `xml:"ows:Country" yaml:"country"`
95-
ElectronicMailAddress string `xml:"ows:ElectronicMailAddress" yaml:"electronicmailaddress"`
96-
} `xml:"ows:Address" yaml:"address"`
97-
OnlineResource *struct {
98-
Type string `xml:"xlink:type,attr,omitempty" yaml:"type"`
99-
Href string `xml:"xlink:href,attr,omitempty" yaml:"href"`
100-
} `xml:"ows:OnlineResource,omitempty" yaml:"onlineresource"`
101-
HoursOfService string `xml:"ows:HoursOfService,omitempty" yaml:"hoursofservice"`
102-
ContactInstructions string `xml:"ows:ContactInstructions,omitempty" yaml:"contactinstructions"`
103-
} `xml:"ows:ContactInfo" yaml:"contactinfo"`
104-
Role string `xml:"ows:Role,omitempty" yaml:"role"`
105-
} `xml:"ows:ServiceContact" yaml:"servicecontact"`
81+
ProviderName string `xml:"ows:ProviderName" yaml:"providerName"`
82+
ProviderSite `xml:"ows:ProviderSite" yaml:"providerSite"`
83+
ServiceContact ServiceContact `xml:"ows:ServiceContact" yaml:"serviceContact"`
84+
}
85+
86+
// ProviderSite struct containing the website of the provider/organization
87+
type ProviderSite struct {
88+
Type string `xml:"xlink:type,attr" yaml:"type"`
89+
Href string `xml:"xlink:href,attr" yaml:"href"`
90+
}
91+
92+
// ServiceContact struct containing information for the person to contact
93+
type ServiceContact struct {
94+
IndividualName string `xml:"ows:IndividualName" yaml:"individualName"`
95+
PositionName string `xml:"ows:PositionName" yaml:"positionName"`
96+
ContactInfo ContactInfo `xml:"ows:ContactInfo" yaml:"contactInfo"`
97+
Role string `xml:"ows:Role,omitempty" yaml:"role"`
98+
}
99+
100+
// ContactInfo struct containing the contact information for the service
101+
type ContactInfo struct {
102+
Phone Phone `xml:"ows:Phone" yaml:"phone"`
103+
Address Address `xml:"ows:Address" yaml:"address"`
104+
OnlineResource *OnlineResource `xml:"ows:OnlineResource,omitempty" yaml:"onlineResource"`
105+
HoursOfService string `xml:"ows:HoursOfService,omitempty" yaml:"hoursOfService"`
106+
ContactInstructions string `xml:"ows:ContactInstructions,omitempty" yaml:"contactInstructions"`
107+
}
108+
109+
// Phone struct containing the contact telephone or fax number
110+
type Phone struct {
111+
Voice string `xml:"ows:Voice" yaml:"voice"`
112+
Facsimile string `xml:"ows:Facsimile" yaml:"facsimile"`
113+
}
114+
115+
// Address struct containing the address for the contact supplying the service
116+
type Address struct {
117+
DeliveryPoint string `xml:"ows:DeliveryPoint" yaml:"deliveryPoint"`
118+
City string `xml:"ows:City" yaml:"city"`
119+
AdministrativeArea string `xml:"ows:AdministrativeArea" yaml:"administrativeArea"`
120+
PostalCode string `xml:"ows:PostalCode" yaml:"postalCode"`
121+
Country string `xml:"ows:Country" yaml:"country"`
122+
ElectronicMailAddress string `xml:"ows:ElectronicMailAddress" yaml:"electronicMailAddress"`
123+
}
124+
125+
// OnlineResource struct containing the top-level web address of a service or service provider
126+
type OnlineResource *struct {
127+
Type string `xml:"xlink:type,attr,omitempty" yaml:"type"`
128+
Href string `xml:"xlink:href,attr,omitempty" yaml:"href"`
106129
}

0 commit comments

Comments
 (0)