Add leaflet-providers

This commit is contained in:
Nabeel Shahzad
2018-05-14 14:14:27 -05:00
parent 3e96b195a6
commit 40c7fd8977
6 changed files with 31 additions and 26 deletions

View File

@@ -1,4 +1,7 @@
//
const leaflet = require('leaflet');
require('leaflet-providers');
export default (opts) => {
@@ -11,8 +14,9 @@ export default (opts) => {
set_marker: false,
}, opts);
/*
let feature_groups = [];
/*var openaip_airspace_labels = new leaflet.TileLayer.WMS(
const openaip_airspace_labels = new leaflet.TileLayer.WMS(
"http://{s}.tile.maps.openaip.net/geowebcache/service/wms", {
maxZoom: 14,
minZoom: 12,
@@ -26,16 +30,6 @@ export default (opts) => {
openaip_airspace_labels.addTo(map);*/
const opencyclemap_phys_osm = new leaflet.TileLayer(
'http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=f09a38fa87514de4890fc96e7fe8ecb1', {
maxZoom: 14,
minZoom: 4,
format: 'image/png',
transparent: true
})
feature_groups.push(opencyclemap_phys_osm)
/*const openaip_cached_basemap = new leaflet.TileLayer("http://{s}.tile.maps.openaip.net/geowebcache/service/tms/1.0.0/openaip_basemap@EPSG%3A900913@png/{z}/{x}/{y}.png", {
maxZoom: 14,
minZoom: 4,
@@ -49,22 +43,14 @@ export default (opts) => {
feature_groups.push(openaip_cached_basemap);
*/
const openaip_basemap_phys_osm = leaflet.featureGroup(feature_groups);
let map = leaflet.map('map', {
layers: [openaip_basemap_phys_osm],
//layers: [openaip_basemap_phys_osm],
center: opts.center,
zoom: opts.zoom,
scrollWheelZoom: false,
});
const attrib = leaflet.control.attribution({position: 'bottomleft'})
attrib.addAttribution('<a href="https://www.thunderforest.com" target="_blank" style="">Thunderforest</a>')
attrib.addAttribution('<a href="https://www.openaip.net" target="_blank" style="">openAIP</a>')
attrib.addAttribution('<a href="https://www.openstreetmap.org/copyright" target="_blank" style="">OpenStreetMap</a> contributors')
attrib.addAttribution('<a href="https://www.openweathermap.org" target="_blank" style="">OpenWeatherMap</a>')
leaflet.tileLayer.provider('Esri.WorldStreetMap').addTo(map);
attrib.addTo(map);
return map
return map;
};