{"id":16875510,"url":"https://github.com/ghybs/leaflet.tilelayer.fallback","last_synced_at":"2025-03-17T06:31:25.368Z","repository":{"id":98360688,"uuid":"46546718","full_name":"ghybs/Leaflet.TileLayer.Fallback","owner":"ghybs","description":"Replaces missing Tiles by scaled lower zoom Tiles","archived":false,"fork":false,"pushed_at":"2019-06-06T12:12:39.000Z","size":52,"stargazers_count":36,"open_issues_count":9,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T18:58:35.173Z","etag":null,"topics":["javascript","leaflet","leaflet-plugins","missing-tiles","tile"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghybs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-20T07:32:06.000Z","updated_at":"2024-06-11T19:58:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"caa44948-b3ed-43a4-96cb-ed57adb65802","html_url":"https://github.com/ghybs/Leaflet.TileLayer.Fallback","commit_stats":{"total_commits":46,"total_committers":4,"mean_commits":11.5,"dds":0.08695652173913049,"last_synced_commit":"e36cde946bd68bb4fac1b087e24927e70336aed8"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghybs%2FLeaflet.TileLayer.Fallback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghybs%2FLeaflet.TileLayer.Fallback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghybs%2FLeaflet.TileLayer.Fallback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghybs%2FLeaflet.TileLayer.Fallback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghybs","download_url":"https://codeload.github.com/ghybs/Leaflet.TileLayer.Fallback/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847060,"owners_count":20357317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","leaflet","leaflet-plugins","missing-tiles","tile"],"created_at":"2024-10-13T15:36:16.352Z","updated_at":"2025-03-17T06:31:24.961Z","avatar_url":"https://github.com/ghybs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Leaflet.TileLayer.Fallback\n\nPlugin for Leaflet. Replaces missing Tiles (404 error) by scaled lower zoom Tiles.\n\n[Leaflet](http://leafletjs.com/) is the leading open-source JavaScript library\nfor mobile-friendly interactive maps.\n\n[![GitHub releases](https://img.shields.io/github/release/ghybs/leaflet.tilelayer.fallback.svg?label=GitHub)](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases)\n[![npm](https://img.shields.io/npm/v/leaflet.tilelayer.fallback.svg)](https://www.npmjs.com/package/leaflet.tilelayer.fallback)\n\nSize: 2 kB minified, \u003c 1 kB gzipped.\n\n\n\n## Requirements\n\n- Leaflet 1.x\n- For Leaflet 0.7, use the [`v0.1.1` release](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/tag/v0.1.1) or the [`leaflet-0.7` branch](https://github.com/ghybs/Leaflet.TileLayer.Fallback/tree/leaflet-0.7)\n\n\n\n## Demo\n[TileLayer.Fallback demonstration page](https://ghybs.github.io/Leaflet.TileLayer.Fallback/examples/tileLayerFallback-demo.html)\n\n\n\n## Usage instructions\n\n### Quick Guide\n\n**HTML:**\n\n```html\n\u003c!-- add TileLayer.Fallback script after Leaflet --\u003e\n\u003cscript src=\"leaflet.tilelayer.fallback.js\"\u003e\u003c/script\u003e\n```\n\n**JavaScript:**\n\n```javascript\nvar myTileLayer = L.tileLayer.fallback(url, options);\n```\n\nNow missing tiles will be automatically replaced by scaled up tiles from lower zoom levels.\n\n\n### Installing the plugin\n\n#### Local copy\n1. Download the \"\u003ca href=\"https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/download/v1.0.4/leaflet.tilelayer.fallback.js\"\u003e`leaflet.tilelayer.fallback.js`\u003c/a\u003e\" file from the [`v1.0.4` release](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/tag/v1.0.4).\n2. Place the file alongside your page.\n3. Add the `script` tag (see [Quick Guide \u003e HTML](#quick-guide)) to your page after Leaflet script.\n\n#### CDN\nYou can alternatively use the free [unpkg](https://unpkg.com) CDN service, but keep in mind that it \"[_is a free, best-effort service and cannot provide any uptime or support guarantees_](https://unpkg.com/#/about)\".\n\n```html\n\u003c!-- After Leaflet script --\u003e\n\u003cscript src=\"https://unpkg.com/leaflet.tilelayer.fallback@1.0.4/dist/leaflet.tilelayer.fallback.js\"\u003e\u003c/script\u003e\n```\n\n\n### Creation\n\nSimply use the `L.tileLayer.fallback` factory instead of your regular `L.tileLayer`:\n\n```javascript\nvar myTileLayer = L.tileLayer.fallback(url, options);\n\nmyTileLayer.addTo(map);\n```\n\n\n\n## API Reference\n\n### Creation\n\n| Factory | Description |\n| :------ | :---------- |\n| **L.tileLayer.fallback**( `\u003cString\u003e` [urlTemplate](http://leafletjs.com/reference-1.0.2.html#tilelayer-l-tilelayer), [`\u003cTileLayer options\u003e`](#options) options? ) | Instantiates a tile layer object given a [URL template](http://leafletjs.com/reference-1.0.2.html#tilelayer-l-tilelayer) and optionally an options object. When tile images return a 404 error, they are replaced by a scaled up tile from lower zoom. |\n\n\n### Options\n\n| Option | Type | Default | Description |\n| :----- | :--- | :------ | :---------- |\n| **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`](http://leafletjs.com/reference-1.0.2.html#tilelayer-errortileurl)). For zoom lower than `minNativeZoom`, [standard Tile Layer behaviour](http://leafletjs.com/reference-1.0.2.html#tilelayer-minnativezoom) applies, i.e. tiles are loaded from `minNativeZoom` and scaled down. |\n\nAll other [TileLayer options](http://leafletjs.com/reference-1.0.2.html#tilelayer-option) are applicable.\n\n\n### Events\n\n| Event | Data | Description |\n| :---- | :--- | :---------- |\n| **tilefallback** | [`TileFallbackEvent`](#tilefallbackevent) | Fired when a tile is being replaced by a scaled up tile of lower zoom. |\n\nAll other [TileLayer events](http://leafletjs.com/reference-1.0.2.html#tilelayer-crossorigin) are applicable.\n\n\n#### TileFallbackEvent\n\n| Property | Type | Description |\n| :------- | :--- | :---------- |\n| `tile` | `HTMLElement` | The tile element (image). |\n| `url` | `String` | The **original** source URL of the tile (before any fallback is applied). |\n| `urlMissing` | `String` | The missing source URL of the tile (possibly after a few fallback attempts). |\n| `urlFallback` | `String` | The fallback source URL of the tile (which may turn out to be also missing). |\n\n\n### Methods\n\nAll regular [TileLayer methods](http://leafletjs.com/reference-1.0.2.html#tilelayer-method) are applicable.\n\n\n\n## Limitations\nTileLayer.Fallback plugin tries to replace each missing tile by its immediate\nlower zoom equivalent, and if that one is also missing, it goes to lower zoom\nagain; and so on until a tile image is returned by the server, or it reaches\n[`minNativeZoom`](#options).\n\nThat means it has to wait for the server to return a 404 error before attempting\nto replace the tile by a lower zoom equivalent. If several zoom levels are\nmissing, it has to wait as many times as the number of missing zooms. Therefore,\nthe more missing zoom levels, the more time it takes to replace a tile.\n\n\n\n## License\n[![license](https://img.shields.io/github/license/ghybs/leaflet.tilelayer.fallback.svg)](LICENSE)\n\nLeaflet.TileLayer.Fallback is distributed under the [Apache 2.0 License](http://choosealicense.com/licenses/apache-2.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghybs%2Fleaflet.tilelayer.fallback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghybs%2Fleaflet.tilelayer.fallback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghybs%2Fleaflet.tilelayer.fallback/lists"}