Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tephenavies/tilelive-hybrid
A tilelive module that retrieves tiles from different sources based on zoom level
https://github.com/tephenavies/tilelive-hybrid
Last synced: 28 days ago
JSON representation
A tilelive module that retrieves tiles from different sources based on zoom level
- Host: GitHub
- URL: https://github.com/tephenavies/tilelive-hybrid
- Owner: tephenavies
- License: other
- Created: 2016-01-18T04:51:08.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-13T06:17:44.000Z (over 8 years ago)
- Last Synced: 2024-10-31T22:50:41.798Z (about 2 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
tilelive-hybrid
---------------
Implements the tilelive API for serving tiles from multiple tilelive sources depending on the requested zoom level. Ideal for vector tile sources where some zoom levels use pre-generated tiles and other zoom levels generate tiles from a mapnik data source### new Hybrid(options, callback)
- *xml*: a Mapnik XML string that will be used to generate vector tiles.
- *base*: Optional, basepath for Mapnik map. Defaults to `__dirname`.## Installation
npm install steve9164/tilelive-hybrid
Though `tilelive` is not a dependency of `tilelive-hybrid` you will want to
install it to actually make use of `tilelive-hybrid` through a reasonable
API.## Usage
```javascript
var tilelive = require('tilelive');
require('tilelive-hybrid').registerProtocols(tilelive);tilelive.load('hybrid:///path/to/file.json', function(err, source) {
if (err) throw err;// Interface is in XYZ/Google coordinates.
// Use `y = (1 << z) - 1 - y` to flip TMS coordinates.
source.getTile(0, 0, 0, function(err, tile, headers) {
// `err` is an error object when generation failed, otherwise null.
// `tile` contains the compressed image file as a Buffer
// `headers` is a hash with HTTP headers for the image.
});// The `.getGrid` is implemented accordingly.
});
```## Example JSON hybrid configuration
```json
{
"sources": [
{
"source": "mbtiles://C:/Users/sdavies/Documents/tilelive/server-config/data/FID_SA4_2011_AUST/store_backup.mbtiles",
"minZ": 3,
"maxZ": 11
},
{
"source": "bridge://C:/Users/sdavies/Documents/tilelive/server-config/data/FID_SA4_2011_AUST/data.xml",
"minZ": 0,
"maxZ": 25
}
]
}
```This will configure tilelive-hybrid to use the mbtiles source for zoom 3 to 11 (inclusive) and the bridge source for zoom levels 0 to 2 and 12 to 25 (inclusive)