jekyll-leaflet 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-leaflet.rb +4 -30
- data/lib/jekyll-leaflet/_parse-liquid.rb +13 -0
- data/lib/jekyll-leaflet/filters/replace-hrefs.rb +35 -0
- data/lib/jekyll-leaflet/leaflet-items/leaflet-geojson.rb +24 -0
- data/lib/jekyll-leaflet/leaflet-items/leaflet-marker.rb +25 -0
- data/lib/jekyll-leaflet/leaflet-map.html +2 -0
- data/lib/jekyll-leaflet/leaflet-map.js +208 -0
- data/lib/jekyll-leaflet/leaflet-map.rb +49 -0
- data/lib/jekyll-leaflet/leaflet-providers-license.md +8 -0
- data/lib/jekyll-leaflet/leaflet-providers.js +815 -0
- metadata +16 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 817a2ad94a1ce6fcd8360b8ce758c96e423daa8b5780999ea8ca220f888cd15f
|
4
|
+
data.tar.gz: c76d85df88b2f97c42b4fed3eef29787c0b1da0af0f5b9892c412c4910b8ea8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 708ac156c2ce925db7073c7fe523cefc5cbff8ce407c47a1298ae6c05b8d20cb88743213e140ca8da0af68532c428b8fca2b959642ae23afd2df2e4f2277e229
|
7
|
+
data.tar.gz: dcecb0327f8b9583ef87c08b2c167f6be841500eba0102a73773dde4aaf3fa6811df3efaa24a8a19d12c9c6f05d2345821d98388a51c8520417d4618cf7bc1d0
|
data/lib/jekyll-leaflet.rb
CHANGED
@@ -1,30 +1,4 @@
|
|
1
|
-
require "jekyll"
|
2
|
-
require "
|
3
|
-
|
4
|
-
|
5
|
-
class LeafletEmbed < Liquid::Block
|
6
|
-
|
7
|
-
def initialize(tagName, content, tokens)
|
8
|
-
super
|
9
|
-
@content = content
|
10
|
-
end
|
11
|
-
|
12
|
-
def render(context)
|
13
|
-
# query = URI::encode_www_form(["data", super]) # super gets tag block contents
|
14
|
-
uri = "https://overpass-api.de/api/interpreter"
|
15
|
-
response = Net::HTTP.post_form(uri, 'data' => super)
|
16
|
-
@geojson_file = "#{SecureRandom.uuid}.geojson"
|
17
|
-
File.write(geojson_file, response.body);
|
18
|
-
|
19
|
-
tmpl_path = File.join Dir.pwd, "_includes", "leaflet.html"
|
20
|
-
if File.exist?(tmpl_path)
|
21
|
-
tmpl = File.read tmpl_path
|
22
|
-
site = context.registers[:site]
|
23
|
-
tmpl = (Liquid::Template.parse tmpl).render site.site_payload.merge!({"geojson_file" => @geojson_file})
|
24
|
-
else
|
25
|
-
%q(<div id=map)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
Liquid::Template.register_tag "leaflet", self
|
30
|
-
end
|
1
|
+
require "jekyll-leaflet/leaflet-map"
|
2
|
+
require "jekyll-leaflet/leaflet-items/leaflet-marker"
|
3
|
+
require "jekyll-leaflet/leaflet-items/leaflet-geojson"
|
4
|
+
require "jekyll-leaflet/filters/replace-hrefs"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "json"
|
2
|
+
def parse_liquid_output_in(input, context)
|
3
|
+
output = input.to_s()
|
4
|
+
for match in output.scan(/{{[^,]*}}/)
|
5
|
+
stripped = match.gsub("{{","").gsub("}}","").strip
|
6
|
+
value = "#{context[stripped]}"
|
7
|
+
if value.empty?
|
8
|
+
value = match
|
9
|
+
end
|
10
|
+
output = output.sub(match, value)
|
11
|
+
end
|
12
|
+
return output
|
13
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "json"
|
2
|
+
module Jekyll
|
3
|
+
module OverrideHRefsFilter
|
4
|
+
def override_hrefs(input, href)
|
5
|
+
geojson_obj = JSON.parse(input)
|
6
|
+
geojson_obj = _recurs_href_replace(geojson_obj, href)
|
7
|
+
return JSON.generate(geojson_obj)
|
8
|
+
end
|
9
|
+
|
10
|
+
def _recurs_href_replace(obj, href)
|
11
|
+
if obj.is_a? Hash
|
12
|
+
obj.each_pair do |key, value|
|
13
|
+
if key == "href"
|
14
|
+
obj[key] = href
|
15
|
+
elsif key == "properties"
|
16
|
+
obj[key]["href"] = href
|
17
|
+
else
|
18
|
+
obj[key] = _recurs_href_replace(value, href)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
if obj.is_a? Array
|
23
|
+
new_arr = []
|
24
|
+
for entry in obj
|
25
|
+
new_arr.push(_recurs_href_replace(entry, href))
|
26
|
+
end
|
27
|
+
obj = new_arr
|
28
|
+
end
|
29
|
+
|
30
|
+
obj
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Liquid::Template.register_filter(Jekyll::OverrideHRefsFilter)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "securerandom"
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
class LeafletGeoJSON < Liquid::Tag
|
5
|
+
|
6
|
+
def initialize(tag_name, input, tokens)
|
7
|
+
super
|
8
|
+
if input.empty?
|
9
|
+
@input = '{}'
|
10
|
+
else
|
11
|
+
@input = input
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def render(context)
|
16
|
+
value = parse_liquid_output_in(@input, context)
|
17
|
+
'{id: "' + SecureRandom.hex + '",
|
18
|
+
type: "LeafletGeoJSON",
|
19
|
+
value: ' + value + '},'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Liquid::Template.register_tag('leaflet_geojson', Jekyll::LeafletGeoJSON)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "securerandom"
|
2
|
+
require_relative("../_parse-liquid.rb")
|
3
|
+
|
4
|
+
module Jekyll
|
5
|
+
class LeafletMarker < Liquid::Tag
|
6
|
+
|
7
|
+
def initialize(tag_name, input, tokens)
|
8
|
+
super
|
9
|
+
if input.empty?
|
10
|
+
@input = '{}'
|
11
|
+
else
|
12
|
+
@input = input
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def render(context)
|
17
|
+
@input = parse_liquid_output_in(@input, context)
|
18
|
+
'{id: "' + SecureRandom.hex + '",
|
19
|
+
type: "LeafletMarker",
|
20
|
+
value: ' + @input + '},'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Liquid::Template.register_tag('leaflet_marker', Jekyll::LeafletMarker)
|
@@ -0,0 +1,208 @@
|
|
1
|
+
(() => {
|
2
|
+
// Specify configuration variables, setup any elements and styling
|
3
|
+
var leafletCdn = "https://unpkg.com/leaflet@1.5.1/dist/";
|
4
|
+
var esriLeafletCdn = "https://unpkg.com/esri-leaflet/dist/";
|
5
|
+
|
6
|
+
// Get tag input arguments & inside block object list
|
7
|
+
var tagInputArg = %{tag_input_arg_json};
|
8
|
+
var blockLeafletItems = [%{inside_block_leaflet_items}];
|
9
|
+
|
10
|
+
// Override the map div id if specified, apply default CSS
|
11
|
+
var defaultMapElId = "leaflet-map-%{id}";
|
12
|
+
var defaultMapElStyle = "height:300px; margin-top:15px; margin-bottom:15px";
|
13
|
+
var mapEl = document.getElementById(defaultMapElId);
|
14
|
+
if('divId' in tagInputArg){
|
15
|
+
mapEl.id = tagInputArg['divId'];
|
16
|
+
}
|
17
|
+
var defaultMapCssEl = document.createElement("style");
|
18
|
+
defaultMapCssEl.innerHTML =
|
19
|
+
"#" + defaultMapElId + "{" + defaultMapElStyle + "}";
|
20
|
+
document.head.appendChild(defaultMapCssEl);
|
21
|
+
|
22
|
+
var newWindowImgSrcBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4wUVFzAHq2j99AAAAV9JREFUSMdjYKAxYCRHk5ubG9+1a9fm/v//H6cadnb2G/fu3atlIceC379/c3z9+jUEn5q/f/8eYWBgYECxQE5OroqA2Y8ePXq0hJWV9Qc3N/caZB8wMjJKff361QpvEAkKCv4nYMGh9+/f26MLamhoyLx9+3b/nz9/VJCC6MiLFy9sWXCE3xlGRsZvWKQu4DOciYnpCzc396HPnz97weRxWRD/8OHDa4TiAt1wfn5+z79//zoxMDDALWAiN/lhM/zevXtH0NUx0dJwsiwgxXCccUCJ4dzc3DP+//+/gZ2d/duLFy9Is+Djx4+rCbn82rVrrxgYGF6RFUR8fHyZbGxsD7AZLiEhUSAiIrJSUlIyjOw4uHnz5gVHR0d1bC7/8+eP5d+/f8P+/PmjS1Ekr1ix4hcp6ploXVwPfQuwJlMmJiYBLS0tIVIMev36NRvRFnz48OHohw8fhkYQjQKCAAChiL6Pj/LM2QAAAABJRU5ErkJggg==";
|
23
|
+
|
24
|
+
// Actual mapping section; Specify a function to be called later that
|
25
|
+
// assembles the correct JS components based on what the user specified in the
|
26
|
+
// tag input arg, the block section of features, etc. Actually creates the map
|
27
|
+
// that is visible on the page
|
28
|
+
|
29
|
+
function _getCenter(){
|
30
|
+
var defaultCenter = [0,0];
|
31
|
+
if("center" in tagInputArg){
|
32
|
+
return tagInputArg.center;
|
33
|
+
} else {
|
34
|
+
return defaultCenter;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
function _getZoom(){
|
39
|
+
var defaultZoom = 1;
|
40
|
+
if("zoom" in tagInputArg){
|
41
|
+
return tagInputArg.zoom
|
42
|
+
} else {
|
43
|
+
return defaultZoom;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
function _getProviderBasemap(){
|
48
|
+
var defaultProviderBasemap = "OpenStreetMap.Mapnik";
|
49
|
+
if("providerBasemap" in tagInputArg){
|
50
|
+
return tagInputArg.providerBasemap;
|
51
|
+
} else {
|
52
|
+
return defaultProviderBasemap;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
function _addMarkerToMap(leafletItem, map){
|
58
|
+
var m = leafletItem.value;
|
59
|
+
var result = L.marker([m.latitude, m.longitude]).addTo(map);
|
60
|
+
var potentialPopup = "";
|
61
|
+
if('popupContent' in m){
|
62
|
+
potentialPopup += m.popupContent;}
|
63
|
+
if('href' in m){
|
64
|
+
potentialPopup += '<a href="' + m.href + '">' +
|
65
|
+
'<img src="' + newWindowImgSrcBase64 + '"></img></a>';}
|
66
|
+
if(potentialPopup){
|
67
|
+
result.bindPopup(potentialPopup);}
|
68
|
+
if(!('center' in tagInputArg)){
|
69
|
+
// If the user didn't specify a center, infer from marker
|
70
|
+
map.panTo(new L.LatLng(m.latitude, m.longitude));
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
function _onEachFeature(feature, layer){
|
75
|
+
var potentialPopup = ""
|
76
|
+
if(feature.properties && feature.properties.popupContent){
|
77
|
+
potentialPopup += feature.properties.popupContent;
|
78
|
+
}
|
79
|
+
if(feature.properties && feature.properties.href){
|
80
|
+
potentialPopup +=
|
81
|
+
'<a href="' + feature.properties.href + '">' +
|
82
|
+
'<img src="' + newWindowImgSrcBase64 + '"></img></a>';}
|
83
|
+
if(potentialPopup){
|
84
|
+
layer.bindPopup(potentialPopup);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
function _addGeoJSONToMap(leafletItem, map){
|
89
|
+
var geojson = L.geoJSON(leafletItem.value, {
|
90
|
+
onEachFeature: _onEachFeature
|
91
|
+
})
|
92
|
+
layers = geojson.getLayers();
|
93
|
+
for(var i=0; i<layers.length; i++){
|
94
|
+
try{
|
95
|
+
var geom = layers[i].feature.geometry;
|
96
|
+
if(!('center' in tagInputArg)){
|
97
|
+
// If the user didn't specify a center, infer from geojson
|
98
|
+
console.log("panning to " + geom.coordinates);
|
99
|
+
map.panTo(new L.LatLng(geom.coordinates[1],
|
100
|
+
geom.coordinates[0]));
|
101
|
+
}
|
102
|
+
} catch(e){}
|
103
|
+
}
|
104
|
+
|
105
|
+
geojson.addTo(map);
|
106
|
+
}
|
107
|
+
|
108
|
+
function _processLeafletItem(leafletItem, map){
|
109
|
+
switch(leafletItem.type){
|
110
|
+
case "LeafletMarker":
|
111
|
+
_addMarkerToMap(leafletItem, map);
|
112
|
+
break;
|
113
|
+
case "LeafletGeoJSON":
|
114
|
+
_addGeoJSONToMap(leafletItem, map);
|
115
|
+
break;
|
116
|
+
default:
|
117
|
+
console.log("Couldn't add item " + leafletItem.id);
|
118
|
+
break;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
//The actual section that is called that creates a map
|
123
|
+
function createMap(){
|
124
|
+
console.log("Creating map %{id} with these args:");
|
125
|
+
console.log(tagInputArg);
|
126
|
+
|
127
|
+
//Initialize Map with the correct input arguments
|
128
|
+
var map = L.map(mapEl.id,
|
129
|
+
{worldCopyJump: true}).setView(_getCenter(), _getZoom());
|
130
|
+
L.tileLayer.provider(_getProviderBasemap()).addTo(map);
|
131
|
+
if("esriBasemap" in tagInputArg){
|
132
|
+
L.esri.basemapLayer(tagInputArg.esriBasemap).addTo(map);
|
133
|
+
}
|
134
|
+
|
135
|
+
//process each Leaflet Item passed in between the block tag middle
|
136
|
+
for(var i=0; i<blockLeafletItems.length; i++){
|
137
|
+
var leafletItem = blockLeafletItems[i];
|
138
|
+
console.log("Adding leaflet item " + leafletItem.id + ":");
|
139
|
+
console.log(leafletItem);
|
140
|
+
_processLeafletItem(leafletItem, map);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
// Load the correct JS libraries/CSS by adding to head:
|
145
|
+
// When ready, call createMap() to create the map on the page
|
146
|
+
|
147
|
+
function _createMap(){
|
148
|
+
// helper function to draw the map only when everything is loaded,
|
149
|
+
// safeguards against multiple calls to window.onload
|
150
|
+
var prevOnLoad;
|
151
|
+
if(window.onload){
|
152
|
+
prevOnLoad = window.onload;
|
153
|
+
}
|
154
|
+
window.onload = () => {
|
155
|
+
createMap();
|
156
|
+
if(prevOnLoad){
|
157
|
+
prevOnLoad();
|
158
|
+
}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
var leafletCssId = "leaflet-css-head";
|
163
|
+
var leafletJsId = "leaflet-js-head";
|
164
|
+
var esriLeafletJsId = "esri-leaflet-js-head";
|
165
|
+
var leafletProvidersJsId = "leaflet-providers-js-head";
|
166
|
+
|
167
|
+
// Add the leaflet CSS first, don't worry about when it loads
|
168
|
+
var leafletCssEl = document.createElement("link");
|
169
|
+
leafletCssEl.id = leafletCssId;
|
170
|
+
leafletCssEl.rel = "stylesheet";
|
171
|
+
leafletCssEl.href = leafletCdn + "leaflet.css";
|
172
|
+
if(!document.getElementById(leafletCssEl.id)){
|
173
|
+
document.head.appendChild(leafletCssEl);
|
174
|
+
}
|
175
|
+
|
176
|
+
function addToHeadIfNotLoaded(el) {
|
177
|
+
//Add the el to the head if it doesn't exist already. If it does,
|
178
|
+
//everything we need is already loaded, so draw the map
|
179
|
+
if(!document.getElementById(el.id)){
|
180
|
+
document.head.appendChild(el);
|
181
|
+
} else {
|
182
|
+
_createMap();
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
// Load the main leaflet.js code, wait for it to load
|
187
|
+
var leafletJsEl = document.createElement("script");
|
188
|
+
leafletJsEl.id = leafletJsId;
|
189
|
+
leafletJsEl.onload = () => {
|
190
|
+
//After loaded, load the esri-leaflet.js code, wait for it to load
|
191
|
+
var esriEl = document.createElement("script");
|
192
|
+
esriEl.id = esriLeafletJsId;
|
193
|
+
esriEl.onload = () => {
|
194
|
+
//After loaded, add the inline leaflet-providers <script>
|
195
|
+
provEl = document.createElement("script");
|
196
|
+
provEl.id = leafletProvidersJsId;
|
197
|
+
provEl.innerHTML = `%{leaflet_providers_js_content}`;
|
198
|
+
if(!document.getElementById(provEl.id)){
|
199
|
+
document.head.appendChild(provEl);
|
200
|
+
}
|
201
|
+
_createMap();
|
202
|
+
}
|
203
|
+
esriEl.src = esriLeafletCdn + "esri-leaflet.js";
|
204
|
+
addToHeadIfNotLoaded(esriEl);
|
205
|
+
};
|
206
|
+
leafletJsEl.src = leafletCdn + "leaflet.js";
|
207
|
+
addToHeadIfNotLoaded(leafletJsEl);
|
208
|
+
})();
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
require 'json'
|
3
|
+
module Jekyll
|
4
|
+
class LeafletMap < Liquid::Block
|
5
|
+
|
6
|
+
def initialize(tag_name, input, tokens)
|
7
|
+
super
|
8
|
+
if input.empty?
|
9
|
+
@input = {}
|
10
|
+
else
|
11
|
+
@input = input
|
12
|
+
end
|
13
|
+
|
14
|
+
if !(input.is_a? String)
|
15
|
+
raise "leaflet-map input argument must be a String"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def render(context)
|
22
|
+
text = super
|
23
|
+
if !(text.is_a? String)
|
24
|
+
raise "leaflet-map content between the tag blocks must a String"
|
25
|
+
end
|
26
|
+
leaflet_providers_js_content = File.read(
|
27
|
+
File.expand_path("./leaflet-providers.js", File.dirname(__FILE__)))
|
28
|
+
|
29
|
+
map_js = File.read(
|
30
|
+
File.expand_path("./leaflet-map.js", File.dirname(__FILE__)))
|
31
|
+
map_html = File.read(
|
32
|
+
File.expand_path("./leaflet-map.html", File.dirname(__FILE__)))
|
33
|
+
|
34
|
+
@input = parse_liquid_output_in(@input, context)
|
35
|
+
id = SecureRandom.hex
|
36
|
+
map_js = map_js % {id: id,
|
37
|
+
leaflet_providers_js_content: leaflet_providers_js_content,
|
38
|
+
tag_input_arg_json: @input,
|
39
|
+
inside_block_leaflet_items: text}
|
40
|
+
map_html = map_html % {id: id,
|
41
|
+
leaflet_map_js_content: map_js}
|
42
|
+
|
43
|
+
map_html
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
Liquid::Template.register_tag('leaflet_map', Jekyll::LeafletMap)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Copyright (c) 2013 Leaflet Providers contributors All rights reserved.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
4
|
+
|
5
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
6
|
+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
7
|
+
|
8
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,815 @@
|
|
1
|
+
//Taken from https://github.com/leaflet-extras/leaflet-providers
|
2
|
+
(function (root, factory) {
|
3
|
+
if (typeof define === 'function' && define.amd) {
|
4
|
+
// AMD. Register as an anonymous module.
|
5
|
+
define(['leaflet'], factory);
|
6
|
+
} else if (typeof modules === 'object' && module.exports) {
|
7
|
+
// define a Common JS module that relies on 'leaflet'
|
8
|
+
module.exports = factory(require('leaflet'));
|
9
|
+
} else {
|
10
|
+
// Assume Leaflet is loaded into global object L already
|
11
|
+
factory(L);
|
12
|
+
}
|
13
|
+
}(this, function (L) {
|
14
|
+
'use strict';
|
15
|
+
|
16
|
+
L.TileLayer.Provider = L.TileLayer.extend({
|
17
|
+
initialize: function (arg, options) {
|
18
|
+
var providers = L.TileLayer.Provider.providers;
|
19
|
+
|
20
|
+
var parts = arg.split('.');
|
21
|
+
|
22
|
+
var providerName = parts[0];
|
23
|
+
var variantName = parts[1];
|
24
|
+
|
25
|
+
if (!providers[providerName]) {
|
26
|
+
throw 'No such provider (' + providerName + ')';
|
27
|
+
}
|
28
|
+
|
29
|
+
var provider = {
|
30
|
+
url: providers[providerName].url,
|
31
|
+
options: providers[providerName].options
|
32
|
+
};
|
33
|
+
|
34
|
+
// overwrite values in provider from variant.
|
35
|
+
if (variantName && 'variants' in providers[providerName]) {
|
36
|
+
if (!(variantName in providers[providerName].variants)) {
|
37
|
+
throw 'No such variant of ' + providerName + ' (' + variantName + ')';
|
38
|
+
}
|
39
|
+
var variant = providers[providerName].variants[variantName];
|
40
|
+
var variantOptions;
|
41
|
+
if (typeof variant === 'string') {
|
42
|
+
variantOptions = {
|
43
|
+
variant: variant
|
44
|
+
};
|
45
|
+
} else {
|
46
|
+
variantOptions = variant.options;
|
47
|
+
}
|
48
|
+
provider = {
|
49
|
+
url: variant.url || provider.url,
|
50
|
+
options: L.Util.extend({}, provider.options, variantOptions)
|
51
|
+
};
|
52
|
+
}
|
53
|
+
|
54
|
+
// replace attribution placeholders with their values from toplevel provider attribution,
|
55
|
+
// recursively
|
56
|
+
var attributionReplacer = function (attr) {
|
57
|
+
if (attr.indexOf('{attribution.') === -1) {
|
58
|
+
return attr;
|
59
|
+
}
|
60
|
+
return attr.replace(/\{attribution.(\w*)\}/g,
|
61
|
+
function (match, attributionName) {
|
62
|
+
return attributionReplacer(providers[attributionName].options.attribution);
|
63
|
+
}
|
64
|
+
);
|
65
|
+
};
|
66
|
+
provider.options.attribution = attributionReplacer(provider.options.attribution);
|
67
|
+
|
68
|
+
// Compute final options combining provider options with any user overrides
|
69
|
+
var layerOpts = L.Util.extend({}, provider.options, options);
|
70
|
+
L.TileLayer.prototype.initialize.call(this, provider.url, layerOpts);
|
71
|
+
}
|
72
|
+
});
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Definition of providers.
|
76
|
+
* see http://leafletjs.com/reference.html#tilelayer for options in the options map.
|
77
|
+
*/
|
78
|
+
|
79
|
+
L.TileLayer.Provider.providers = {
|
80
|
+
OpenStreetMap: {
|
81
|
+
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
82
|
+
options: {
|
83
|
+
maxZoom: 19,
|
84
|
+
attribution:
|
85
|
+
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
86
|
+
},
|
87
|
+
variants: {
|
88
|
+
Mapnik: {},
|
89
|
+
DE: {
|
90
|
+
url: 'https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
|
91
|
+
options: {
|
92
|
+
maxZoom: 18
|
93
|
+
}
|
94
|
+
},
|
95
|
+
CH: {
|
96
|
+
url: 'https://tile.osm.ch/switzerland/{z}/{x}/{y}.png',
|
97
|
+
options: {
|
98
|
+
maxZoom: 18,
|
99
|
+
bounds: [[45, 5], [48, 11]]
|
100
|
+
}
|
101
|
+
},
|
102
|
+
France: {
|
103
|
+
url: 'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
|
104
|
+
options: {
|
105
|
+
maxZoom: 20,
|
106
|
+
attribution: '© Openstreetmap France | {attribution.OpenStreetMap}'
|
107
|
+
}
|
108
|
+
},
|
109
|
+
HOT: {
|
110
|
+
url: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
|
111
|
+
options: {
|
112
|
+
attribution:
|
113
|
+
'{attribution.OpenStreetMap}, ' +
|
114
|
+
'Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> ' +
|
115
|
+
'hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>'
|
116
|
+
}
|
117
|
+
},
|
118
|
+
BZH: {
|
119
|
+
url: 'https://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png',
|
120
|
+
options: {
|
121
|
+
attribution: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://www.openstreetmap.bzh/" target="_blank">Breton OpenStreetMap Team</a>',
|
122
|
+
bounds: [[46.2, -5.5], [50, 0.7]]
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
},
|
127
|
+
OpenSeaMap: {
|
128
|
+
url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
|
129
|
+
options: {
|
130
|
+
attribution: 'Map data: © <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'
|
131
|
+
}
|
132
|
+
},
|
133
|
+
OpenPtMap: {
|
134
|
+
url: 'http://openptmap.org/tiles/{z}/{x}/{y}.png',
|
135
|
+
options: {
|
136
|
+
maxZoom: 17,
|
137
|
+
attribution: 'Map data: © <a href="http://www.openptmap.org">OpenPtMap</a> contributors'
|
138
|
+
}
|
139
|
+
},
|
140
|
+
OpenTopoMap: {
|
141
|
+
url: 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
|
142
|
+
options: {
|
143
|
+
maxZoom: 17,
|
144
|
+
attribution: 'Map data: {attribution.OpenStreetMap}, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
|
145
|
+
}
|
146
|
+
},
|
147
|
+
OpenRailwayMap: {
|
148
|
+
url: 'https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png',
|
149
|
+
options: {
|
150
|
+
maxZoom: 19,
|
151
|
+
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: © <a href="https://www.OpenRailwayMap.org">OpenRailwayMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
|
152
|
+
}
|
153
|
+
},
|
154
|
+
OpenFireMap: {
|
155
|
+
url: 'http://openfiremap.org/hytiles/{z}/{x}/{y}.png',
|
156
|
+
options: {
|
157
|
+
maxZoom: 19,
|
158
|
+
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: © <a href="http://www.openfiremap.org">OpenFireMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
|
159
|
+
}
|
160
|
+
},
|
161
|
+
SafeCast: {
|
162
|
+
url: 'https://s3.amazonaws.com/te512.safecast.org/{z}/{x}/{y}.png',
|
163
|
+
options: {
|
164
|
+
maxZoom: 16,
|
165
|
+
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: © <a href="https://blog.safecast.org/about/">SafeCast</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
|
166
|
+
}
|
167
|
+
},
|
168
|
+
Thunderforest: {
|
169
|
+
url: 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}',
|
170
|
+
options: {
|
171
|
+
attribution:
|
172
|
+
'© <a href="http://www.thunderforest.com/">Thunderforest</a>, {attribution.OpenStreetMap}',
|
173
|
+
variant: 'cycle',
|
174
|
+
apikey: '<insert your api key here>',
|
175
|
+
maxZoom: 22
|
176
|
+
},
|
177
|
+
variants: {
|
178
|
+
OpenCycleMap: 'cycle',
|
179
|
+
Transport: {
|
180
|
+
options: {
|
181
|
+
variant: 'transport'
|
182
|
+
}
|
183
|
+
},
|
184
|
+
TransportDark: {
|
185
|
+
options: {
|
186
|
+
variant: 'transport-dark'
|
187
|
+
}
|
188
|
+
},
|
189
|
+
SpinalMap: {
|
190
|
+
options: {
|
191
|
+
variant: 'spinal-map'
|
192
|
+
}
|
193
|
+
},
|
194
|
+
Landscape: 'landscape',
|
195
|
+
Outdoors: 'outdoors',
|
196
|
+
Pioneer: 'pioneer'
|
197
|
+
}
|
198
|
+
},
|
199
|
+
OpenMapSurfer: {
|
200
|
+
url: 'https://maps.heigit.org/openmapsurfer/tiles/{variant}/webmercator/{z}/{x}/{y}.png',
|
201
|
+
options: {
|
202
|
+
maxZoom: 19,
|
203
|
+
variant: 'roads',
|
204
|
+
attribution: 'Imagery from <a href="http://giscience.uni-hd.de/">GIScience Research Group @ University of Heidelberg</a> | Map data '
|
205
|
+
},
|
206
|
+
variants: {
|
207
|
+
Roads: {
|
208
|
+
options: {
|
209
|
+
variant: 'roads',
|
210
|
+
attribution: '{attribution.OpenMapSurfer}{attribution.OpenStreetMap}'
|
211
|
+
}
|
212
|
+
},
|
213
|
+
Hybrid: {
|
214
|
+
options: {
|
215
|
+
variant: 'hybrid',
|
216
|
+
attribution: '{attribution.OpenMapSurfer}{attribution.OpenStreetMap}'
|
217
|
+
}
|
218
|
+
},
|
219
|
+
AdminBounds: {
|
220
|
+
options: {
|
221
|
+
variant: 'adminb',
|
222
|
+
maxZoom: 18,
|
223
|
+
attribution: '{attribution.OpenMapSurfer}{attribution.OpenStreetMap}'
|
224
|
+
}
|
225
|
+
},
|
226
|
+
ContourLines: {
|
227
|
+
options: {
|
228
|
+
variant: 'asterc',
|
229
|
+
maxZoom: 18,
|
230
|
+
minZoom: 13,
|
231
|
+
attribution: '{attribution.OpenMapSurfer} <a href="https://lpdaac.usgs.gov/products/aster_policies">ASTER GDEM</a>'
|
232
|
+
}
|
233
|
+
},
|
234
|
+
Hillshade: {
|
235
|
+
options: {
|
236
|
+
variant: 'asterh',
|
237
|
+
maxZoom: 18,
|
238
|
+
attribution: '{attribution.OpenMapSurfer} <a href="https://lpdaac.usgs.gov/products/aster_policies">ASTER GDEM</a>, <a href="http://srtm.csi.cgiar.org/">SRTM</a>'
|
239
|
+
}
|
240
|
+
},
|
241
|
+
ElementsAtRisk: {
|
242
|
+
options: {
|
243
|
+
variant: 'elements_at_risk',
|
244
|
+
attribution: '{attribution.OpenMapSurfer}{attribution.OpenStreetMap}'
|
245
|
+
}
|
246
|
+
}
|
247
|
+
}
|
248
|
+
},
|
249
|
+
Hydda: {
|
250
|
+
url: 'https://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png',
|
251
|
+
options: {
|
252
|
+
maxZoom: 18,
|
253
|
+
variant: 'full',
|
254
|
+
attribution: 'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data {attribution.OpenStreetMap}'
|
255
|
+
},
|
256
|
+
variants: {
|
257
|
+
Full: 'full',
|
258
|
+
Base: 'base',
|
259
|
+
RoadsAndLabels: 'roads_and_labels'
|
260
|
+
}
|
261
|
+
},
|
262
|
+
MapBox: {
|
263
|
+
url: 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}{r}.png?access_token={accessToken}',
|
264
|
+
options: {
|
265
|
+
attribution:
|
266
|
+
'<a href="https://www.mapbox.com/about/maps/" target="_blank">© Mapbox</a> ' +
|
267
|
+
'{attribution.OpenStreetMap} ' +
|
268
|
+
'<a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a>',
|
269
|
+
subdomains: 'abcd',
|
270
|
+
id: 'mapbox.streets',
|
271
|
+
accessToken: '<insert your access token here>',
|
272
|
+
}
|
273
|
+
},
|
274
|
+
Stamen: {
|
275
|
+
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}',
|
276
|
+
options: {
|
277
|
+
attribution:
|
278
|
+
'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
|
279
|
+
'<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — ' +
|
280
|
+
'Map data {attribution.OpenStreetMap}',
|
281
|
+
subdomains: 'abcd',
|
282
|
+
minZoom: 0,
|
283
|
+
maxZoom: 20,
|
284
|
+
variant: 'toner',
|
285
|
+
ext: 'png'
|
286
|
+
},
|
287
|
+
variants: {
|
288
|
+
Toner: 'toner',
|
289
|
+
TonerBackground: 'toner-background',
|
290
|
+
TonerHybrid: 'toner-hybrid',
|
291
|
+
TonerLines: 'toner-lines',
|
292
|
+
TonerLabels: 'toner-labels',
|
293
|
+
TonerLite: 'toner-lite',
|
294
|
+
Watercolor: {
|
295
|
+
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
|
296
|
+
options: {
|
297
|
+
variant: 'watercolor',
|
298
|
+
ext: 'jpg',
|
299
|
+
minZoom: 1,
|
300
|
+
maxZoom: 16
|
301
|
+
}
|
302
|
+
},
|
303
|
+
Terrain: {
|
304
|
+
options: {
|
305
|
+
variant: 'terrain',
|
306
|
+
minZoom: 0,
|
307
|
+
maxZoom: 18
|
308
|
+
}
|
309
|
+
},
|
310
|
+
TerrainBackground: {
|
311
|
+
options: {
|
312
|
+
variant: 'terrain-background',
|
313
|
+
minZoom: 0,
|
314
|
+
maxZoom: 18
|
315
|
+
}
|
316
|
+
},
|
317
|
+
TopOSMRelief: {
|
318
|
+
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
|
319
|
+
options: {
|
320
|
+
variant: 'toposm-color-relief',
|
321
|
+
ext: 'jpg',
|
322
|
+
bounds: [[22, -132], [51, -56]]
|
323
|
+
}
|
324
|
+
},
|
325
|
+
TopOSMFeatures: {
|
326
|
+
options: {
|
327
|
+
variant: 'toposm-features',
|
328
|
+
bounds: [[22, -132], [51, -56]],
|
329
|
+
opacity: 0.9
|
330
|
+
}
|
331
|
+
}
|
332
|
+
}
|
333
|
+
},
|
334
|
+
Esri: {
|
335
|
+
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
|
336
|
+
options: {
|
337
|
+
variant: 'World_Street_Map',
|
338
|
+
attribution: 'Tiles © Esri'
|
339
|
+
},
|
340
|
+
variants: {
|
341
|
+
WorldStreetMap: {
|
342
|
+
options: {
|
343
|
+
attribution:
|
344
|
+
'{attribution.Esri} — ' +
|
345
|
+
'Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
|
346
|
+
}
|
347
|
+
},
|
348
|
+
DeLorme: {
|
349
|
+
options: {
|
350
|
+
variant: 'Specialty/DeLorme_World_Base_Map',
|
351
|
+
minZoom: 1,
|
352
|
+
maxZoom: 11,
|
353
|
+
attribution: '{attribution.Esri} — Copyright: ©2012 DeLorme'
|
354
|
+
}
|
355
|
+
},
|
356
|
+
WorldTopoMap: {
|
357
|
+
options: {
|
358
|
+
variant: 'World_Topo_Map',
|
359
|
+
attribution:
|
360
|
+
'{attribution.Esri} — ' +
|
361
|
+
'Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community'
|
362
|
+
}
|
363
|
+
},
|
364
|
+
WorldImagery: {
|
365
|
+
options: {
|
366
|
+
variant: 'World_Imagery',
|
367
|
+
attribution:
|
368
|
+
'{attribution.Esri} — ' +
|
369
|
+
'Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
|
370
|
+
}
|
371
|
+
},
|
372
|
+
WorldTerrain: {
|
373
|
+
options: {
|
374
|
+
variant: 'World_Terrain_Base',
|
375
|
+
maxZoom: 13,
|
376
|
+
attribution:
|
377
|
+
'{attribution.Esri} — ' +
|
378
|
+
'Source: USGS, Esri, TANA, DeLorme, and NPS'
|
379
|
+
}
|
380
|
+
},
|
381
|
+
WorldShadedRelief: {
|
382
|
+
options: {
|
383
|
+
variant: 'World_Shaded_Relief',
|
384
|
+
maxZoom: 13,
|
385
|
+
attribution: '{attribution.Esri} — Source: Esri'
|
386
|
+
}
|
387
|
+
},
|
388
|
+
WorldPhysical: {
|
389
|
+
options: {
|
390
|
+
variant: 'World_Physical_Map',
|
391
|
+
maxZoom: 8,
|
392
|
+
attribution: '{attribution.Esri} — Source: US National Park Service'
|
393
|
+
}
|
394
|
+
},
|
395
|
+
OceanBasemap: {
|
396
|
+
options: {
|
397
|
+
variant: 'Ocean_Basemap',
|
398
|
+
maxZoom: 13,
|
399
|
+
attribution: '{attribution.Esri} — Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
|
400
|
+
}
|
401
|
+
},
|
402
|
+
NatGeoWorldMap: {
|
403
|
+
options: {
|
404
|
+
variant: 'NatGeo_World_Map',
|
405
|
+
maxZoom: 16,
|
406
|
+
attribution: '{attribution.Esri} — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
|
407
|
+
}
|
408
|
+
},
|
409
|
+
WorldGrayCanvas: {
|
410
|
+
options: {
|
411
|
+
variant: 'Canvas/World_Light_Gray_Base',
|
412
|
+
maxZoom: 16,
|
413
|
+
attribution: '{attribution.Esri} — Esri, DeLorme, NAVTEQ'
|
414
|
+
}
|
415
|
+
}
|
416
|
+
}
|
417
|
+
},
|
418
|
+
OpenWeatherMap: {
|
419
|
+
url: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}',
|
420
|
+
options: {
|
421
|
+
maxZoom: 19,
|
422
|
+
attribution: 'Map data © <a href="http://openweathermap.org">OpenWeatherMap</a>',
|
423
|
+
apiKey:'<insert your api key here>',
|
424
|
+
opacity: 0.5
|
425
|
+
},
|
426
|
+
variants: {
|
427
|
+
Clouds: 'clouds',
|
428
|
+
CloudsClassic: 'clouds_cls',
|
429
|
+
Precipitation: 'precipitation',
|
430
|
+
PrecipitationClassic: 'precipitation_cls',
|
431
|
+
Rain: 'rain',
|
432
|
+
RainClassic: 'rain_cls',
|
433
|
+
Pressure: 'pressure',
|
434
|
+
PressureContour: 'pressure_cntr',
|
435
|
+
Wind: 'wind',
|
436
|
+
Temperature: 'temp',
|
437
|
+
Snow: 'snow'
|
438
|
+
}
|
439
|
+
},
|
440
|
+
HERE: {
|
441
|
+
/*
|
442
|
+
* HERE maps, formerly Nokia maps.
|
443
|
+
* These basemaps are free, but you need an API key. Please sign up at
|
444
|
+
* https://developer.here.com/plans
|
445
|
+
*/
|
446
|
+
url:
|
447
|
+
'https://{s}.{base}.maps.api.here.com/maptile/2.1/' +
|
448
|
+
'{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?' +
|
449
|
+
'app_id={app_id}&app_code={app_code}&lg={language}',
|
450
|
+
options: {
|
451
|
+
attribution:
|
452
|
+
'Map © 1987-' + new Date().getFullYear() + ' <a href="http://developer.here.com">HERE</a>',
|
453
|
+
subdomains: '1234',
|
454
|
+
mapID: 'newest',
|
455
|
+
'app_id': '<insert your app_id here>',
|
456
|
+
'app_code': '<insert your app_code here>',
|
457
|
+
base: 'base',
|
458
|
+
variant: 'normal.day',
|
459
|
+
maxZoom: 20,
|
460
|
+
type: 'maptile',
|
461
|
+
language: 'eng',
|
462
|
+
format: 'png8',
|
463
|
+
size: '256'
|
464
|
+
},
|
465
|
+
variants: {
|
466
|
+
normalDay: 'normal.day',
|
467
|
+
normalDayCustom: 'normal.day.custom',
|
468
|
+
normalDayGrey: 'normal.day.grey',
|
469
|
+
normalDayMobile: 'normal.day.mobile',
|
470
|
+
normalDayGreyMobile: 'normal.day.grey.mobile',
|
471
|
+
normalDayTransit: 'normal.day.transit',
|
472
|
+
normalDayTransitMobile: 'normal.day.transit.mobile',
|
473
|
+
normalNight: 'normal.night',
|
474
|
+
normalNightMobile: 'normal.night.mobile',
|
475
|
+
normalNightGrey: 'normal.night.grey',
|
476
|
+
normalNightGreyMobile: 'normal.night.grey.mobile',
|
477
|
+
normalNightTransit: 'normal.night.transit',
|
478
|
+
normalNightTransitMobile: 'normal.night.transit.mobile',
|
479
|
+
reducedDay: 'reduced.day',
|
480
|
+
reducedNight: 'reduced.night',
|
481
|
+
basicMap: {
|
482
|
+
options: {
|
483
|
+
type: 'basetile'
|
484
|
+
}
|
485
|
+
},
|
486
|
+
mapLabels: {
|
487
|
+
options: {
|
488
|
+
type: 'labeltile',
|
489
|
+
format: 'png'
|
490
|
+
}
|
491
|
+
},
|
492
|
+
trafficFlow: {
|
493
|
+
options: {
|
494
|
+
base: 'traffic',
|
495
|
+
type: 'flowtile'
|
496
|
+
}
|
497
|
+
},
|
498
|
+
carnavDayGrey: 'carnav.day.grey',
|
499
|
+
hybridDay: {
|
500
|
+
options: {
|
501
|
+
base: 'aerial',
|
502
|
+
variant: 'hybrid.day'
|
503
|
+
}
|
504
|
+
},
|
505
|
+
hybridDayMobile: {
|
506
|
+
options: {
|
507
|
+
base: 'aerial',
|
508
|
+
variant: 'hybrid.day.mobile'
|
509
|
+
}
|
510
|
+
},
|
511
|
+
hybridDayTransit: {
|
512
|
+
options: {
|
513
|
+
base: 'aerial',
|
514
|
+
variant: 'hybrid.day.transit'
|
515
|
+
}
|
516
|
+
},
|
517
|
+
hybridDayGrey: {
|
518
|
+
options: {
|
519
|
+
base: 'aerial',
|
520
|
+
variant: 'hybrid.grey.day'
|
521
|
+
}
|
522
|
+
},
|
523
|
+
pedestrianDay: 'pedestrian.day',
|
524
|
+
pedestrianNight: 'pedestrian.night',
|
525
|
+
satelliteDay: {
|
526
|
+
options: {
|
527
|
+
base: 'aerial',
|
528
|
+
variant: 'satellite.day'
|
529
|
+
}
|
530
|
+
},
|
531
|
+
terrainDay: {
|
532
|
+
options: {
|
533
|
+
base: 'aerial',
|
534
|
+
variant: 'terrain.day'
|
535
|
+
}
|
536
|
+
},
|
537
|
+
terrainDayMobile: {
|
538
|
+
options: {
|
539
|
+
base: 'aerial',
|
540
|
+
variant: 'terrain.day.mobile'
|
541
|
+
}
|
542
|
+
}
|
543
|
+
}
|
544
|
+
},
|
545
|
+
FreeMapSK: {
|
546
|
+
url: 'http://t{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
|
547
|
+
options: {
|
548
|
+
minZoom: 8,
|
549
|
+
maxZoom: 16,
|
550
|
+
subdomains: '1234',
|
551
|
+
bounds: [[47.204642, 15.996093], [49.830896, 22.576904]],
|
552
|
+
attribution:
|
553
|
+
'{attribution.OpenStreetMap}, vizualization CC-By-SA 2.0 <a href="http://freemap.sk">Freemap.sk</a>'
|
554
|
+
}
|
555
|
+
},
|
556
|
+
MtbMap: {
|
557
|
+
url: 'http://tile.mtbmap.cz/mtbmap_tiles/{z}/{x}/{y}.png',
|
558
|
+
options: {
|
559
|
+
attribution:
|
560
|
+
'{attribution.OpenStreetMap} & USGS'
|
561
|
+
}
|
562
|
+
},
|
563
|
+
CartoDB: {
|
564
|
+
url: 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png',
|
565
|
+
options: {
|
566
|
+
attribution: '{attribution.OpenStreetMap} © <a href="https://carto.com/attributions">CARTO</a>',
|
567
|
+
subdomains: 'abcd',
|
568
|
+
maxZoom: 19,
|
569
|
+
variant: 'light_all'
|
570
|
+
},
|
571
|
+
variants: {
|
572
|
+
Positron: 'light_all',
|
573
|
+
PositronNoLabels: 'light_nolabels',
|
574
|
+
PositronOnlyLabels: 'light_only_labels',
|
575
|
+
DarkMatter: 'dark_all',
|
576
|
+
DarkMatterNoLabels: 'dark_nolabels',
|
577
|
+
DarkMatterOnlyLabels: 'dark_only_labels',
|
578
|
+
Voyager: 'rastertiles/voyager',
|
579
|
+
VoyagerNoLabels: 'rastertiles/voyager_nolabels',
|
580
|
+
VoyagerOnlyLabels: 'rastertiles/voyager_only_labels',
|
581
|
+
VoyagerLabelsUnder: 'rastertiles/voyager_labels_under'
|
582
|
+
}
|
583
|
+
},
|
584
|
+
HikeBike: {
|
585
|
+
url: 'https://tiles.wmflabs.org/{variant}/{z}/{x}/{y}.png',
|
586
|
+
options: {
|
587
|
+
maxZoom: 19,
|
588
|
+
attribution: '{attribution.OpenStreetMap}',
|
589
|
+
variant: 'hikebike'
|
590
|
+
},
|
591
|
+
variants: {
|
592
|
+
HikeBike: {},
|
593
|
+
HillShading: {
|
594
|
+
options: {
|
595
|
+
maxZoom: 15,
|
596
|
+
variant: 'hillshading'
|
597
|
+
}
|
598
|
+
}
|
599
|
+
}
|
600
|
+
},
|
601
|
+
BasemapAT: {
|
602
|
+
url: 'https://maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}',
|
603
|
+
options: {
|
604
|
+
maxZoom: 19,
|
605
|
+
attribution: 'Datenquelle: <a href="https://www.basemap.at">basemap.at</a>',
|
606
|
+
subdomains: ['', '1', '2', '3', '4'],
|
607
|
+
format: 'png',
|
608
|
+
bounds: [[46.358770, 8.782379], [49.037872, 17.189532]],
|
609
|
+
variant: 'geolandbasemap'
|
610
|
+
},
|
611
|
+
variants: {
|
612
|
+
basemap: {
|
613
|
+
options: {
|
614
|
+
maxZoom: 20, // currently only in Vienna
|
615
|
+
variant: 'geolandbasemap'
|
616
|
+
}
|
617
|
+
},
|
618
|
+
grau: 'bmapgrau',
|
619
|
+
overlay: 'bmapoverlay',
|
620
|
+
highdpi: {
|
621
|
+
options: {
|
622
|
+
variant: 'bmaphidpi',
|
623
|
+
format: 'jpeg'
|
624
|
+
}
|
625
|
+
},
|
626
|
+
orthofoto: {
|
627
|
+
options: {
|
628
|
+
maxZoom: 20, // currently only in Vienna
|
629
|
+
variant: 'bmaporthofoto30cm',
|
630
|
+
format: 'jpeg'
|
631
|
+
}
|
632
|
+
}
|
633
|
+
}
|
634
|
+
},
|
635
|
+
nlmaps: {
|
636
|
+
url: 'https://geodata.nationaalgeoregister.nl/tiles/service/wmts/{variant}/EPSG:3857/{z}/{x}/{y}.png',
|
637
|
+
options: {
|
638
|
+
minZoom: 6,
|
639
|
+
maxZoom: 19,
|
640
|
+
bounds: [[50.5, 3.25], [54, 7.6]],
|
641
|
+
attribution: 'Kaartgegevens © <a href="kadaster.nl">Kadaster</a>'
|
642
|
+
},
|
643
|
+
variants: {
|
644
|
+
'standaard': 'brtachtergrondkaart',
|
645
|
+
'pastel': 'brtachtergrondkaartpastel',
|
646
|
+
'grijs': 'brtachtergrondkaartgrijs',
|
647
|
+
'luchtfoto': {
|
648
|
+
'url': 'https://geodata.nationaalgeoregister.nl/luchtfoto/rgb/wmts/1.0.0/2016_ortho25/EPSG:3857/{z}/{x}/{y}.png',
|
649
|
+
}
|
650
|
+
}
|
651
|
+
},
|
652
|
+
NASAGIBS: {
|
653
|
+
url: 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}',
|
654
|
+
options: {
|
655
|
+
attribution:
|
656
|
+
'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System ' +
|
657
|
+
'(<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.',
|
658
|
+
bounds: [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]],
|
659
|
+
minZoom: 1,
|
660
|
+
maxZoom: 9,
|
661
|
+
format: 'jpg',
|
662
|
+
time: '',
|
663
|
+
tilematrixset: 'GoogleMapsCompatible_Level'
|
664
|
+
},
|
665
|
+
variants: {
|
666
|
+
ModisTerraTrueColorCR: 'MODIS_Terra_CorrectedReflectance_TrueColor',
|
667
|
+
ModisTerraBands367CR: 'MODIS_Terra_CorrectedReflectance_Bands367',
|
668
|
+
ViirsEarthAtNight2012: {
|
669
|
+
options: {
|
670
|
+
variant: 'VIIRS_CityLights_2012',
|
671
|
+
maxZoom: 8
|
672
|
+
}
|
673
|
+
},
|
674
|
+
ModisTerraLSTDay: {
|
675
|
+
options: {
|
676
|
+
variant: 'MODIS_Terra_Land_Surface_Temp_Day',
|
677
|
+
format: 'png',
|
678
|
+
maxZoom: 7,
|
679
|
+
opacity: 0.75
|
680
|
+
}
|
681
|
+
},
|
682
|
+
ModisTerraSnowCover: {
|
683
|
+
options: {
|
684
|
+
variant: 'MODIS_Terra_Snow_Cover',
|
685
|
+
format: 'png',
|
686
|
+
maxZoom: 8,
|
687
|
+
opacity: 0.75
|
688
|
+
}
|
689
|
+
},
|
690
|
+
ModisTerraAOD: {
|
691
|
+
options: {
|
692
|
+
variant: 'MODIS_Terra_Aerosol',
|
693
|
+
format: 'png',
|
694
|
+
maxZoom: 6,
|
695
|
+
opacity: 0.75
|
696
|
+
}
|
697
|
+
},
|
698
|
+
ModisTerraChlorophyll: {
|
699
|
+
options: {
|
700
|
+
variant: 'MODIS_Terra_Chlorophyll_A',
|
701
|
+
format: 'png',
|
702
|
+
maxZoom: 7,
|
703
|
+
opacity: 0.75
|
704
|
+
}
|
705
|
+
}
|
706
|
+
}
|
707
|
+
},
|
708
|
+
NLS: {
|
709
|
+
// NLS maps are copyright National library of Scotland.
|
710
|
+
// http://maps.nls.uk/projects/api/index.html
|
711
|
+
// Please contact NLS for anything other than non-commercial low volume usage
|
712
|
+
//
|
713
|
+
// Map sources: Ordnance Survey 1:1m to 1:63K, 1920s-1940s
|
714
|
+
// z0-9 - 1:1m
|
715
|
+
// z10-11 - quarter inch (1:253440)
|
716
|
+
// z12-18 - one inch (1:63360)
|
717
|
+
url: 'https://nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg',
|
718
|
+
options: {
|
719
|
+
attribution: '<a href="http://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>',
|
720
|
+
bounds: [[49.6, -12], [61.7, 3]],
|
721
|
+
minZoom: 1,
|
722
|
+
maxZoom: 18,
|
723
|
+
subdomains: '0123',
|
724
|
+
}
|
725
|
+
},
|
726
|
+
JusticeMap: {
|
727
|
+
// Justice Map (http://www.justicemap.org/)
|
728
|
+
// Visualize race and income data for your community, county and country.
|
729
|
+
// Includes tools for data journalists, bloggers and community activists.
|
730
|
+
url: 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png',
|
731
|
+
options: {
|
732
|
+
attribution: '<a href="http://www.justicemap.org/terms.php">Justice Map</a>',
|
733
|
+
// one of 'county', 'tract', 'block'
|
734
|
+
size: 'county',
|
735
|
+
// Bounds for USA, including Alaska and Hawaii
|
736
|
+
bounds: [[14, -180], [72, -56]]
|
737
|
+
},
|
738
|
+
variants: {
|
739
|
+
income: 'income',
|
740
|
+
americanIndian: 'indian',
|
741
|
+
asian: 'asian',
|
742
|
+
black: 'black',
|
743
|
+
hispanic: 'hispanic',
|
744
|
+
multi: 'multi',
|
745
|
+
nonWhite: 'nonwhite',
|
746
|
+
white: 'white',
|
747
|
+
plurality: 'plural'
|
748
|
+
}
|
749
|
+
},
|
750
|
+
Wikimedia: {
|
751
|
+
url: 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png',
|
752
|
+
options: {
|
753
|
+
attribution: '<a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use">Wikimedia</a>',
|
754
|
+
minZoom: 1,
|
755
|
+
maxZoom: 19
|
756
|
+
}
|
757
|
+
},
|
758
|
+
GeoportailFrance: {
|
759
|
+
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}',
|
760
|
+
options: {
|
761
|
+
attribution: '<a target="_blank" href="https://www.geoportail.gouv.fr/">Geoportail France</a>',
|
762
|
+
bounds: [[-75, -180], [81, 180]],
|
763
|
+
minZoom: 2,
|
764
|
+
maxZoom: 18,
|
765
|
+
// Get your own geoportail apikey here : http://professionnels.ign.fr/ign/contrats/
|
766
|
+
// NB : 'choisirgeoportail' is a demonstration key that comes with no guarantee
|
767
|
+
apikey: 'choisirgeoportail',
|
768
|
+
format: 'image/jpeg',
|
769
|
+
style : 'normal',
|
770
|
+
variant: 'GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD'
|
771
|
+
},
|
772
|
+
variants: {
|
773
|
+
parcels: {
|
774
|
+
options : {
|
775
|
+
variant: 'CADASTRALPARCELS.PARCELS',
|
776
|
+
maxZoom: 20,
|
777
|
+
style : 'bdparcellaire',
|
778
|
+
format: 'image/png'
|
779
|
+
}
|
780
|
+
},
|
781
|
+
ignMaps: 'GEOGRAPHICALGRIDSYSTEMS.MAPS',
|
782
|
+
maps: 'GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD',
|
783
|
+
orthos: {
|
784
|
+
options: {
|
785
|
+
maxZoom: 19,
|
786
|
+
variant: 'ORTHOIMAGERY.ORTHOPHOTOS'
|
787
|
+
}
|
788
|
+
}
|
789
|
+
}
|
790
|
+
},
|
791
|
+
OneMapSG: {
|
792
|
+
url: 'https://maps-{s}.onemap.sg/v3/{variant}/{z}/{x}/{y}.png',
|
793
|
+
options: {
|
794
|
+
variant: 'Default',
|
795
|
+
minZoom: 11,
|
796
|
+
maxZoom: 18,
|
797
|
+
bounds: [[1.56073, 104.11475], [1.16, 103.502]],
|
798
|
+
attribution: '<img src="https://docs.onemap.sg/maps/images/oneMap64-01.png" style="height:20px;width:20px;"/> New OneMap | Map data © contributors, <a href="http://SLA.gov.sg">Singapore Land Authority</a>'
|
799
|
+
},
|
800
|
+
variants: {
|
801
|
+
Default: 'Default',
|
802
|
+
Night: 'Night',
|
803
|
+
Original: 'Original',
|
804
|
+
Grey: 'Grey',
|
805
|
+
LandLot: 'LandLot'
|
806
|
+
}
|
807
|
+
}
|
808
|
+
};
|
809
|
+
|
810
|
+
L.tileLayer.provider = function (provider, options) {
|
811
|
+
return new L.TileLayer.Provider(provider, options);
|
812
|
+
};
|
813
|
+
|
814
|
+
return L;
|
815
|
+
}));
|
metadata
CHANGED
@@ -1,23 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-leaflet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- David Vitale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Embed
|
14
|
-
email:
|
13
|
+
description: Embed leatlet.js maps in Jekyll
|
14
|
+
email: davidjosephvitale@gmail.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
19
|
- lib/jekyll-leaflet.rb
|
20
|
-
|
20
|
+
- lib/jekyll-leaflet/_parse-liquid.rb
|
21
|
+
- lib/jekyll-leaflet/filters/replace-hrefs.rb
|
22
|
+
- lib/jekyll-leaflet/leaflet-items/leaflet-geojson.rb
|
23
|
+
- lib/jekyll-leaflet/leaflet-items/leaflet-marker.rb
|
24
|
+
- lib/jekyll-leaflet/leaflet-map.html
|
25
|
+
- lib/jekyll-leaflet/leaflet-map.js
|
26
|
+
- lib/jekyll-leaflet/leaflet-map.rb
|
27
|
+
- lib/jekyll-leaflet/leaflet-providers-license.md
|
28
|
+
- lib/jekyll-leaflet/leaflet-providers.js
|
29
|
+
homepage: https://davidjvitale.com/tech/jekyll-leaflet/
|
21
30
|
licenses:
|
22
31
|
- MIT
|
23
32
|
metadata: {}
|
@@ -39,5 +48,5 @@ requirements: []
|
|
39
48
|
rubygems_version: 3.0.3
|
40
49
|
signing_key:
|
41
50
|
specification_version: 4
|
42
|
-
summary: Embed
|
51
|
+
summary: Embed leatlet.js maps in Jekyll
|
43
52
|
test_files: []
|