Update README

This commit is contained in:
Petr Sloup 2016-03-11 11:38:36 +01:00
parent 1c73c14d84
commit a39aa0bd8a

View file

@ -11,64 +11,86 @@
- `npm install`
- `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
Create `config.json` file in the root directory.
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 styles can be downloaded from https://github.com/klokantech/osm2vectortiles-gl-styles.
Rendered vector tiles can be found at http://osm2vectortiles.org/downloads/.
```json
{
"/basic": {
"root": "test_data",
"style": "styles/basic-v8.json",
"options": {
"paths": {
"root": "",
"fonts": "glyphs",
"sprites": "sprites",
"styles": "styles",
"mbtiles": ""
},
"domains": [
"localhost:8080",
"127.0.0.1:8080"
],
"options": {
"type": "overlay",
"bounds": [5.8559113, 45.717995, 10.5922941, 47.9084648]
]
},
"styles": {
"test": {
"style": "basic-v8.json",
"tilejson": {
"type": "overlay",
"bounds": [8.44806, 47.32023, 8.62537, 47.43468]
}
},
"hybrid": {
"style": "satellite-hybrid-v8.json",
"raster": false,
"tilejson": {
"format": "webp",
"center": [8.536715, 47.377455, 6]
}
},
"streets": {
"style": "streets-v8.json",
"vector": false,
"tilejson": {
"center": [8.536715, 47.377455, 6]
}
}
},
"/hybrid": {
"root": "test_data",
"style": "styles/satellite-hybrid-v8.json",
"options": {
"format": "webp"
"vector": {
"zurich-vector": {
"mbtiles": "zurich.mbtiles"
}
},
"/switzerland-vector": {
"root": "test_data",
"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 `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
- 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
- Static images (only for raster tiles) are rendered at:
- `/{basename}/static/{lon},{lat},{zoom}/{width}x{height}[@2x].{format}` (center-based)
- `/{basename}/static/{minx},{miny},{maxx},{maxy}/{zoom}[@2x].{format}` (area-based)
- TileJSON at `/{basename}/index.json`
- Array of all TileJSONs at `/index.json`
- Available formats:
- raster: `png`, `jpg` (`jpeg`), `webp`
- vector: `pbf`
- Available formats: `png`, `jpg` (`jpeg`), `webp`
- TileJSON at `/raster/{id}.json`
- Static images are rendered at:
- `/static/{id}/{lon},{lat},{zoom}/{width}x{height}[@2x].{format}` (center-based)
- `/static/{id}/{minx},{miny},{maxx},{maxy}/{zoom}[@2x].{format}` (area-based)
- Vector tiles at `/vector/{mbtiles}/{z}/{x}/{y}.pbf`
- TileJSON at `/vector/{mbtiles}.json`
- Array of all TileJSONs at `/index.json` (`/raster.json`; `/vector.json`)