Skip to content

Commit

Permalink
Added PMTiles #17 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr authored Aug 25, 2023
1 parent 4531dbe commit daf7cb9
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- OGC WMS (Basic WMS only)
- 3D Tiles
- PMTiles

### Changed

Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The following services are supported:
- [3D Tiles](#3d-tiles)
- [OGC WMS](#ogc-wms)
- [OGC WMTS](#ogc-wmts)
- [PMTiles](#pmtiles)
- [TileJSON](#tilejson)
- [XYZ](#xyz)

Expand Down Expand Up @@ -80,6 +81,23 @@ you'd provide `https://example.com/geoserver/service/wmts` as `href`.

The `href` can contain an optional server placeholder `{s}`. If `{s}` is used, the field [`href:servers`](#hrefservers) MUST be provided.

### PMTiles

Links to a [PMTiles](https://github.com/protomaps/PMTiles/blob/main/spec/v3/spec.md) file (versions 3.x).

| Field Name | Type | Description |
| --------------- | -------------------- | ----------- |
| rel | string | **REQUIRED**. Must be set to `pmtiles`. |
| href | string | **REQUIRED**. Link to a PMTiles file (usually ends with `.pmtiles`). |
| type | string | Recommended to be set to `application/vnd.pmtiles`. |
| pmtiles:layers | \[string] | For vector tiles, the layers to show on the map by default. If not provided, it's up to the discretion of the implementation to choose a layer from the `vector_layers` in the PMTiles metadata. |

The [Tile Type](https://github.com/protomaps/PMTiles/blob/main/spec/v3/spec.md#tile-type-tt) of the
PMTiles data source can be read from the first 127 bytes of the the binary header.

It is typical to assume a tile size of 256x256 pixels for raster tiles and 512x512 pixels for vector tiles,
but they could also be inferred from the first file.

### XYZ

Links to a XYZ, also known as slippy map.
Expand Down
9 changes: 9 additions & 0 deletions examples/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@
"rel": "3d-tiles",
"title": "3D Tiles",
"type": "application/json"
},
{
"href": "https://maps.example.com/item/example.pmtiles",
"rel": "pmtiles",
"title": "PMTiles",
"type": "application/vnd.pmtiles",
"pmtiles:layers": [
"streets"
]
}
]
}
9 changes: 9 additions & 0 deletions examples/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@
"rel": "3d-tiles",
"title": "3D Tiles",
"type": "application/json"
},
{
"href": "https://maps.example.com/item/example.pmtiles",
"rel": "pmtiles",
"title": "PMTiles",
"type": "application/vnd.pmtiles",
"pmtiles:layers": [
"streets"
]
}
],
"assets": {}
Expand Down
22 changes: 22 additions & 0 deletions json-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"wms",
"wmts",
"tilejson",
"pmtiles",
"3d-tiles"
]
}
Expand Down Expand Up @@ -140,6 +141,27 @@
}
}
}
},
{
"$comment": "Defines PMTiles links",
"if": {
"properties": {
"rel": {
"const": "pmtiles"
}
}
},
"then": {
"properties": {
"pmtiles:layers": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
}
}
}
}
]
}
Expand Down

0 comments on commit daf7cb9

Please sign in to comment.