Skip to content

Commit e4abede

Browse files
committed
Fix #5, #2, #1
1 parent 2e3b88c commit e4abede

File tree

3 files changed

+85
-33
lines changed

3 files changed

+85
-33
lines changed

README.md

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,57 @@ Links to a [OGC Web Map Tile Service](https://www.ogc.org/standards/wmts) (WMTS)
3535
| --------------- | -------------------- | ----------- |
3636
| rel | string | **REQUIRED**. Must be set to `wmts`. |
3737
| href | string | **REQUIRED**. Link to the WMTS, without any WMTS specific query parameters. |
38-
| wmts:layer | string\|\[string] | **REQUIRED**. The layers to show on the map, either a list of layer names or a single layer name. |
38+
| href:servers | \[string] | See [href:servers](#hrefservers) below for details. |
39+
| wmts:layer | string\|\[string] | **REQUIRED**. The layers to show on the map by default, either a list of layer names or a single layer name. |
3940
| wmts:dimensions | Map\<string, string> | Any additional dimension parameters to add to the request as key-value-pairs, usually added as query parameters. |
4041

42+
#### href
43+
44+
For WMTS, the `href` is pointing to the URL of the Capabilities document, but without the query parameters for the Capabilities request.
45+
So if your Capabilities can be requested from `https://example.com/geoserver/service/wmts?service=wmts&request=GetCapabilities`
46+
you'd provide `https://example.com/geoserver/service/wmts` as `href`.
47+
48+
The `href` can contain an optional server placeholder `{s}`. If `{s}` is used, the field [`href:servers`](#hrefservers) MUST be provided.
49+
4150
### XYZ
4251

4352
Links to a XYZ, also known as slippy map.
4453

4554
| Field Name | Type | Description |
4655
| --------------- | -------------------- | ----------- |
4756
| rel | string | **REQUIRED**. Must be set to `xyz`. |
48-
| href | string | **REQUIRED**. Link to the XYZ as a templates URI. MUST include the following placeholders: `{x}`, `{y}` and `{z}`. MAY include a placeholder for the server: `{s}` |
49-
| xyz:servers | array | REQUIRED if `{s}` is used in the `href`. A list of allowed values for the placeholder `{s}`. |
57+
| href | string | **REQUIRED**. Link to the XYZ as a templated URI. |
58+
| href:servers | \[string] | See [href:servers](#hrefservers) below for details. |
59+
60+
#### href
61+
62+
For XYZ, the `href` is a templated URI.
63+
It MUST include the following placeholders: `{x}`, `{y}` and `{z}` and MAY include a placeholder for the server: `{s}`.
64+
If `{s}` is used, the field [`href:servers`](#hrefservers) MUST be provided.
65+
All other parameters should be [hard-coded](https://github.com/stac-extensions/web-map-links/issues/2) with specific values,
66+
e.g. the `{r}` parameter in Leaflet could be replaced by `2x`.
67+
68+
### General
69+
70+
The following field applies to multiple types of web mapping services:
71+
72+
| Field Name | Type | Description |
73+
| ------------ | --------- | ----------- |
74+
| href:servers | \[string] | A list of replacement values for `{s}` in `href`s. |
75+
76+
#### href:servers
77+
78+
This field is used to specify a set of URLs for a web mapping library so that requests can be sent to multiple servers,
79+
which can avoid request limits in web browsers.
80+
81+
The field is used across multiple types of web mapping services and applies currently to XYZ and WMTS.
82+
83+
It is **REQUIRED** if `{s}` is used in the `href` and then a list of at least 2 allowed values for the placeholder `{s}` must be provided.
84+
If you only have a single value don't provide `href:servers` and instead hard-code the value into the href.
85+
86+
The implementations can expand the given values into multiple URLs.
87+
For example, if you provide `https://{s}/example` as `href` and `href:servers` is `["a.com", "b.eu"]`
88+
you can expand that to `["https://a.com/example", "https://b.eu/example"]`.
5089

5190
## Contributing
5291

examples/collection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"href": "https://{s}.maps.example.com/xyz/{z}/{x}/{y}",
5252
"rel": "xyz",
5353
"title": "RGB composite visualized through a XYZ",
54-
"xyz:servers": [
54+
"href:servers": [
5555
"a",
5656
"b",
5757
"c"

json-schema/schema.json

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,34 +53,7 @@
5353
}
5454
},
5555
"then": {
56-
"if": {
57-
"properties": {
58-
"href": {
59-
"pattern": "\\{s\\}"
60-
}
61-
}
62-
},
63-
"then": {
64-
"required": [
65-
"xyz:servers"
66-
],
67-
"properties": {
68-
"xyz:servers": {
69-
"type": "array",
70-
"minItems": 1,
71-
"items": {
72-
"type": "string"
73-
}
74-
}
75-
}
76-
},
77-
"else": {
78-
"properties": {
79-
"xyz:servers": {
80-
"not": {}
81-
}
82-
}
83-
}
56+
"$ref": "#/definitions/servers"
8457
}
8558
},
8659
{
@@ -113,11 +86,51 @@
11386
"type": "string"
11487
}
11588
}
116-
}
89+
},
90+
"allOf": [
91+
{
92+
"$ref": "#/definitions/servers"
93+
}
94+
]
11795
}
11896
}
11997
]
12098
}
12199
}
100+
},
101+
"definitions": {
102+
"servers": {
103+
"if": {
104+
"required": [
105+
"href"
106+
],
107+
"properties": {
108+
"href": {
109+
"pattern": "\\{s\\}"
110+
}
111+
}
112+
},
113+
"then": {
114+
"required": [
115+
"href:servers"
116+
],
117+
"properties": {
118+
"href:servers": {
119+
"type": "array",
120+
"minItems": 2,
121+
"items": {
122+
"type": "string"
123+
}
124+
}
125+
}
126+
},
127+
"else": {
128+
"properties": {
129+
"href:servers": {
130+
"not": {}
131+
}
132+
}
133+
}
134+
}
122135
}
123136
}

0 commit comments

Comments
 (0)