Update leaflet providers to 1.3.1.

This commit is contained in:
David Molineus
2018-08-23 15:35:24 +02:00
parent 5b86360c35
commit 44d1cf9550
7 changed files with 216 additions and 59 deletions

View File

@@ -1,6 +1,32 @@
# Leaflet-providers changelog
## 1.3.1 (2018-06-20)
- No retina tiles for `Stamen.Watercolor` & `TopOSMRelief` [286](https://github.com/leaflet-extras/leaflet-providers/pull/286)
## 1.3.0 (2018-06-16)
- Added `GeoportailFrance` provider [284](https://github.com/leaflet-extras/leaflet-providers/pull/284)
- Removed mention to protocol relativity in README.md
## 1.2.0 (2018-06-05)
- Make preview usable locally [256](https://github.com/leaflet-extras/leaflet-providers/pull/256)
- Always use https when available [258](https://github.com/leaflet-extras/leaflet-providers/pull/258)
- Added API Key for OpenWeatherMap [260](https://github.com/leaflet-extras/leaflet-providers/pull/260)
- Fixed attribution of basemap.at [261](https://github.com/leaflet-extras/leaflet-providers/pull/261)
- Added installation instructions [263](https://github.com/leaflet-extras/leaflet-providers/pull/263)
- Added `Wikimedia` provider [266](https://github.com/leaflet-extras/leaflet-providers/pull/266)
- Added `OpenInfraMap`/ `OpenPtMap` / `OpenRailwayMap` / `OpenFireMap` / `SafeCast` [266](https://github.com/leaflet-extras/leaflet-providers/pull/266)
- Switched osm bzh to https [269](https://github.com/leaflet-extras/leaflet-providers/pull/269)
- Added `OpenStreetMap.CH` bounding box + `Wikimedia` retina parameter and correct maxZoom [271](https://github.com/leaflet-extras/leaflet-providers/pull/271)
- Fixed test for providers keys
- Mention leaflet in usage example in README.md
- Removed mention to `force_http` in README.md [273](https://github.com/leaflet-extras/leaflet-providers/pull/273)
- Added informations about Thunderforest key in README.md [277](https://github.com/leaflet-extras/leaflet-providers/pull/277)
- Added retina support for `MapBox` [280](https://github.com/leaflet-extras/leaflet-providers/pull/280)
- Added `CartoDB.Voyager` variants `MapBox` [281](https://github.com/leaflet-extras/leaflet-providers/pull/281)
- Removed homegrown retina detection and added retina support for `CartoDB` & `Stamen`
## 1.1.17 (2017-06-29)
- Added `maxZoom` for `Hydda` provider [242](https://github.com/leaflet-extras/leaflet-providers/pull/242)
- Fixed `maxZoom` for all layers from the `thunderforest` provider
@@ -9,7 +35,7 @@
- Added `nlmaps` provider [#254](https://github.com/leaflet-extras/leaflet-providers/pull/254)
## 1.1.16 (2016-11-04)
- Updates to reflect changes in [BasemapAT](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=BasemapAT) by [@ximex](https://github.com/ximex), [#232]((https://github.com/leaflet-extras/leaflet-providers/pull/232), [#233]((https://github.com/leaflet-extras/leaflet-providers/pull/233)
- Updates to reflect changes in [BasemapAT](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=BasemapAT) by [@ximex](https://github.com/ximex), [#232](https://github.com/leaflet-extras/leaflet-providers/pull/232), [#233](https://github.com/leaflet-extras/leaflet-providers/pull/233)
- Bump leaflet version in tests and preview to 1.0.1.
- Added some layers from http://justicemap.org [#224](https://github.com/leaflet-extras/leaflet-providers/pull/224).

View File

@@ -2,7 +2,18 @@ Leaflet-providers
=================
An extension to [Leaflet](http://leafletjs.com/) that contains configurations for various free<sup>[1](#what-is-free)</sup> tile providers.
# Installation
Download [leaflet-providers.js](https://raw.githubusercontent.com/leaflet-extras/leaflet-providers/master/leaflet-providers.js) and include it in your page after including Leaflet, e.g.:
<head>
...
<script src="http://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
<script src="js/leaflet-providers.js"></script>
</head>
# Usage
Leaflet-providers [providers](#providers) are refered to with a `provider[.<variant>]`-string. Let's say you want to add the nice [Watercolor](http://maps.stamen.com/#watercolor/) style from Stamen to your map, you pass `Stamen.Watercolor` to the `L.tileLayer.provider`-constructor, which will return a [L.TileLayer](http://leafletjs.com/reference.html#tilelayer) instance for Stamens Watercolor tile layer.
```Javascript
@@ -10,15 +21,6 @@ Leaflet-providers [providers](#providers) are refered to with a `provider[.<vari
L.tileLayer.provider('Stamen.Watercolor').addTo(map);
```
## Protocol relativity (`https://`-urls)
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.
## 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
Leaflet-providers provides tile layers from different providers, including *OpenStreetMap*, *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.
@@ -42,9 +44,19 @@ L.tileLayer.provider('HERE.terrainDay', {
### Mapbox
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):
In order to use Mapbox maps, you must [register](https://tiles.mapbox.com/signup). You can get map_ID (i.e mapbox.satellite) and ACCESS_TOKEN from [Mapbox projects](https://www.mapbox.com/projects):
```JavaScript
L.tileLayer.provider('MapBox', {id: 'ID', accessToken: 'ACCESS_TOKEN'}).addTo(map);
L.tileLayer.provider('MapBox', {
id: 'ID': '<insert map_ID here>',
accessToken: '<insert ACCESS_TOKEN here>'
}).addTo(map);
```
### Thunderforest
In order to use Thunderforest maps, you must [register](https://thunderforest.com/pricing/). Once registered, you have an `api_key` which you have to pass to `L.tileLayer.provider` in the options:
```JavaScript
L.tileLayer.provider('Thunderforest.Landscape', {apikey: '<insert api_key here>'}).addTo(map);
```
### Esri/ArcGIS
@@ -53,6 +65,21 @@ In order to use ArcGIS maps, you must [register](https://developers.arcgis.com/e
[Available Esri layers](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=Esri)
### Geoportail France
In order to use Geoportail France resources, you need to obtain an [api key]( http://professionnels.ign.fr/ign/contrats/) that allows you to access the [resources](https://geoservices.ign.fr/documentation/donnees-ressources-wmts.html#ressources-servies-en-wmts-en-projection-web-mercator) you need. Pass this api key and the ID of the resource to display to `L.tileLayer.provider` in the options:
```JavaScript
L.tileLayer.provider('GeoportailFrance', {
variant: '<insert resource ID here>',
apikey: '<insert api key here>'
}).addTo(map);
```
Please note that a public api key (`choisirgeoportail`) is used by default and comes with no guarantee.
4 aliases are also provided for common Geoportail resources : `GeoportailFrance`, `GeoportailFrance.orthos`, `GeoportailFrance.ignMaps` and `GeoportailFrance.parcels` (See index.html demo).
# Attribution
This work was inspired from <https://gist.github.com/1804938>, and originally created by [Stefan Seelmann](https://github.com/seelmann).

View File

@@ -50,24 +50,6 @@
};
}
var forceHTTP = window.location.protocol === 'file:' || provider.options.forceHTTP;
if (provider.url.indexOf('//') === 0 && forceHTTP) {
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,
// recursively
var attributionReplacer = function (attr) {
@@ -95,7 +77,7 @@
L.TileLayer.Provider.providers = {
OpenStreetMap: {
url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
options: {
maxZoom: 19,
attribution:
@@ -110,41 +92,97 @@
}
},
DE: {
url: '//{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
options: {
maxZoom: 18
}
},
CH: {
url: 'https://tile.osm.ch/switzerland/{z}/{x}/{y}.png',
options: {
maxZoom: 18,
bounds: [[45, 5], [48, 11]]
}
},
France: {
url: '//{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
options: {
maxZoom: 20,
attribution: '&copy; Openstreetmap France | {attribution.OpenStreetMap}'
}
},
HOT: {
url: '//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
options: {
attribution: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
}
},
BZH: {
url: 'https://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png',
options: {
attribution: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://www.openstreetmap.bzh/" target="_blank">Breton OpenStreetMap Team</a>',
bounds: [[46.2, -5.5], [50, 0.7]]
}
}
}
},
OpenInfraMap: {
url: 'https://tiles-{s}.openinframap.org/{variant}/{z}/{x}/{y}.png',
options: {
maxZoom: 18,
attribution:
'{attribution.OpenStreetMap}, <a href="http://www.openinframap.org/about.html">About OpenInfraMap</a>'
},
variants: {
Power: 'power',
Telecom: 'telecoms',
Petroleum: 'petroleum',
Water: 'water'
}
},
OpenSeaMap: {
url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
options: {
attribution: 'Map data: &copy; <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'
}
},
OpenPtMap: {
url: 'http://openptmap.org/tiles/{z}/{x}/{y}.png',
options: {
maxZoom: 17,
attribution: 'Map data: &copy; <a href="http://www.openptmap.org">OpenPtMap</a> contributors'
}
},
OpenTopoMap: {
url: '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
url: 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
options: {
maxZoom: 17,
attribution: 'Map data: {attribution.OpenStreetMap}, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}
},
OpenRailwayMap: {
url: 'https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png',
options: {
maxZoom: 19,
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="https://www.OpenRailwayMap.org">OpenRailwayMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}
},
OpenFireMap: {
url: 'http://openfiremap.org/hytiles/{z}/{x}/{y}.png',
options: {
maxZoom: 19,
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="http://www.openfiremap.org">OpenFireMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}
},
SafeCast: {
url: 'https://s3.amazonaws.com/te512.safecast.org/{z}/{x}/{y}.png',
options: {
maxZoom: 16,
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="https://blog.safecast.org/about/">SafeCast</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}
},
Thunderforest: {
url: '//{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}',
url: 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}',
options: {
attribution:
'&copy; <a href="http://www.thunderforest.com/">Thunderforest</a>, {attribution.OpenStreetMap}',
@@ -175,7 +213,7 @@
}
},
OpenMapSurfer: {
url: 'http://korona.geog.uni-heidelberg.de/tiles/{variant}/x={x}&y={y}&z={z}',
url: 'https://korona.geog.uni-heidelberg.de/tiles/{variant}/x={x}&y={y}&z={z}',
options: {
maxZoom: 20,
variant: 'roads',
@@ -198,7 +236,7 @@
}
},
Hydda: {
url: '//{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png',
options: {
maxZoom: 18,
variant: 'full',
@@ -211,7 +249,7 @@
}
},
MapBox: {
url: '//api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
url: 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}{r}.png?access_token={accessToken}',
options: {
attribution:
'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> &mdash; ' +
@@ -222,7 +260,7 @@
}
},
Stamen: {
url: '//stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}',
options: {
attribution:
'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
@@ -242,6 +280,7 @@
TonerLabels: 'toner-labels',
TonerLite: 'toner-lite',
Watercolor: {
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
options: {
variant: 'watercolor',
minZoom: 1,
@@ -263,6 +302,7 @@
}
},
TopOSMRelief: {
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
options: {
variant: 'toposm-color-relief',
ext: 'jpg',
@@ -279,7 +319,7 @@
}
},
Esri: {
url: '//server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
options: {
variant: 'World_Street_Map',
attribution: 'Tiles &copy; Esri'
@@ -363,10 +403,11 @@
}
},
OpenWeatherMap: {
url: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png',
url: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}',
options: {
maxZoom: 19,
attribution: 'Map data &copy; <a href="http://openweathermap.org">OpenWeatherMap</a>',
apiKey:'<insert your api key here>',
opacity: 0.5
},
variants: {
@@ -394,7 +435,7 @@
* envirionments.
*/
url:
'//{s}.{base}.maps.cit.api.here.com/maptile/2.1/' +
'https://{s}.{base}.maps.cit.api.here.com/maptile/2.1/' +
'{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?' +
'app_id={app_id}&app_code={app_code}&lg={language}',
options: {
@@ -496,7 +537,7 @@
}
},
CartoDB: {
url: 'http://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}.png',
url: 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.png',
options: {
attribution: '{attribution.OpenStreetMap} &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
subdomains: 'abcd',
@@ -509,7 +550,11 @@
PositronOnlyLabels: 'light_only_labels',
DarkMatter: 'dark_all',
DarkMatterNoLabels: 'dark_nolabels',
DarkMatterOnlyLabels: 'dark_only_labels'
DarkMatterOnlyLabels: 'dark_only_labels',
Voyager: 'rastertiles/voyager',
VoyagerNoLabels: 'rastertiles/voyager_nolabels',
VoyagerOnlyLabels: 'rastertiles/voyager_only_labels',
VoyagerLabelsUnder: 'rastertiles/voyager_labels_under'
}
},
HikeBike: {
@@ -533,7 +578,7 @@
url: 'https://maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}',
options: {
maxZoom: 19,
attribution: 'Datenquelle: <a href="www.basemap.at">basemap.at</a>',
attribution: 'Datenquelle: <a href="https://www.basemap.at">basemap.at</a>',
subdomains: ['', '1', '2', '3', '4'],
format: 'png',
bounds: [[46.358770, 8.782379], [49.037872, 17.189532]],
@@ -563,8 +608,25 @@
}
}
},
nlmaps: {
url: 'https://geodata.nationaalgeoregister.nl/tiles/service/wmts/{variant}/EPSG:3857/{z}/{x}/{y}.png',
options: {
minZoom: 6,
maxZoom: 19,
bounds: [[50.5, 3.25], [54, 7.6]],
attribution: 'Kaartgegevens &copy; <a href="kadaster.nl">Kadaster</a>'
},
variants: {
'standaard': 'brtachtergrondkaart',
'pastel': 'brtachtergrondkaartpastel',
'grijs': 'brtachtergrondkaartgrijs',
'luchtfoto': {
'url': 'https://geodata.nationaalgeoregister.nl/luchtfoto/rgb/wmts/1.0.0/2016_ortho25/EPSG:3857/{z}/{x}/{y}.png',
}
}
},
NASAGIBS: {
url: '//map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}',
url: 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}',
options: {
attribution:
'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System ' +
@@ -628,7 +690,7 @@
// z0-9 - 1:1m
// z10-11 - quarter inch (1:253440)
// z12-18 - one inch (1:63360)
url: '//nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg',
url: 'https://nls-{s}.tileserver.com/nls/{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]],
@@ -660,6 +722,47 @@
white: 'white',
plurality: 'plural'
}
},
Wikimedia: {
url: 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png',
options: {
attribution: '<a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use">Wikimedia</a>',
minZoom: 1,
maxZoom: 19
}
},
GeoportailFrance: {
url: 'https://wxs.ign.fr/{apikey}/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE={style}&TILEMATRIXSET=PM&FORMAT={format}&LAYER={variant}&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
options: {
attribution: '<a target="_blank" href="https://www.geoportail.gouv.fr/">Geoportail France</a>',
bounds: [[-75, -180], [81, 180]],
minZoom: 2,
maxZoom: 18,
// Get your own geoportail apikey here : http://professionnels.ign.fr/ign/contrats/
// NB : 'choisirgeoportail' is a demonstration key that comes with no guarantee
apikey: 'choisirgeoportail',
format: 'image/jpeg',
style : 'normal',
variant: 'GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD'
},
variants: {
parcels: {
options : {
variant: 'CADASTRALPARCELS.PARCELS',
maxZoom: 20,
style : 'bdparcellaire',
format: 'image/png'
}
},
ignMaps: 'GEOGRAPHICALGRIDSYSTEMS.MAPS',
maps: 'GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD',
orthos: {
options: {
maxZoom: 19,
variant: 'ORTHOIMAGERY.ORTHOPHOTOS'
}
}
}
}
};

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "leaflet-providers",
"version": "1.1.17",
"version": "1.3.1",
"description": "An extension to Leaflet that contains configurations for various free tile providers.",
"main": "leaflet-providers.js",
"repository": {
@@ -12,7 +12,8 @@
"testsuite": "phantomjs ./node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js tests/index.html",
"lint": "eslint --config .eslintrc leaflet-providers.js index.html preview/*.js preview/*.html tests/*",
"min": "uglifyjs leaflet-providers.js -mc -o leaflet-providers.min.js",
"release": "mversion patch -m"
"release": "mversion patch -m",
"release-minor": "mversion minor -m"
},
"license": "BSD-2-Clause",
"bugs": {
@@ -25,13 +26,13 @@
"licence.md"
],
"devDependencies": {
"chai": "^2.3.0",
"chai": "^4.1.2",
"eslint": "^3.16.1",
"eslint-plugin-html": "^2.0.1",
"mocha": "^2.2.4",
"mocha-phantomjs-core": "^2.0.1",
"mversion": "^1.3.0",
"phantomjs-prebuilt": "^2.1.4",
"mocha": "^3.2.0",
"mocha-phantomjs-core": "^2.1.1",
"mversion": "^1.10.1",
"phantomjs-prebuilt": "^2.1.16",
"uglify-js": "^2.4.15"
},
"autoupdate": {