All Projects → ghybs → Leaflet.TileLayer.Fallback

ghybs / Leaflet.TileLayer.Fallback

Licence: Apache-2.0 license
Replaces missing Tiles by scaled lower zoom Tiles

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Leaflet.TileLayer.Fallback

leaflet-defaulticon-compatibility
Retrieve all Leaflet Default Icon options from CSS, in particular all icon images URL's, to improve compatibility with bundlers and frameworks that modify URL's in CSS.
Stars: ✭ 71 (+144.83%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.path.drag
Drag functionality for Leaflet vector layers
Stars: ✭ 72 (+148.28%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.markercluster.freezable
Adds ability to freeze clusters at specified zoom
Stars: ✭ 21 (-27.59%)
Mutual labels:  leaflet, leaflet-plugins
Iclient Javascript
Modern GIS Web Client for JavaScript, based on Leaflet\OpenLayers\MapboxGL-JS\Classic(iClient8C), enhanced with ECharts\D3\MapV etc. Contributed by SuperMap & community.
Stars: ✭ 593 (+1944.83%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.browser.print
A leaflet plugin which allows users to print the map directly from the browser
Stars: ✭ 94 (+224.14%)
Mutual labels:  leaflet, leaflet-plugins
Heatmap.js
🔥 JavaScript Library for HTML5 canvas based heatmaps
Stars: ✭ 5,685 (+19503.45%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet Geoman
🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
Stars: ✭ 1,088 (+3651.72%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet-active-area
A Leaflet plugin to center the map not in the center of the map but inside a DIV. Useful for responsive design.
Stars: ✭ 99 (+241.38%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet Gps
Simple leaflet control plugin for tracking gps position
Stars: ✭ 90 (+210.34%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.layergroup.collision
Leaflet plugin for uncluttering L.Markers using basic collision detection.
Stars: ✭ 82 (+182.76%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.markercluster
Marker Clustering plugin for Leaflet
Stars: ✭ 3,305 (+11296.55%)
Mutual labels:  leaflet, leaflet-plugins
Ngx Leaflet Starter
A soup of Angular and Leaflet
Stars: ✭ 208 (+617.24%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet Ant Path
🌿🐜 Creates a leaflet polyline with a 'ant-path' animated flux
Stars: ✭ 296 (+920.69%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.flowecharts
leaflet plugin for Baidu Echarts
Stars: ✭ 17 (-41.38%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.pixioverlay
Bring Pixi.js power to Leaflet maps
Stars: ✭ 264 (+810.34%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.extras2
Extra functionality for leaflet R package.
Stars: ✭ 37 (+27.59%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.MarkerCluster.LayerSupport
Sub-plugin for Leaflet.markercluster plugin; brings compatibility with Layers Control and other plugins
Stars: ✭ 53 (+82.76%)
Mutual labels:  leaflet, leaflet-plugins
leaflet.tilelayer.gloperations
Custom Leaflet TileLayer using WebGL to do operations on and colorize floating-point pixels
Stars: ✭ 15 (-48.28%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.featuregroup.subgroup
Creates a Feature Group that adds its child layers into a parent group when added to a map (e.g. through L.Control.Layers)
Stars: ✭ 79 (+172.41%)
Mutual labels:  leaflet, leaflet-plugins
Geopackage Js
GeoPackage JavaScript Library
Stars: ✭ 191 (+558.62%)
Mutual labels:  leaflet, leaflet-plugins

Leaflet.TileLayer.Fallback

Plugin for Leaflet. Replaces missing Tiles (404 error) by scaled lower zoom Tiles.

Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps.

GitHub releases npm

Size: 2 kB minified, < 1 kB gzipped.

Requirements

Demo

TileLayer.Fallback demonstration page

Usage instructions

Quick Guide

HTML:

<!-- add TileLayer.Fallback script after Leaflet -->
<script src="leaflet.tilelayer.fallback.js"></script>

JavaScript:

var myTileLayer = L.tileLayer.fallback(url, options);

Now missing tiles will be automatically replaced by scaled up tiles from lower zoom levels.

Installing the plugin

Local copy

  1. Download the "leaflet.tilelayer.fallback.js" file from the v1.0.4 release.
  2. Place the file alongside your page.
  3. Add the script tag (see Quick Guide > HTML) to your page after Leaflet script.

CDN

You can alternatively use the free unpkg CDN service, but keep in mind that it "is a free, best-effort service and cannot provide any uptime or support guarantees".

<!-- After Leaflet script -->
<script src="https://unpkg.com/[email protected]/dist/leaflet.tilelayer.fallback.js"></script>

Creation

Simply use the L.tileLayer.fallback factory instead of your regular L.tileLayer:

var myTileLayer = L.tileLayer.fallback(url, options);

myTileLayer.addTo(map);

API Reference

Creation

Factory Description
L.tileLayer.fallback( <String> urlTemplate, <TileLayer options> options? ) Instantiates a tile layer object given a URL template and optionally an options object. When tile images return a 404 error, they are replaced by a scaled up tile from lower zoom.

Options

Option Type Default Description
minNativeZoom Number 0 Minimum zoom number the tiles source has available. If tiles are missing down to that zoom level (included), they will be replaced by the standard Error Tile (specified by errorTileUrl). For zoom lower than minNativeZoom, standard Tile Layer behaviour applies, i.e. tiles are loaded from minNativeZoom and scaled down.

All other TileLayer options are applicable.

Events

Event Data Description
tilefallback TileFallbackEvent Fired when a tile is being replaced by a scaled up tile of lower zoom.

All other TileLayer events are applicable.

TileFallbackEvent

Property Type Description
tile HTMLElement The tile element (image).
url String The original source URL of the tile (before any fallback is applied).
urlMissing String The missing source URL of the tile (possibly after a few fallback attempts).
urlFallback String The fallback source URL of the tile (which may turn out to be also missing).

Methods

All regular TileLayer methods are applicable.

Limitations

TileLayer.Fallback plugin tries to replace each missing tile by its immediate lower zoom equivalent, and if that one is also missing, it goes to lower zoom again; and so on until a tile image is returned by the server, or it reaches minNativeZoom.

That means it has to wait for the server to return a 404 error before attempting to replace the tile by a lower zoom equivalent. If several zoom levels are missing, it has to wait as many times as the number of missing zooms. Therefore, the more missing zoom levels, the more time it takes to replace a tile.

License

license

Leaflet.TileLayer.Fallback is distributed under the Apache 2.0 License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].