Skip to content

Commit 06807b9

Browse files
committed
Make REST auto-discoverable
1 parent 6ccd8a7 commit 06807b9

File tree

2 files changed

+39
-27
lines changed

2 files changed

+39
-27
lines changed

README.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,22 @@ Links to a [OGC Web Map Tile Service](https://www.ogc.org/standards/wmts) (WMTS)
7676
| Field Name | Type | Description |
7777
| --------------- | -------------------- | ----------- |
7878
| rel | string | **REQUIRED**. Must be set to `wmts`. |
79-
| href | string | **REQUIRED**. Link to the WMTS, without any WMTS specific query parameters. |
80-
| type | string | The media type to be used for the tile requests, e.g. `image/png` or `image/jpeg`. |
79+
| href | string | **REQUIRED**. Link to the WMTS, without any WMTS specific parameters. |
8180
| href:servers | \[string] | See [href:servers](#hrefservers) below for details. |
82-
| wmts:dimensions | Map\<string, string> | Any additional parameters for the request (see below). |
83-
| wmts:encoding | string | Either `kvp` (see [KVP](#kvp)) or `rest` (see [REST](#rest)). Defaults to `KVP`. |
81+
| wmts:layer | string\|\[string] | **REQUIRED**. The layers to show on the map, either a list of layer names (KVP only) or a single layer name (REST and KVP). |
82+
| wmts:encoding | string | The WMTS request encoding, either `kvp` for [KVP](#kvp) or `rest`for [REST](#rest). Defaults to `kvp`. |
83+
84+
**href**:
8485

85-
The `href` can contain an optional server placeholder `{s}`. If `{s}` is used, the field [`href:servers`](#hrefservers) MUST be provided.
86+
- For REST encoding, the `href` must point to the capabilities document.
87+
- For KVP encoding, the `href` points to the URL of the capabilities document without any query parameters.
88+
So if your Capabilities can be requested from `https://example.com/geoserver/service/wmts?service=wmts&request=GetCapabilities`
89+
you'd provide `https://example.com/geoserver/service/wmts` as `href`.
90+
- The `href` can contain an optional server placeholder `{s}`. If `{s}` is used, the field [`href:servers`](#hrefservers) MUST be provided.
91+
92+
**wmts:layer**: If you provide multiple array elements in `wmts:layer` (e.g. `["layerA", "layerB"]`),
93+
each should occur in a separate layer in the mapping library so that individual requests for the layers are sent.
94+
For REST-encoding only a single string can be provided.
8695

8796
#### KVP
8897

@@ -91,36 +100,28 @@ which uses query parameters to transmit additional parameters.
91100

92101
| Field Name | Type | Description |
93102
| --------------- | -------------------- | ----------- |
103+
| type | string | The media type to be used for the tile requests, e.g. `image/png` or `image/jpeg`. |
94104
| wmts:encoding | string | If provided, must be set to `kvp`. |
95-
| 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. Will be added to the request as a query parameter. |
96105
| wmts:dimensions | Map\<string, string> | Any additional dimension parameters to add to the request as key-value-pairs (i.e. query parameters). |
97106

98-
**href**: For the KVP request encoding, the `href` is pointing to the URL of the Capabilities document,
99-
but without the query parameters for the Capabilities request.
100-
So if your Capabilities can be requested from `https://example.com/geoserver/service/wmts?service=wmts&request=GetCapabilities`
101-
you'd provide `https://example.com/geoserver/service/wmts` as `href`.
102-
103-
**wmts:layer**: If you provide multiple array elements in `wmts:layer` (e.g. `["layerA", "layerB"]`),
104-
each should occur in a separate layer in the mapping library so that individual requests for the layers are sent.
105-
106107
#### REST
107108

108109
This describes the REST request encoding, which provides a URL template with variables.
109110

110-
| Field Name | Type | Description |
111-
| --------------- | -------------------- | ----------- |
112-
| wmts:encoding | string | **REQUIRED**. Must be set to `rest`. |
113-
| variables | Map\<string, \*> | This object contains one key per substitution variable in the templated URL. |
111+
| Field Name | Type | Description |
112+
| ------------- | ---------------- | ----------- |
113+
| type | string | If provided, must be set to `application/xml`. |
114+
| wmts:encoding | string | **REQUIRED**. Must be set to `rest`. |
115+
| uriTemplate | string | Can override the URL template from the capabilities document with a custom version that can be customized with the `variables` provided. |
116+
| variables | Map\<string, \*> | This object contains one key per substitution variable in the `urlTemplate`. |
114117

115-
**href**: For the REST request encoding, the `href` is a URL template.
116-
Variables with a constant value should be encoded directly in the URL without using a variable.
117-
118-
**variables**: Each key defines the schema of one substitution variable using a JSON Schema fragmen
118+
**variables**: Each key defines the schema of one substitution variable using a JSON Schema fragmen
119119
and can thus include things like the data type of the variable, enumerations, minimum values, maximum values, etc.
120120
Note that clients may have varying capabilities to parse and hanle the schemas provided for the variables.
121121
If you want to ensure that the WMTS can be easily read, stick to very simply schemas
122122
(e.g., enums for strings, minimum/maximum values for numbers).
123123
Providing a reasonable default value for all variables is recommended.
124+
Variables with a constant value should be encoded directly in the URL without using a variable.
124125

125126
### PMTiles
126127

json-schema/schema.json

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,21 @@
8484
},
8585
"then": {
8686
"$comment": "REST request encoding",
87+
"required": [
88+
"wmts:layer"
89+
],
8790
"properties": {
91+
"wmts:layer": {
92+
"type": "string",
93+
"minLength": 1
94+
},
8895
"wmts:encoding": {
8996
"const": "rest"
9097
},
98+
"uriTemplate": {
99+
"type": "string",
100+
"minLength": 1
101+
},
91102
"variables": {
92103
"type": "object",
93104
"description": "This object contains one key per substitution variable in the templated URL. Each key defines the schema of one substitution variable using a JSON Schema fragment and can thus include things like the data type of the variable, enumerations, minimum values, maximum values, etc."
@@ -100,11 +111,6 @@
100111
"wmts:layer"
101112
],
102113
"properties": {
103-
"wmts:encoding": {
104-
"enum": [
105-
"kvp"
106-
]
107-
},
108114
"wmts:layer": {
109115
"oneOf": [
110116
{
@@ -121,6 +127,11 @@
121127
}
122128
]
123129
},
130+
"wmts:encoding": {
131+
"enum": [
132+
"kvp"
133+
]
134+
},
124135
"wmts:dimensions": {
125136
"type": "object",
126137
"additionalProperties": {

0 commit comments

Comments
 (0)