-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
56 lines (41 loc) · 2.31 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
<!DOCTYPE html>
<html>
<head>
<title>Leaflet.Multispectral Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="node_modules/leaflet/dist/leaflet.js" type="text/javascript" charset="utf-8"></script>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/image-sequencer/dist/image-sequencer.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="node_modules/leaflet/dist/leaflet.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="dist/leaflet.multispectral.js"></script>
</head>
<body style="margin:0;">
<div id="map" style="width:100%; height:100%; position:absolute; top:0; z-index:1;"></div>
<script>
var map, tileLayer, img;
(function(){
// basic Leaflet map setup
map = new L.map('map').setView([29, -118.3], 12);
// create a tile layer
tileLayer = L.tileLayer('https://{s}.tiles.mapbox.com/v3/anishshah101.ipm9j6em/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
id: 'examples.map-i86knfo3'
}).addTo(map);
// create an image
img = L.imageOverlay('example.jpg', [[29.0, -118.2],[29.1, -118.4]]);
// apply NDVI equation to the image
img.filter('ndvi,colormap'); // run NDVI and apply colormap
img.addTo(map);
})();
</script>
<div id="btns" style="position:absolute;bottom:0;width:100%;z-index:99;padding:8px;">
<a class="btn btn-default" href="#" onClick="img.revert().filter('ndvi,invert,colormap');">Invert</a>
<a class="btn btn-default" href="#" onClick="img.revert().filter('ndvi,colormap{colormap:brntogrn}');">Brown to green colormap</a>
<a class="btn btn-default" href="#" onClick="img.revert().filter(prompt('Enter an Image Sequencer string; https://sequencer.publiclab.org', 'dynamic{red:R*2|green:B|blue:B/2}'));">Custom</a>
</div>
</html>