Skip to content

Commit

Permalink
README add shields, CDN with unpkg, links to Leaflet docs
Browse files Browse the repository at this point in the history
planning to publish plugin onto npm, therefore we can now use unpkg CDN instead of having to commit dist files (into gh-pages branch) and use RawGit CDN.
Updated links to Leaflet docs version 1.0.2.
  • Loading branch information
ghybs committed Dec 19, 2016
1 parent 8be6c74 commit 80d49c7
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Plugin for Leaflet. Replaces missing Tiles (404 error) by scaled lower zoom Tile
[Leaflet](http://leafletjs.com/) is the leading open-source JavaScript library
for mobile-friendly interactive maps.

Latest TileLayer.Fallback release (for Leaflet 1.x): [`v1.0.1`](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/tag/v1.0.1)
[![GitHub releases](https://img.shields.io/github/release/ghybs/leaflet.tilelayer.fallback.svg?label=GitHub)](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases)
[![npm](https://img.shields.io/npm/v/leaflet.tilelayer.fallback.svg)](https://www.npmjs.com/package/leaflet.tilelayer.fallback)

Size: 2 kB minified, < 1 kB gzipped.



Expand Down Expand Up @@ -44,20 +47,19 @@ Now missing tiles will be automatically replaced by scaled up tiles from lower z
### Installing the plugin

#### Local copy
1. Download the "<a href="https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/download/v1.0.1/leaflet.tilelayer.fallback.js" download="leaflet.tilelayer.fallback.js">`leaflet.tilelayer.fallback.js`</a>" file from [`v1.0.1` release](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/tag/v1.0.1).
1. Download the "<a href="https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/download/v1.0.2/leaflet.tilelayer.fallback.js">`leaflet.tilelayer.fallback.js`</a>" file from the [`v1.0.2` release](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/tag/v1.0.2).
2. Place the file alongside your page.
3. Add the `script` tag (see [Quick Guide > HTML](#quick-guide)) to your page after Leaflet script.

#### CDN
You can alternatively use the free [RawGit](https://rawgit.com/) CDN service, but keep in mind that there are [no uptime or support guarantees](https://github.com/rgrove/rawgit/wiki/Frequently-Asked-Questions#i-need-guaranteed-100-uptime-should-i-use-cdnrawgitcom).
You 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)".

```html
<!-- After Leaflet script -->
<script src="https://cdn.rawgit.com/ghybs/Leaflet.TileLayer.Fallback/v1.0.1-gh2/dist/leaflet.tilelayer.fallback.js"></script>
<script src="https://unpkg.com/leaflet.tilelayer.fallback@1.0.2/dist/leaflet.tilelayer.fallback.js"></script>
```



### Creation

Simply use the `L.tileLayer.fallback` factory instead of your regular `L.tileLayer`:
Expand All @@ -76,16 +78,16 @@ myTileLayer.addTo(map);

| Factory | Description |
| :------ | :---------- |
| **L.tileLayer.fallback**( `<String>` [urlTemplate](http://leafletjs.com/reference.html#url-template), [`<TileLayer options>`](#options) options? ) | Instantiates a tile layer object given a [URL template](http://leafletjs.com/reference.html#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. |
| **L.tileLayer.fallback**( `<String>` [urlTemplate](http://leafletjs.com/reference-1.0.2.html#tilelayer-l-tilelayer), [`<TileLayer options>`](#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. |


### 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`](http://leafletjs.com/reference.html#tilelayer-errortileurl)). |
| **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. |

All other [TileLayer options](http://leafletjs.com/reference.html#tilelayer-options) are applicable.
All other [TileLayer options](http://leafletjs.com/reference-1.0.2.html#tilelayer-option) are applicable.


### Events
Expand All @@ -94,7 +96,7 @@ All other [TileLayer options](http://leafletjs.com/reference.html#tilelayer-opti
| :---- | :--- | :---------- |
| **tilefallback** | [`TileFallbackEvent`](#tilefallbackevent) | Fired when a tile is being replaced by a scaled up tile of lower zoom. |

All other [TileLayer events](http://leafletjs.com/reference.html#tilelayer-loading) are applicable.
All other [TileLayer events](http://leafletjs.com/reference-1.0.2.html#tilelayer-crossorigin) are applicable.


#### TileFallbackEvent
Expand All @@ -109,7 +111,7 @@ All other [TileLayer events](http://leafletjs.com/reference.html#tilelayer-loadi

### Methods

All regular [TileLayer methods](http://leafletjs.com/reference.html#tilelayer-addto) are applicable.
All regular [TileLayer methods](http://leafletjs.com/reference-1.0.2.html#tilelayer-method) are applicable.



Expand All @@ -127,5 +129,6 @@ the more missing zoom levels, the more time it takes to replace a tile.


## License
[![license](https://img.shields.io/github/license/ghybs/leaflet.tilelayer.fallback.svg)](LICENSE)

Leaflet.TileLayer.Fallback is distributed under the [Apache 2.0 License](http://choosealicense.com/licenses/apache-2.0/).

0 comments on commit 80d49c7

Please sign in to comment.