-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
135 lines (117 loc) · 4.43 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PLOTS Leaflet Viewer</title>
<link rel="stylesheet" href="https://publiclab.github.io/leaflet-blurred-location/node_modules/leaflet/dist/leaflet.css">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<script src="https://sequencer.publiclab.org/node_modules/jquery/dist/jquery.min.js"></script>
<script src="https://publiclab.github.io/leaflet-blurred-location/node_modules/leaflet/dist/leaflet.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&language=en&key=AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ"></script>
<script src='//unpkg.com/leaflet.gridlayer.googlemutant@latest/dist/Leaflet.GoogleMutant.js'></script>
<style>
#sharelink, #share {
font-family:lucida grande, lucida sans console, sans-serif;
background:white;
padding:4px;
font-size:11px;
position:absolute;
bottom:0;
left:0;
z-index:999;
}
#share {
top:0;
-moz-opacity: 0.8;
opacity:.8;
filter:alpha(opacity=80);
padding-top:80px;
}
#link a {
color:#333;
}
#embedcode {
height:100px;
font-size:10px;
}
</style>
</head>
<body style="margin:0;">
<div id="sharelink">
<a href="javascript:void(0);" onClick="$('#share').show()">share</a> | <a href="http://publiclab.org">PublicLab.org</a>
</div>
<div id="share" style="display:none;">
<h2>Share</h2>
<div id="links">
<p><a target="_blank"href="">permalink</a> (click for fullscreen)</p>
</div>
<p><b>Embed code:</b><br />
<textarea id="embedcode"></textarea>
</p>
<p><a href="javascript:void(0);" onClick="$('#share').hide()">close</a></p>
</div>
<div class=" leaflet-container" id="map" style="width:100%;height:100%;"></div>
<script>
$('embedcode').value = '<iframe style="border:none;" width="500" height="375" src="'+window.location+'"></iframe>'
function get_param(param) {
var search = window.location.search.substring(1);
var compareKeyValuePair = function(pair) {
var key_value = pair.split('=');
var decodedKey = decodeURIComponent(key_value[0]);
var decodedValue = decodeURIComponent(key_value[1]);
if(decodedKey == param) return decodedValue;
return null;
};
var comparisonResult = null;
if(search.indexOf('&') > -1) {
var params = search.split('&');
for(var i = 0; i < params.length; i++) {
comparisonResult = compareKeyValuePair(params[i]);
if(comparisonResult !== null) {
break;
}
}
} else {
comparisonResult = compareKeyValuePair(search);
}
return comparisonResult;
}
window.onload = function() {
var tms = get_param('tms')+"{z}/{x}/{y}.png"
var background_tms = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
//var backdroptms = "http://hypercube.telascience.org/tilecache/tilecache.py/1.0.0/NAIP_ALL/{z}/{x}/{y}.png"
//var backdroptms = "http://hypercube.telascience.org/tilecache/tilecache.py/1.0.0/NewWorld_google/{z}/{x}/{y}.png"
var minZoom = get_param('min') || 12
var maxZoom = get_param('max') || 22
var label = get_param('label') || "Main"
var zoom = get_param('zoom') || 18
//var background = new L.TileLayer(background_tms, {minZoom: minZoom, maxZoom: maxZoom, scheme:"tms"});
var googleRoad = L.gridLayer.googleMutant({
type: 'roadmap',
styles: [
{elementType: 'labels', stylers: [{visibility: 'off'}]},
{featureType: 'water', stylers: [{color: '#444444'}]}
]
});
var google = L.gridLayer.googleMutant({
type: 'satellite'
});
var main = new L.TileLayer(tms, {minZoom: minZoom, maxZoom: maxZoom, scheme:"tms", tms:true});
var map = new L.Map('map', {
crs:L.CRS.EPSG3857,
layers: [google, main, googleRoad]
});
map.setView(new L.LatLng(parseFloat(get_param('lat')),parseFloat(get_param('lon'))), zoom)
var baseMaps = {
"Google Roadmap": googleRoad,
"Google": google
};
var overlayMaps = {
"Overlay": main
};
var layersControl = new L.Control.Layers(baseMaps,overlayMaps);
map.addControl(layersControl);
if (get_param("backlink")) {
$('#links').insert({top:"<p><a href='"+get_param('backlink')+"'>View original map</a></p>"})
}
}
</script>
</body></html>