Update README
This commit is contained in:
parent
1c73c14d84
commit
a39aa0bd8a
1 changed files with 60 additions and 38 deletions
94
README.md
94
README.md
|
@ -11,64 +11,86 @@
|
||||||
- `npm install`
|
- `npm install`
|
||||||
- `node src/main.js`
|
- `node src/main.js`
|
||||||
|
|
||||||
|
## Sample data
|
||||||
|
Sample data can be downloaded at https://github.com/klokantech/tileserver-gl/releases/download/v0.0.2/test_data.zip
|
||||||
|
|
||||||
|
#### Usage
|
||||||
|
- unpack somewhere and `cd` to the directory
|
||||||
|
- `docker run -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl`
|
||||||
|
- (or `node path/to/repo/src/main.js`)
|
||||||
|
|
||||||
|
#### Data
|
||||||
|
- tiles from http://osm2vectortiles.org/
|
||||||
|
- styles modified from https://github.com/klokantech/osm2vectortiles-gl-styles
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Create `config.json` file in the root directory.
|
Create `config.json` file in the root directory.
|
||||||
The config file can contain definition of several paths where the tiles will be served.
|
The config file can contain definition of several paths where the tiles will be served.
|
||||||
|
|
||||||
Every path needs to have `root` specified. All other paths (in the config (`style`) **and** in the style (`sprites`, `glyphs`, `sources`, ...)) are relative to this root.
|
|
||||||
|
|
||||||
For raster endpoints specify `style`, for serving raw `pbf` vector tiles specify `mbtiles` property.
|
|
||||||
|
|
||||||
Alternative `domains` can be specified (array or comma-separated string). These will be used to generate tile urls for `index.json`.
|
|
||||||
|
|
||||||
Every path can also have `options` object and its content is directly copied into served `index.json`.
|
|
||||||
The `options.format` can be used to modify the extension in tile urls inside `index.json`, but the server will still serve all the supported formats.
|
|
||||||
|
|
||||||
### Example configuration file
|
### Example configuration file
|
||||||
|
|
||||||
Example styles can be downloaded from https://github.com/klokantech/osm2vectortiles-gl-styles.
|
|
||||||
Rendered vector tiles can be found at http://osm2vectortiles.org/downloads/.
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"/basic": {
|
"options": {
|
||||||
"root": "test_data",
|
"paths": {
|
||||||
"style": "styles/basic-v8.json",
|
"root": "",
|
||||||
|
"fonts": "glyphs",
|
||||||
|
"sprites": "sprites",
|
||||||
|
"styles": "styles",
|
||||||
|
"mbtiles": ""
|
||||||
|
},
|
||||||
"domains": [
|
"domains": [
|
||||||
"localhost:8080",
|
"localhost:8080",
|
||||||
"127.0.0.1:8080"
|
"127.0.0.1:8080"
|
||||||
],
|
]
|
||||||
"options": {
|
},
|
||||||
|
"styles": {
|
||||||
|
"test": {
|
||||||
|
"style": "basic-v8.json",
|
||||||
|
"tilejson": {
|
||||||
"type": "overlay",
|
"type": "overlay",
|
||||||
"bounds": [5.8559113, 45.717995, 10.5922941, 47.9084648]
|
"bounds": [8.44806, 47.32023, 8.62537, 47.43468]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/hybrid": {
|
"hybrid": {
|
||||||
"root": "test_data",
|
"style": "satellite-hybrid-v8.json",
|
||||||
"style": "styles/satellite-hybrid-v8.json",
|
"raster": false,
|
||||||
"options": {
|
"tilejson": {
|
||||||
"format": "webp"
|
"format": "webp",
|
||||||
|
"center": [8.536715, 47.377455, 6]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/switzerland-vector": {
|
"streets": {
|
||||||
"root": "test_data",
|
"style": "streets-v8.json",
|
||||||
"mbtiles": "switzerland.mbtiles"
|
"vector": false,
|
||||||
|
"tilejson": {
|
||||||
|
"center": [8.536715, 47.377455, 6]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vector": {
|
||||||
|
"zurich-vector": {
|
||||||
|
"mbtiles": "zurich.mbtiles"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
**Note**: To specify local mbtiles as source of the vector tiles inside the style, use urls with `mbtiles` protocol with path relative to the `root`. (For example `mbtiles://switzerland.mbtiles`)
|
**Note**: To specify local mbtiles as source of the vector tiles inside the style, use urls with `mbtiles` protocol with path relative to the `cwd + options.paths.root + options.paths.mbtiles`. (For example `mbtiles://switzerland.mbtiles`)
|
||||||
|
|
||||||
## Available URLs
|
## Available URLs
|
||||||
|
|
||||||
- If you visit the server on the configured port (default 8080) you should see your maps appearing in the browser.
|
- If you visit the server on the configured port (default 8080) you should see your maps appearing in the browser.
|
||||||
- The tiles itself are served at `/{basename}/{z}/{x}/{y}[@2x].{format}`
|
- Style is served at `/styles/{id}.json` (+ array at `/styles.json`)
|
||||||
|
- Sprites at `/styles/{id}/sprite[@2x].{format}`
|
||||||
|
- Fonts at `/fonts/{fontstack}/{start}-{end}.pbf`
|
||||||
|
- Rasterized tiles are at `/raster/{id}/{z}/{x}/{y}[@2x].{format}`
|
||||||
- The optional `@2x` (or `@3x`) part can be used to render HiDPI (retina) tiles
|
- The optional `@2x` (or `@3x`) part can be used to render HiDPI (retina) tiles
|
||||||
- Static images (only for raster tiles) are rendered at:
|
- Available formats: `png`, `jpg` (`jpeg`), `webp`
|
||||||
- `/{basename}/static/{lon},{lat},{zoom}/{width}x{height}[@2x].{format}` (center-based)
|
- TileJSON at `/raster/{id}.json`
|
||||||
- `/{basename}/static/{minx},{miny},{maxx},{maxy}/{zoom}[@2x].{format}` (area-based)
|
- Static images are rendered at:
|
||||||
- TileJSON at `/{basename}/index.json`
|
- `/static/{id}/{lon},{lat},{zoom}/{width}x{height}[@2x].{format}` (center-based)
|
||||||
- Array of all TileJSONs at `/index.json`
|
- `/static/{id}/{minx},{miny},{maxx},{maxy}/{zoom}[@2x].{format}` (area-based)
|
||||||
- Available formats:
|
- Vector tiles at `/vector/{mbtiles}/{z}/{x}/{y}.pbf`
|
||||||
- raster: `png`, `jpg` (`jpeg`), `webp`
|
- TileJSON at `/vector/{mbtiles}.json`
|
||||||
- vector: `pbf`
|
- Array of all TileJSONs at `/index.json` (`/raster.json`; `/vector.json`)
|
||||||
|
|
Loading…
Reference in a new issue