-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplotter.html
73 lines (71 loc) · 2.13 KB
/
plotter.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script src="src_js/leaflet.js"></script>
<script src="src_js/leaflet.plotter.js"></script>
<link rel="stylesheet" href="src_js/leaflet.css" />
<link rel="stylesheet" href="src_js/plotter.css" />
<style>
body { margin:0; padding:0; font-family: arial; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var map = L.map('map').setView([7.12702567, -73.119205], 15.4);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
//lat lon
var plottedPolyline = L.Polyline.Plotter([
[7.12702567,-73.119205],
[7.127103895,-73.11938019],
[7.127077821,-73.11951157],
[7.126799694,-73.11966924],
[7.126530258,-73.11990574],
[7.12625213,-73.120151],
[7.126043534,-73.1203437],
[7.125852322,-73.1208167],
[7.12573064,-73.1212021],
[7.126078303,-73.12131597],
[7.126382508,-73.12135977],
[7.126669328,-73.12145612],
[7.127008298,-73.12155247],
[7.127242969,-73.12161378],
[7.127416799,-73.12166633],
[7.127477639,-73.12136852],
[7.127538479,-73.12101815],
[7.12760801,-73.12078166],
[7.127651466,-73.12050136],
[7.127747071,-73.12015099]
],{
weight: 3,
// plottedPolyline.getLatLngs(),
readOnly :true
}).addTo(map);
// Trigger for toggling readonly property
var readOnly = false;
function toggle(actual){
if (actual== "read"){
plottedPolyline.setReadOnly(readOnly);
} else if (actual== "edit"){
plottedPolyline.setReadOnly(!readOnly);
}
if (actual== "read"){
return 'Editing';
}else if (actual == "edit"){
return 'ReadOnly'; }
}
function getpoints(){
var Points = plottedPolyline.getLatLngs();
for(var i=0; i < Points.length; i++) {
if(map.getBounds().contains(Points[i])) {
return Points;
}
}
};
</script>
</body>
</html>