forked from vporwal/maps-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wastepickup.html
153 lines (139 loc) · 5.85 KB
/
wastepickup.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
<!DOCTYPE html>
<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>Waste Pickup - Glenorchy City Council</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<script type="text/javascript" src="src/leaflet/leaflet.js"></script>
<link type="text/css" rel="stylesheet" href="src/leaflet/leaflet.css" />
<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="css/main.css" />
<link rel="stylesheet" href="css/nps.css" />
<link rel="stylesheet" href="css/waste.min.css" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="css/ie6.css" type="text/css" />
<link rel="stylesheet" href="css/waste.ie8.css" type="text/css" />
<![endif]-->
<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/select2/select2.min.js"></script>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
</style>
</head>
<body>
<div class="waste-info">
<form id="addressform" action="/address-search.php">
<input id="addresssearch" class="address-search" type="hidden" placeholder="Enter Address..." autocomplete="off" name="address" />
</form>
<div class="searchresults">
<p><b>Glenorchy City Council's Waste Pickup Timetable.</b><br>
<p>To find out what garbage and recycling services are associated with an address, please search above.</p>
</div>
</div>
<div id="map"></div>
<!-- load js for maps -->
<script type="text/javascript">
var center = new L.LatLng(-42.8232,147.2260);
var map = new L.Map('map', { center: center, zoom: 12, attributionControl:true, zoomControl:false, minZoom:8});
var markers = L.layerGroup().addTo(map);
var gccAtt = '© Glenorchy City Council, <a href="http://creativecommons.org/licenses/by/3.0/au/">CC-BY</a>'
var baselayers = {
"LIST Aerial Imagery": LISTAerial,
"LIST Topographic": LISTTopographic
};
map.addLayer(LISTTopographic)
var gccAtt = 'Data © Glenorchy City Council, <a href="http://creativecommons.org/licenses/by/3.0/au/">CC-BY</a>'
var waste = new L.TileLayer.WMS('https://maps.gcc.tas.gov.au/geoserver/GCC_cc/gwc/service/wms', {
layers: 'GCC_cc:WastePickupZones',
format: 'image/png',
maxZoom: 20,
transparent: true,
opacity: 0.6,
attribution: gccAtt
});
map.addLayer(waste);
var overlays = {
"Waste Pickup Zones": waste
};
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:WasteZones&&legend_options=fontName:Times%20New%20Roman;fontAntiAliasing:true" alt = "Waste Pickup Zones Legend"></img><br>Weekly shared bins are collected <br>on Thursday north of the dashed line<br> and Tuesday south of the line. <br>For more info, see the <a href="http://www.gcc.tas.gov.au/content/Kerbside_Waste_Services.GCC?ActiveID=1324">GCC website</a>.'
return div;
};
legend.addTo(map);
//Zoom control
L.control.zoom().addTo(map);
//Layer control
L.control.layers(baselayers, overlays, {position: 'topleft'}).addTo(map);
// Lookup and content formatting
$('#addresssearch').select2({
ajax: {
dataType: 'json',
results: function(data, page) {
return {results: data};
},
url: '/address-search.php',
data: function (term, page) {
return {
q: term,
qtype: 'search',
page: page,
page_limit: 10,
}
},
},
minimumInputLength: 3,
});
$('#addresssearch').change(function (e) {
e.preventDefault();
markers.clearLayers();
document.activeElement.blur();
var postData = {address: $('#addresssearch').val(), qtype: 'retrieve'};
$.post('/address-search.php', postData, function(data) {
writeUpServices(data.services);
var coOrds = $.parseJSON(data.geom);
var locArr = L.latLng(coOrds.coordinates[1], coOrds.coordinates[0]);
map.setView(locArr, 17);
L.marker(locArr).addTo(markers).bindPopup(data.address).openPopup();
})
})
function writeUpServices(services) {
$('.searchresults').empty();
var disclaimer = "<p>For unit developments, please note that the size and number of bins may vary from what is shown below. Please contact Council on <a href=tel:0362166800>6216 6800</a> for further information.</p>";
$('.searchresults').append(disclaimer);
$.each(services, function(key, serviceObj) {
serviceToHTML(serviceObj);
});
}
function serviceToHTML(serviceObj) {
var html = '<div class="serviceitem">';
html += '<h3>' + serviceObj.container + '</h3>';
html += '<dl><dt>Last Pickup</dt><dd>' + serviceObj.lastpickup + '</dd>';
html += '<dt class="odd"><strong>Next Pickup</strong></dt><dd class="odd"><strong>' + serviceObj.nextpickup + '</strong></dd>';
html += '<dt>Pickup Day</dt><dd>' + serviceObj.pickupday + '</dd>';
html += '<dt class="odd">Frequency</dt><dd class="odd">' + serviceObj.frequency + '</dd></dl></div>';
$('.searchresults').append(html);
}
//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>
</body>
</html>