From 49e7e288483d1800fcb4de0fcce02c70925a3aff Mon Sep 17 00:00:00 2001 From: Joxit Date: Fri, 28 Feb 2020 18:39:20 +0100 Subject: [PATCH] Add Jawg Maps provider --- README.md | 11 +++++++++++ index.html | 2 ++ leaflet-providers.js | 23 +++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/README.md b/README.md index 3b4c7644..78447dc8 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,17 @@ L.tileLayer.provider('HERE.terrainDay', { }).addTo(map); ``` +### Jawg Maps + +In order to use Jawg Maps, you must [register](https://www.jawg.io/lab). Once registered, your access token will be located [here](https://www.jawg.io/lab/access-tokens) and you will access to all Jawg default maps (variants) and your own customized maps : + +```JavaScript +L.tileLayer.provider('Jawg.Streets', { + variant: '', + accessToken: '' +}).addTo(map); +``` + ### Mapbox 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): diff --git a/index.html b/index.html index 91cc1f60..d306c77c 100644 --- a/index.html +++ b/index.html @@ -48,6 +48,8 @@ 'Stamen Toner': L.tileLayer.provider('Stamen.Toner'), 'Stamen Terrain': L.tileLayer.provider('Stamen.Terrain'), 'Stamen Watercolor': L.tileLayer.provider('Stamen.Watercolor'), + 'Jawg Streets': L.tileLayer.provider('Jawg.Streets'), + 'Jawg Terrain': L.tileLayer.provider('Jawg.Terrain'), 'Esri WorldStreetMap': L.tileLayer.provider('Esri.WorldStreetMap'), 'Esri DeLorme': L.tileLayer.provider('Esri.DeLorme'), 'Esri WorldTopoMap': L.tileLayer.provider('Esri.WorldTopoMap'), diff --git a/leaflet-providers.js b/leaflet-providers.js index 208b6257..1cb6bfe2 100644 --- a/leaflet-providers.js +++ b/leaflet-providers.js @@ -288,6 +288,29 @@ RoadsAndLabels: 'roads_and_labels' } }, + Jawg: { + url: 'https://{s}.tile.jawg.io/{variant}/{z}/{x}/{y}{r}.png?access-token={accessToken}', + options: { + attribution: + '© JawgMaps ' + + '{attribution.OpenStreetMap}', + minZoom: 0, + maxZoom: 22, + subdomains: 'abcd', + variant: 'jawg-terrain', + // Get your own Jawg access token here : https://www.jawg.io/lab/ + // NB : this is a demonstration key that comes with no guarantee + accessToken: 'PyTJUlEU1OPJwCJlW1k0NC8JIt2CALpyuj7uc066O7XbdZCjWEL3WYJIk6dnXtps', + }, + variants: { + Streets: 'jawg-streets', + Terrain: 'jawg-terrain', + Sunny: 'jawg-sunny', + Dark: 'jawg-dark', + Light: 'jawg-light', + Matrix: 'jawg-matrix' + } + }, MapBox: { url: 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}{r}.png?access_token={accessToken}', options: {