Compare commits

...

11 Commits

Author SHA1 Message Date
Petr Sloup
f1c835c21d Update package version to 1.1.4 2016-10-07 15:21:58 +02:00
Petr Sloup
15ed6d74bf Fix incorrect XYZ URLs (close #58) 2016-10-07 15:21:12 +02:00
Petr Sloup
a3d8240aac Do not add scale prefix when viewing raster data tiles (close #57) 2016-10-07 11:16:22 +02:00
Petr Sloup
098f057e55 Update package version to 1.1.3 2016-09-30 09:51:20 +02:00
Petr Sloup
18ba6f5059 Ignore tiling scheme of the source for internal meta urls (#54) 2016-09-30 09:50:05 +02:00
Petr Sloup
820dbdd3dd Update package version to 1.1.2 2016-09-27 17:34:39 +02:00
Petr Sloup
acd7683f18 Update dependencies 2016-09-27 17:30:24 +02:00
Petr Sloup
09859c10c1 Serve any vector/raster mbtiles, use styles only for osm2vt (close #51, #52) 2016-09-27 17:26:05 +02:00
Petr Sloup
f201deecdc Merge pull request #48 from rastapasta/patch-1
adding info for OSX setup
2016-09-22 08:55:41 +02:00
Petr Pridal
b49521d2ed Update README.md 2016-09-01 17:53:15 +02:00
Michael Straßburger
30c9bc8979 adding info for OSX setup 2016-08-29 12:31:33 +02:00
7 changed files with 80 additions and 35 deletions

View File

@@ -1,19 +1,46 @@
![tileserver-gl](https://cloud.githubusercontent.com/assets/59284/18173467/fa3aa2ca-7069-11e6-86b1-0f1266befeb6.jpeg)
# TileServer GL
[![Build Status](https://travis-ci.org/klokantech/tileserver-gl.svg?branch=master)](https://travis-ci.org/klokantech/tileserver-gl)
[![Docker Hub](https://img.shields.io/badge/docker-hub-blue.svg)](https://hub.docker.com/r/klokantech/tileserver-gl/)
Vector and raster maps with GL styles. Map tile server for Mapbox Android, iOS, GL JS, Leaflet, OpenLayers, GIS via WMTS, etc. Server side rendering by Mapbox GL Native.
Vector and raster maps with GL styles. Server side rendering by Mapbox GL Native. Map tile server for Mapbox GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
## Quickstart
Use `npm install -g tileserver-gl` to install the package from npm.
## Get Started
Then you can simply run `tileserver-gl zurich_switzerland.mbtiles` to start the server for the given mbtiles.
Install `tileserver-gl` with server-side raster rendering of vector tiles with npm
Or you can use `docker run -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl` to run the server inside a docker container.
```bash
npm install -g tileserver-gl
```
Alternatively, you can use `tileserver-gl-light` package instead, which is pure javascript (does not have any native dependencies) and can run anywhere, but does not contain rasterization features.
Now download vector tiles from [OSM2VectorTiles](http://osm2vectortiles.org/downloads/).
Prepared vector tiles can be downloaded from [OSM2VectorTiles](http://osm2vectortiles.org/).
```bash
curl -o zurich_switzerland.mbtiles https://osm2vectortiles-downloads.os.zhdk.cloud.switch.ch/v2.0/extracts/zurich_switzerland.mbtiles
```
Start `tileserver-gl` with the downloaded vector tiles.
```bash
tileserver-gl zurich_switzerland.mbtiles
```
Alternatively, you can use the `tileserver-gl-light` package instead, which is pure javascript (does not have any native dependencies) and can run anywhere, but does not contain rasterization on the server side made with MapBox GL Native.
## Using Docker
An alternative to npm to start the packed software easier is to install [Docker](http://www.docker.com/) on your computer and then run in the directory with the downloaded MBTiles the command:
```bash
docker run -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl
```
This will download and start a ready to use container on your computer and the maps are going to be available in webbrowser on localhost:8080.
On laptop you can use [Docker Kitematic](https://kitematic.com/) and search "tileserver-gl" and run it, then drop in the 'data' folder the MBTiles.
## Documentation
You can read full documentation of this project at http://tileserver.readthedocs.io/.
You can read full documentation of this project at http://tileserver.readthedocs.io/.

View File

@@ -27,3 +27,11 @@ Make sure you have Node v4 or higher (nvm install 4) and run::
npm install
node .
On OSX
======
Make sure to have ``pkg-config`` and ``cairo`` installed::
brew install pkg-config cairo

View File

@@ -1,6 +1,6 @@
{
"name": "tileserver-gl",
"version": "1.1.1",
"version": "1.1.4",
"description": "Map tile server for JSON GL styles - vector and server side generated raster tiles",
"main": "src/main.js",
"bin": "src/main.js",
@@ -19,19 +19,19 @@
"async": "2.0.1",
"advanced-pool": "0.3.2",
"base64url": "2.0.0",
"canvas": "1.4.0",
"canvas": "1.5.0",
"clone": "1.0.2",
"color": "0.11.3",
"cors": "2.8.0",
"cors": "2.8.1",
"express": "4.14.0",
"glyph-pbf-composite": "0.0.2",
"handlebars": "4.0.5",
"mapbox-gl-native": "3.3.2",
"mapbox-gl-native": "3.3.3",
"mbtiles": "0.9.0",
"morgan": "1.7.0",
"node-pngquant-native": "1.0.4",
"nomnom": "1.8.1",
"request": "2.74.0",
"request": "2.75.0",
"sharp": "0.16.0",
"sphericalmercator": "1.0.5",
"tileserver-gl-styles": "0.3.0"

View File

@@ -124,6 +124,10 @@
<div id='map'></div>
<script>
var map = L.mapbox.map('map', '/data/{{id}}.json{{&key_query}}', { zoomControl: false });
map.eachLayer(function(layer) {
// do not add scale prefix even if retina display is detected
layer.scalePrefix = '.';
});
new L.Control.Zoom({ position: 'topright' }).addTo(map);
setTimeout(function() {
new L.Hash(map);

View File

@@ -70,10 +70,6 @@ var startWithMBTiles = function(mbtilesFile) {
}
var instance = new mbtiles(mbtilesFile, function(err) {
instance.getInfo(function(err, info) {
if (info.format != 'pbf') {
console.log('ERROR: MBTiles format is not "pbf".');
process.exit(1);
}
var bounds = info.bounds;
var styleDir = path.resolve(__dirname, "../node_modules/tileserver-gl-styles/");
@@ -89,26 +85,35 @@ var startWithMBTiles = function(mbtilesFile) {
}
},
"styles": {},
"data": {
"osm2vectortiles": {
"mbtiles": path.basename(mbtilesFile)
}
}
"data": {}
};
var styles = fs.readdirSync(path.resolve(styleDir, 'styles'));
for (var i=0; i < styles.length; i++) {
var styleFilename = styles[i];
if (styleFilename.endsWith('.json')) {
var styleObject = {
"style": path.basename(styleFilename),
"tilejson": {
"bounds": bounds
}
};
config['styles'][path.basename(styleFilename, '.json')] =
styleObject;
if (info.format == 'pbf' &&
info.name.toLowerCase().indexOf('osm2vectortiles') > -1) {
config['data']['osm2vectortiles'] = {
"mbtiles": path.basename(mbtilesFile)
};
var styles = fs.readdirSync(path.resolve(styleDir, 'styles'));
for (var i = 0; i < styles.length; i++) {
var styleFilename = styles[i];
if (styleFilename.endsWith('.json')) {
var styleObject = {
"style": path.basename(styleFilename),
"tilejson": {
"bounds": bounds
}
};
config['styles'][path.basename(styleFilename, '.json')] =
styleObject;
}
}
} else {
console.log('WARN: MBTiles not in "osm2vectortiles" format. ' +
'Serving raw data only...');
config['data'][info.id || 'mbtiles'] = {
"mbtiles": path.basename(mbtilesFile)
};
}
if (opts.verbose) {

View File

@@ -202,6 +202,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
// meta url which will be detected when requested
'mbtiles://' + name + '/{z}/{x}/{y}.' + (info.format || 'pbf')
];
delete source.scheme;
if (source.format == 'pbf') {
map.sources[name].emptyTile = new Buffer(0);
} else {

View File

@@ -249,7 +249,7 @@ module.exports = function(opts, callback) {
var tiles = utils.getTileUrls(
req, style.serving_rendered.tiles,
'styles/' + id, style.serving_rendered.format);
'styles/' + id + '/rendered', style.serving_rendered.format);
style.xyz_link = tiles[0];
}
});