This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* GET /tiles/:z/:x/:y.mvt */ | |
/* Retreive a vector tile by tileid */ | |
router.get('/tiles/:z/:x/:y.mvt', async (req, res) => { | |
const { z, x, y } = req.params; | |
// calculate the bounding polygon for this tile | |
const bbox = mercator.bbox(x, y, z, false); | |
// Query the database, using ST_AsMVTGeom() to clip the geometries | |
// Wrap the whole query with ST_AsMVT(), which will create a protocol buffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = L.map( 'map' ); | |
L.Map.prototype.panToOffset = function (latlng, offset, options) { | |
var x = this.latLngToContainerPoint(latlng).x - offset[0] | |
var y = this.latLngToContainerPoint(latlng).y - offset[1] | |
var point = this.containerPointToLatLng([x, y]) | |
return this.setView(point, this._zoom, { pan: options }) | |
} | |
function centerMap(){ |