From a258df360467eff4b86d1986a017fe83af4c148a Mon Sep 17 00:00:00 2001 From: Maurits van der Schee Date: Thu, 4 Jul 2019 02:39:15 +0200 Subject: [PATCH] support tiles in GeoJSON --- .../clients/leaflet/geojson-tile-layer.js | 25 ++++++++++++++----- examples/clients/leaflet/vanilla.html | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/examples/clients/leaflet/geojson-tile-layer.js b/examples/clients/leaflet/geojson-tile-layer.js index c289ee5..f3e99c2 100644 --- a/examples/clients/leaflet/geojson-tile-layer.js +++ b/examples/clients/leaflet/geojson-tile-layer.js @@ -32,12 +32,13 @@ updateLayers: function(url, geoData) { if (geoData.type == 'FeatureCollection'){ - for (var i=0;i this.options.maxZoom) || + (this.options.minZoom && zoom < this.options.minZoom)) { + this.map.removeLayer(this.layer); + } else { + this.map.addLayer(this.layer); + } + }, + }); L.geoJSONTileLayer = function (url, options) { diff --git a/examples/clients/leaflet/vanilla.html b/examples/clients/leaflet/vanilla.html index bb91c9a..cb83e9b 100644 --- a/examples/clients/leaflet/vanilla.html +++ b/examples/clients/leaflet/vanilla.html @@ -28,6 +28,7 @@ }).addTo(mymap); L.geoJSONTileLayer('http://localhost:8000/src/geojson/countries?filter=id,lt,3&tile={z},{x},{y}', { + minZoom: 3, maxZoom: 18, }).addTo(mymap);