forked from vporwal/maps-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglenorchy_mtbp_elevation.html
185 lines (165 loc) · 6.75 KB
/
glenorchy_mtbp_elevation.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<html>
<head>
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Glenorchy Mountain Bike Park - Glenorchy City Council</title>
<link type="text/css" rel="stylesheet" href="src/leaflet/leaflet.css" />
<script type="text/javascript" src="src/leaflet/leaflet.js"></script>
<script src="src/listBaseLayers.js" type="text/javascript"></script>
<script src="src/leaflet/gcc_config.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/jquery.mobile-1.1.1.min.css" />
<link rel="stylesheet" href="src/leaflet/locate/L.Control.Locate.css" />
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="src/leaflet/gcc_geosearch/l.gcc_geosearch.css" />
<link rel="stylesheet" href="src/leaflet/elevation/Leaflet.Elevation-0.0.2.css" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="src/leaflet/locate/L.Control.Locate.ie.css" />
<link rel="stylesheet" href="src/leaflet/gcc_geosearch/l.gcc_geosearch.ie.css" />
<link rel="stylesheet" href="css/ie6.css" type="text/css" />
<![endif]-->
<script src="src/leaflet/gcc_geosearch/gcc_geosearch.js"></script>
<script src="src/leaflet/locate/L.Control.Locate.js"></script>
<script src="src/jquery/jquery-1.7.1.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
<script src="src/leaflet/elevation/Leaflet.Elevation-0.0.2.min.js"></script>
<script src="src/d3/d3.min.js"></script>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
h3 {
margin:0;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
<script>
var center = new L.LatLng(-42.8585,147.2468);
var map = new L.Map('map', { center: center, zoom: 16, attributionControl:true, zoomControl:false, minZoom:11});
var baselayers = {
"LIST Aerial Imagery": LISTAerial,
"LIST Topographic": LISTTopographic
};
map.addLayer(LISTAerial)
var owsrootUrl = 'https://maps.gcc.tas.gov.au/geoserver/ows';
var defaultParameters = {
service : 'WFS',
version : '2.0',
request : 'GetFeature',
typeName : 'GCC_cc:GlenorchyMountainBikePark',
outputFormat : 'text/javascript',
format_options : 'callback:getJson',
SrsName : 'EPSG:4326'
};
var parameters = L.Util.extend(defaultParameters);
var URL = owsrootUrl + L.Util.getParamString(parameters);
//console.log(URL);
function getColour(c) {
switch(c)
{
case 'Black Diamond':
return '#000000';
break;
case 'Blue Square':
return '#1f45ce';
break;
case 'Double Black Diamond':
return '#d10000';
case 'Green Circle':
return '#0ac300';
break;
default:
return '#FF6600';
}
};
//all used options are the default values
var el = L.control.elevation({
position: "bottomleft",
theme: "steelblue-theme", //default: lime-theme
width: 600,
height: 125,
margins: {
top: 10,
right: 20,
bottom: 30,
left: 50
},
useHeightIndicator: true, //if false a marker is drawn at map position
interpolation: "linear", //see https://github.com/mbostock/d3/wiki/SVG-Shapes#wiki-area_interpolate
hoverNumber: {
decimalsX: 3, //decimals on distance (always in km)
decimalsY: 0, //deciamls on height (always in m)
formatter: undefined //custom formatter function may be injected
},
xTicks: undefined, //number of ticks in x axis, calculated by default according to width
yTicks: undefined, //number of ticks on y axis, calculated by default according to height
collapsed: false //collapsed mode, show chart on click or mouseover
});
L.marker([-42.85628,147.24766]).addTo(map).bindPopup("<h3>Glenorchy Mountain Bike Park</h3><a href=https://maps.google.com/maps?daddr=-42.8538,147.2513 target="_blank">Directions to here.</a>").addTo(map);
var mtbp = null;
var ajax = $.ajax({
url : URL,
dataType : 'jsonp',
jsonpCallback : 'getJson',
success : function (response) {
mtbp = L.geoJson(response, {
style: function (feature) {
return {
stroke: true,
color: getColour(feature.properties.difficulty),
opacity: 0.8,
weight: 4
};
},
onEachFeature: function (feature, layer) {
popupOptions = {maxWidth: 200};
layer.bindPopup("<h3>" + feature.properties.name + "</h3>" +
"<b>Difficulty: </b>" + feature.properties.difficulty +
"<br><b>Description: </b>" + feature.properties.description
,popupOptions);
}
}).addTo(map);
}
});
map.attributionControl.addAttribution(gccAtt);
var legend = L.control({position: 'bottomright'});
legend.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info-legend');
div.innerHTML = '<img src="https://maps.gcc.tas.gov.au/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=30&HEIGHT=25&LAYER=GCC_cc:GlenorchyMountainBikePark&&legend_options=fontName:Times%20New%20Roman;fontAntiAliasing:true" alt = "Mountain Bike Park"></img>'
return div;
};
legend.addTo(map);
//Location control
L.control.locate({
position: 'topright',
drawCircle: false,
follow: false
}).addTo(map);
//Zoom control
L.control.zoom().addTo(map);
//Layer control
L.control.layers(baselayers, [], {position: 'topleft'}).addTo(map);
//Search control
L.control.searchControl().addTo(map);
el.addTo(map);
</script>
<script type="text/javascript">
//Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36489204-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</html>