Skip to content

Commit 85b8fd8

Browse files
authored
Add TileJSON (#7)
1 parent e4abede commit 85b8fd8

File tree

4 files changed

+49
-18
lines changed

4 files changed

+49
-18
lines changed

README.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@
99

1010
This document explains the Web Map Links Extension to the
1111
[SpatioTemporal Asset Catalog](https://github.com/radiantearth/stac-spec) (STAC) specification.
12-
It allows to provide links to web maps for visualization purposes. Currently, OGC WMTS and XYZ are supported.
12+
It allows to provide links to web map services for visualization purposes.
1313

14+
The following services are supported:
15+
- [OGC WMTS](#ogc-wmts)
16+
- [TileJSON](#tilejson)
17+
- [XYZ](#xyz)
18+
19+
Important resources in this extension:
1420
- Examples:
1521
- [Item example](examples/item.json): Shows the basic usage of the extension in a STAC Item
1622
- [Collection example](examples/collection.json): Shows the basic usage of the extension in a STAC Collection
@@ -20,7 +26,7 @@ It allows to provide links to web maps for visualization purposes. Currently, OG
2026
## Link Object Fields
2127

2228
This extension only extends the [Link Object](https://github.com/radiantearth/stac-spec/tree/master/item-spec/item-spec.md#link-object)
23-
used in all STAC entities (Catalogs, Collections, Items). It requires specific relation types to be set for the `rel` field in the
29+
used in all STAC entities (Catalogs, Collections, Items). It requires specific relation types to be set for the `rel` field in the
2430
Link Object.
2531

2632
An attribution field is not defined as part of this extension, but it is RECOMMENDED to provide an attribution
@@ -35,6 +41,7 @@ Links to a [OGC Web Map Tile Service](https://www.ogc.org/standards/wmts) (WMTS)
3541
| --------------- | -------------------- | ----------- |
3642
| rel | string | **REQUIRED**. Must be set to `wmts`. |
3743
| href | string | **REQUIRED**. Link to the WMTS, without any WMTS specific query parameters. |
44+
| type | string | Recommended to be set to the media type the Capabilities document, usually `application/xml`. |
3845
| href:servers | \[string] | See [href:servers](#hrefservers) below for details. |
3946
| 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. |
4047
| wmts:dimensions | Map\<string, string> | Any additional dimension parameters to add to the request as key-value-pairs, usually added as query parameters. |
@@ -51,11 +58,12 @@ The `href` can contain an optional server placeholder `{s}`. If `{s}` is used, t
5158

5259
Links to a XYZ, also known as slippy map.
5360

54-
| Field Name | Type | Description |
55-
| --------------- | -------------------- | ----------- |
56-
| rel | string | **REQUIRED**. Must be set to `xyz`. |
57-
| href | string | **REQUIRED**. Link to the XYZ as a templated URI. |
58-
| href:servers | \[string] | See [href:servers](#hrefservers) below for details. |
61+
| Field Name | Type | Description |
62+
| ------------ | --------- | ----------- |
63+
| rel | string | **REQUIRED**. Must be set to `xyz`. |
64+
| href | string | **REQUIRED**. Link to the XYZ as a templated URI. |
65+
| type | string | Recommended to be set to the image file type the XYZ returns by default, usually `image/png` or `image/jpeg`. |
66+
| href:servers | \[string] | See [href:servers](#hrefservers) below for details. |
5967

6068
#### href
6169

@@ -65,6 +73,16 @@ If `{s}` is used, the field [`href:servers`](#hrefservers) MUST be provided.
6573
All other parameters should be [hard-coded](https://github.com/stac-extensions/web-map-links/issues/2) with specific values,
6674
e.g. the `{r}` parameter in Leaflet could be replaced by `2x`.
6775

76+
### TileJSON
77+
78+
Links to a [TileJSON](https://github.com/mapbox/tilejson-spec) document.
79+
80+
| Field Name | Type | Description |
81+
| ---------- | ------ | ----------- |
82+
| rel | string | **REQUIRED**. Must be set to `tilejson`. |
83+
| href | string | **REQUIRED**. Link to the valid TileJSON document. |
84+
| type | string | Recommended to be set to `application/json` |
85+
6886
### General
6987

7088
The following field applies to multiple types of web mapping services:
@@ -97,10 +115,10 @@ for running tests are copied here for convenience.
97115

98116
### Running tests
99117

100-
The same checks that run as checks on PR's are part of the repository and can be run locally to verify that changes are valid.
118+
The same checks that run as checks on PR's are part of the repository and can be run locally to verify that changes are valid.
101119
To run tests locally, you'll need `npm`, which is a standard part of any [node.js installation](https://nodejs.org/en/download/).
102120

103-
First you'll need to install everything with npm once. Just navigate to the root of this repository and on
121+
First you'll need to install everything with npm once. Just navigate to the root of this repository and on
104122
your command line run:
105123
```bash
106124
npm install

examples/collection.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,29 @@
4141
{
4242
"href": "https://maps.example.com/wmts",
4343
"rel": "wmts",
44+
"type": "application/xml",
4445
"title": "RGB composite visualized through a WMTS",
4546
"wmts:layer": "rgb",
4647
"wmts:dimensions": {
4748
"time": "2022-01-01"
4849
}
4950
},
5051
{
51-
"href": "https://{s}.maps.example.com/xyz/{z}/{x}/{y}",
52+
"href": "https://{s}.maps.example.com/xyz/{z}/{x}/{y}.png",
5253
"rel": "xyz",
54+
"type": "image/png",
5355
"title": "RGB composite visualized through a XYZ",
5456
"href:servers": [
5557
"a",
5658
"b",
5759
"c"
5860
]
61+
},
62+
{
63+
"href": "https://maps.example.com/collection/tilejson.json",
64+
"rel": "tilejson",
65+
"title": "TileJSON",
66+
"type": "application/json"
5967
}
6068
]
6169
}

examples/item.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,25 @@
5050
{
5151
"href": "https://maps.example.com/wmts",
5252
"rel": "wmts",
53+
"type": "application/xml",
5354
"title": "RGB composite visualized through a WMTS",
5455
"wmts:layer": [
5556
"streets",
5657
"satellite"
5758
]
5859
},
5960
{
60-
"href": "https://maps.example.com/xyz/{z}/{x}/{y}",
61+
"href": "https://maps.example.com/xyz/{z}/{x}/{y}.jpg",
6162
"rel": "xyz",
63+
"type": "image/jpeg",
6264
"title": "RGB composite visualized through a XYZ"
65+
},
66+
{
67+
"href": "https://maps.example.com/item/tilejson.json",
68+
"rel": "tilejson",
69+
"title": "TileJSON",
70+
"type": "application/json"
6371
}
6472
],
65-
"assets": {
66-
"data": {
67-
"href": "https://example.com/examples/file.xyz"
68-
}
69-
}
70-
}
73+
"assets": {}
74+
}

json-schema/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"rel": {
3636
"enum": [
3737
"xyz",
38-
"wmts"
38+
"wmts",
39+
"tilejson"
3940
]
4041
}
4142
}

0 commit comments

Comments
 (0)