Update leaflet providers to version 1.1.5.

This commit is contained in:
David Molineus
2015-10-30 23:40:15 +01:00
parent 7d8c0da0d2
commit b49da13abe
9 changed files with 154 additions and 28 deletions

View File

@@ -13,7 +13,7 @@ Contao CMS.
This package contains following packages: This package contains following packages:
- [leaflet 0.7.5](http://leafletjs.com) - [leaflet 0.7.5](http://leafletjs.com)
- [Leaflet-providers 1.0.12](http://leaflet-extras.github.io/leaflet-providers) - [Leaflet-providers 1.1.5](http://leaflet-extras.github.io/leaflet-providers)
- [Leaflet.markercluster 0.4.0](https://github.com/Leaflet/Leaflet.markercluster) - [Leaflet.markercluster 0.4.0](https://github.com/Leaflet/Leaflet.markercluster)
- [Leaflet-omnivore 0.3.2](https://github.com/mapbox/leaflet-omnivore) - [Leaflet-omnivore 0.3.2](https://github.com/mapbox/leaflet-omnivore)
- [Leaflet.loading 0.1.15](https://github.com/ebrelsford/Leaflet.loading) - [Leaflet.loading 0.1.15](https://github.com/ebrelsford/Leaflet.loading)

View File

@@ -0,0 +1,27 @@
# Leaflet-providers changelog
## master version
## 1.1.5 (2015-10-01)
- Improvements for the NLS layers (#182) by [@tomhughes](https://github.com/tomhughes)
- Check for valid bounds before fitting the preview map to undefined (fixes #185)
- Add bounds for FreeMapSK (fixes #184)
- Fix Stamen layers with `.jpg` extension (#187, fixes #184)
## 1.1.4 (2015-09-27)
- Only include the interesting files in the npm package (#180)
- Add GSGS_Ireland to NLS provider with `tms:true` to invert y-axis (#181)
## 1.1.3 (2015-09-26)
- Add various historical layers of the Natioanal library of Scotland (NLS) (#179)
- Add a page to visually check bounds (#179)
## 1.1.2 (2015-09-05)
- Add CartoDB labels-only styles (#170 by [@almccon](https://github.com/almccon))
- Implement commonjs module (#172)
- Added retina URL option (#177, [@routexl](https://github.com/routexl)
## 1.1.1 (2015-06-22)
- Update Mapbox API to v4 (#167 by [@gutenye](https://github.com/gutenye)).
- Started maintaining a changelog in CHANGELOG.md.

View File

@@ -15,6 +15,10 @@ L.tileLayer.provider('Stamen.Watercolor').addTo(map);
Leaflet-providers tries to use `https://` if the page uses `https://` and the provider supports it. Leaflet-providers tries to use `https://` if the page uses `https://` and the provider supports it.
You can force the use of `http://` by passing `force_http: true` in the options argument. You can force the use of `http://` by passing `force_http: true` in the options argument.
## Retina tiles
Some providers have retina tiles for which the URL only needs to be slightly adjusted, e.g. `-----@2x.png`. For this, add the retina option in the URL, e.g. `-----{retina}.png`, and set a retina value in the options, e.g. `retina: '@2x'`. If Leaflet detects a retina screen (`L.Browser.retina`), the retina option passed to the tileLayer is set to the value supplied, otherwise it's replaced by an empty string.
# Providers # Providers
Leaflet-providers provides tile layers from different providers, including *OpenStreetMap*, *MapQuestOpen*, *Stamen*, *Esri* and *OpenWeatherMap*. The full listing of free to use layers can be [previewed](http://leaflet-extras.github.io/leaflet-providers/preview/index.html). The page will show you the name to use with `leaflet-providers.js` and the code to use it without dependencies. Leaflet-providers provides tile layers from different providers, including *OpenStreetMap*, *MapQuestOpen*, *Stamen*, *Esri* and *OpenWeatherMap*. The full listing of free to use layers can be [previewed](http://leaflet-extras.github.io/leaflet-providers/preview/index.html). The page will show you the name to use with `leaflet-providers.js` and the code to use it without dependencies.
@@ -38,9 +42,9 @@ L.tileLayer.provider('HERE.terrainDay', {
### Mapbox ### Mapbox
In order to use Mapbox maps, you must [register](https://tiles.mapbox.com/signup). If your user name is `YourName` and your map is called `MyMap` you can add it with: In order to use Mapbox maps, you must [register](https://tiles.mapbox.com/signup). You can get map ID and ACCESS_TOKEN from [Mapbox projects](https://www.mapbox.com/projects):
```JavaScript ```JavaScript
L.tileLayer.provider('MapBox.YourName.MyMap'); L.tileLayer.provider('MapBox', {id: 'ID', accessToken: 'ACCESS_TOKEN'}).addTo(map);
``` ```
### Esri/ArcGIS ### Esri/ArcGIS

View File

@@ -1,6 +1,6 @@
{ {
"name": "leaflet-providers", "name": "leaflet-providers",
"version": "1.1.0", "version": "1.1.5",
"homepage": "https://github.com/leaflet-extras/leaflet-providers", "homepage": "https://github.com/leaflet-extras/leaflet-providers",
"description": "An extension to Leaflet that contains configurations for various free tile providers.", "description": "An extension to Leaflet that contains configurations for various free tile providers.",
"dependencies": { "dependencies": {

View File

@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- Leaflet style. REQUIRED! --> <!-- Leaflet style. REQUIRED! -->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" /> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
<style> <style>
html { height: 100% } html { height: 100% }
body { height: 100%; margin: 0; padding: 0;} body { height: 100%; margin: 0; padding: 0;}
@@ -26,7 +26,7 @@
</div> </div>
<div id="map" class="map"></div> <div id="map" class="map"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<script src="leaflet-providers.js"></script> <script src="leaflet-providers.js"></script>
<script> <script>
var map = L.map('map', { var map = L.map('map', {
@@ -48,7 +48,7 @@
'Hydda Full': L.tileLayer.provider('Hydda.Full'), 'Hydda Full': L.tileLayer.provider('Hydda.Full'),
'MapQuest OSM': L.tileLayer.provider('MapQuestOpen.OSM'), 'MapQuest OSM': L.tileLayer.provider('MapQuestOpen.OSM'),
'MapQuest Aerial': L.tileLayer.provider('MapQuestOpen.Aerial'), 'MapQuest Aerial': L.tileLayer.provider('MapQuestOpen.Aerial'),
'MapBox Example': L.tileLayer.provider('MapBox.examples.map-zr0njcqy'), 'MapBox Example': L.tileLayer.provider('MapBox', {id: 'mapbox.streets', accessToken: 'pk.eyJ1IjoiZ3V0ZW55ZSIsImEiOiJmNjJlMDNmYTUyMzNjMzQxZmY4Mzc1ZmFiYmExNjMxOSJ9.xgl1PBwQV9CtwW-usedrcQ'}),
'Stamen Toner': L.tileLayer.provider('Stamen.Toner'), 'Stamen Toner': L.tileLayer.provider('Stamen.Toner'),
'Stamen Terrain': L.tileLayer.provider('Stamen.Terrain'), 'Stamen Terrain': L.tileLayer.provider('Stamen.Terrain'),
'Stamen Watercolor': L.tileLayer.provider('Stamen.Watercolor'), 'Stamen Watercolor': L.tileLayer.provider('Stamen.Watercolor'),

View File

@@ -1,11 +1,14 @@
(function (root, factory) { (function (root, factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define(['leaflet'], factory); define(['leaflet'], factory);
} else { } else if (typeof modules === 'object' && module.exports) {
// Assume leaflet is loaded into global object L already // define a Common JS module that relies on 'leaflet'
factory(L); module.exports = factory(require('leaflet'));
} } else {
// Assume Leaflet is loaded into global object L already
factory(L);
}
}(this, function (L) { }(this, function (L) {
'use strict'; 'use strict';
@@ -54,6 +57,19 @@
provider.url = 'http:' + provider.url; provider.url = 'http:' + provider.url;
} }
// If retina option is set
if (provider.options.retina) {
// Check retina screen
if (options.detectRetina && L.Browser.retina) {
// The retina option will be active now
// But we need to prevent Leaflet retina mode
options.detectRetina = false;
} else {
// No retina, remove option
provider.options.retina = '';
}
}
// replace attribution placeholders with their values from toplevel provider attribution, // replace attribution placeholders with their values from toplevel provider attribution,
// recursively // recursively
var attributionReplacer = function (attr) { var attributionReplacer = function (attr) {
@@ -222,9 +238,7 @@
} }
}, },
MapBox: { MapBox: {
url: function (id) { url: '//api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
return '//{s}.tiles.mapbox.com/v3/' + id + '/{z}/{x}/{y}.png';
},
options: { options: {
attribution: attribution:
'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> &mdash; ' + 'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> &mdash; ' +
@@ -233,7 +247,7 @@
} }
}, },
Stamen: { Stamen: {
url: '//stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.png', url: '//stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
options: { options: {
attribution: attribution:
'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' + 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
@@ -490,11 +504,12 @@
} }
}, },
FreeMapSK: { FreeMapSK: {
url: 'http://{s}.freemap.sk/T/{z}/{x}/{y}.jpeg', url: 'http://t{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
options: { options: {
minZoom: 8, minZoom: 8,
maxZoom: 16, maxZoom: 16,
subdomains: ['t1', 't2', 't3', 't4'], subdomains: '1234',
bounds: [[47.204642, 15.996093], [49.830896, 22.576904]],
attribution: attribution:
'{attribution.OpenStreetMap}, vizualization CC-By-SA 2.0 <a href="http://freemap.sk">Freemap.sk</a>' '{attribution.OpenStreetMap}, vizualization CC-By-SA 2.0 <a href="http://freemap.sk">Freemap.sk</a>'
} }
@@ -517,8 +532,10 @@
variants: { variants: {
Positron: 'light_all', Positron: 'light_all',
PositronNoLabels: 'light_nolabels', PositronNoLabels: 'light_nolabels',
PositronOnlyLabels: 'light_only_labels',
DarkMatter: 'dark_all', DarkMatter: 'dark_all',
DarkMatterNoLabels: 'dark_nolabels' DarkMatterNoLabels: 'dark_nolabels',
DarkMatterOnlyLabels: 'dark_only_labels'
} }
}, },
HikeBike: { HikeBike: {
@@ -621,6 +638,78 @@
} }
} }
} }
},
NLS: {
// Maps from http://maps.nls.uk/geo/explore/
url: '//nls-{s}.tileserver.com/{variant}/{z}/{x}/{y}.jpg',
options: {
attribution: '<a href="http://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>',
bounds: [[49.6, -12], [61.7, 3]],
minZoom: 1,
maxZoom: 18,
subdomains: '0123',
},
variants: {
// OS 1:1m to 1:10K, 1900s
// z0-10 - 1:1m
// z11-12 - ?
// z13-14 - one inch (1:63360)
// z15-18 - six inch (1:10560)
'OS_1900': 'NLS_API',
// OS 1:1m to 1:63K, 1920s-1940s
// z0-9 - 1:1m
// z10-11 - quarter inch (1:253440)
// z12-18 - one inch (1:63360)
'OS_1920': 'nls',
'OS_opendata': {
url: 'http://geo.nls.uk/maps/opendata/{z}/{x}/{y}.png',
options: {
maxZoom: 16
}
},
// OS six inch, 1843 - 1882
'OS_6inch_1st': {
url: 'http://geo.nls.uk/maps/os/six_inch/{z}/{x}/{y}.png',
options: {
tms: true,
minZoom: 6,
maxZoom: 16,
bounds: [[49.86261, -8.66444], [60.89421, 1.7785]]
}
},
// OS six inch, 1888 - 1913
'OS_6inch': 'os_6_inch_gb',
// OS 1:25000, 1937 - 1961
'OS_25k': '25k',
// OS one inch, 1945 - 1947
'OS_npe': {
url: 'http://geo.nls.uk/maps/os/newpopular/{z}/{x}/{y}.png',
options: {
tms: true,
minZoom: 3,
maxZoom: 15
}
},
// OS one inch, 1952 - 1961
'OS_7th': 'os7gb',
// OS 1:1056, 1893 - 1896
'OS_London': {
options: {
variant: 'London_1056',
minZoom: 9,
bounds: [[51.177621, -0.708618], [51.618016, 0.355682]]
}
},
'GSGS_Ireland': {
url: 'http://geo.nls.uk/maps/ireland/gsgs4136/{z}/{x}/{y}.png',
options: {
tms: true,
minZoom: 5,
maxZoom: 15,
bounds: [[51.371780, -10.810546], [55.422779, -5.262451]]
}
}
}
} }
}; };

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "leaflet-providers", "name": "leaflet-providers",
"version": "1.1.0", "version": "1.1.5",
"description": "An extension to Leaflet that contains configurations for various free tile providers.", "description": "An extension to Leaflet that contains configurations for various free tile providers.",
"main": "leaflet-providers.js", "main": "leaflet-providers.js",
"repository": { "repository": {
@@ -10,7 +10,7 @@
"scripts": { "scripts": {
"test": "npm run lint && npm run testsuite", "test": "npm run lint && npm run testsuite",
"testsuite": "mocha-phantomjs tests/index.html", "testsuite": "mocha-phantomjs tests/index.html",
"lint": "eslint --config .eslintrc leaflet-providers.js preview/preview.js preview/shared.js preview/https-support.js tests/test.js", "lint": "eslint --config .eslintrc leaflet-providers.js preview/*.js tests/test.js",
"min": "uglifyjs leaflet-providers.js -mc -o leaflet-providers.min.js", "min": "uglifyjs leaflet-providers.js -mc -o leaflet-providers.min.js",
"release": "mversion patch -m" "release": "mversion patch -m"
}, },
@@ -18,14 +18,20 @@
"bugs": { "bugs": {
"url": "https://github.com/leaflet-extras/leaflet-providers/issues" "url": "https://github.com/leaflet-extras/leaflet-providers/issues"
}, },
"files": [
"leaflet-providers.js",
"README.md",
"CHANGELOG.md",
"licence.md"
],
"devDependencies": { "devDependencies": {
"chai": "^2.3.0", "chai": "^2.3.0",
"eslint": "^0.15.0", "eslint": "^1.1.0",
"mocha": "^2.2.4", "mocha": "^2.2.4",
"mocha-phantomjs": "^3.5.3", "mocha-phantomjs": "^3.5.3",
"mversion": "^1.3.0", "mversion": "^1.3.0",
"uglify-js": "^2.4.15", "phantomjs": "1.9.7-15",
"phantomjs": "^1.9.16" "uglify-js": "^2.4.15"
}, },
"autoupdate": { "autoupdate": {
"source": "git", "source": "git",

View File

@@ -27,7 +27,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet'] = array
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-providers'] = array $GLOBALS['LEAFLET_LIBRARIES']['leaflet-providers'] = array
( (
'name' => 'Leaflet-providers', 'name' => 'Leaflet-providers',
'version' => '1.1.0', 'version' => '1.1.5',
'license' => '<a href="https://github.com/leaflet-extras/leaflet-providers/blob/master/license.md" target="_blank">BSD-2-Clause</a>', 'license' => '<a href="https://github.com/leaflet-extras/leaflet-providers/blob/master/license.md" target="_blank">BSD-2-Clause</a>',
'homepage' => 'http://leaflet-extras.github.io/leaflet-providers', 'homepage' => 'http://leaflet-extras.github.io/leaflet-providers',
'javascript' => 'assets/leaflet/libs/leaflet-providers/leaflet-providers.min.js' 'javascript' => 'assets/leaflet/libs/leaflet-providers/leaflet-providers.min.js'