forked from vporwal/maps-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdips2014.html
272 lines (243 loc) · 9.81 KB
/
gdips2014.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<!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>New Planning Scheme - 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>
<link rel="stylesheet" href="src/leaflet/locate/L.Control.Locate.css" />
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="css/nps.css" />
<link rel="stylesheet" href="src/leaflet/gcc_geosearch/l.gcc_geosearch.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="src/lib/proj4js-compressed.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
<script>
var center = new L.LatLng(-42.8240,147.2171);
var map = new L.Map('map', { center: center, zoom: 12, attributionControl:true, zoomControl:false, detectRetina:true});
//Define layers
var gccAtt = '© Glenorchy City Council, <a href="http://creativecommons.org/licenses/by/3.0/au/">CC-BY</a>'
//Where's GeoServer?
var rootURL = "https://maps.gcc.tas.gov.au/"
var owsrootUrl = rootURL + 'geoserver/ows';
var ps_baseLabels = new L.TileLayer.WMS(rootURL+"geoserver/gwc/service/wms", {
layers: 'gcc_ips:gips_baselayers',
format: 'image/png',
transparent: true,
maxZoom: 20,
attribution: gccAtt
});
var image = new L.tileLayer("https://services.thelist.tas.gov.au/arcgis/rest/services/Basemaps/Orthophoto/ImageServer/tile/{z}/{y}/{x}", {
attribution: "Basemap © The LIST",
maxZoom: 20,
maxNativeZoom: 19,
opacity: 0.6,
transparent: true
});
var ps = new L.TileLayer.WMS(rootURL+"geoserver/gwc/service/wms", {
layers: 'gcc_ips:gips_zoning',
format: 'image/png',
transparent: true,
maxZoom: 20,
attribution: gccAtt
});
//add labels
map.addLayer(ps_baseLabels);
//Are we in ie?
var ie = L.Browser.ie;
map.addLayer(ps);
var overlays = {
"Aerial Image": image,
"Labels and Boundaries": ps_baseLabels
};
var baseLayersList = {
"E3 Landslide Code": 'LDS_Landslide_Glenorchy',
"E8 Electricity Transmission Infrastructure Protection Code": 'ETP_ElecTranInfraProtection_Glenorchy',
"E10 Biodiversity Code": 'NAT_Biodiversity_Glenorchy',
"E11(a) Waterway and Coastal Protection Code": 'WAT_WaterwayCoastProtection_Glenorchy',
"E11(b) Waterway and Coastal Protection Code": 'REF_CoastRefugia_Glenorchy',
"E14 Scenic Landscapes Code": 'SCN_ScenicManagement_Glenorchy',
"E15 Inundation Prone Areas Code": 'FLD_FloodProne_Glenorchy',
"E16 Coastal Erosion Hazard Code": 'CST_CoastErosion_Glenorchy',
"E20 Acid Sulfate Soils Code": 'ASS_CoastAcidSulf_Glenorchy',
"E21 Dispersive Soils Code": 'DSP_DispersiveSoil_Glenorchy',
"E24 Significant Trees Code": 'TRE_SignificantTrees_Glenorchy',
"E25 Streetscape Character Code": 'SSC_StreetscapeChar_Glenorchy',
"F Specific Area Plans": 'SAP_Glenorchy'
};
//Set up all the overlays for Leaflet.
var baselayers = {
"Zoning": ps
};
for (layer in baseLayersList) {
var newLayer = new L.TileLayer.WMS(rootURL + "geoserver/gwc/service/wms", {
layers: "gcc_ips:"+baseLayersList[layer],
format: 'image/png',
transparent: true,
maxZoom: 20,
attribution: gccAtt
});
baselayers[layer] = newLayer;
};
//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, overlays, {position: 'topleft'}).addTo(map);
//Search control
L.control.searchControl({type:'pin'}).addTo(map);
//Query layer functionality.
var selectedFeature;
var queryCoordinates;
var queryAddress;
var src = new Proj4js.Proj('EPSG:4326');
var dst = new Proj4js.Proj('EPSG:28355');
function handleJson(data) {
if (selectedFeature) {
map.removeLayer(selectedFeature);
};
selectedFeature = L.geoJson(data, {
style: function (feature) {
return {color: 'blue'};
},
onEachFeature: function (feature, layer) {
var content = "<b>Address:</b> " + ((feature.properties.address) ? feature.properties.address : "")
+ "<br><b>PID:</b> " + ((feature.properties.pid != -9999) ? feature.properties.pid : "")
+ "<br><b>Zones:</b> " + feature.properties.zones
+ "<br><b>Overlays:</b> " + ((feature.properties.overlays) ? feature.properties.overlays : "none")
+ "<br><b>Reference Layers:</b> " + "none"// ((feature.properties.reflayers) ? feature.properties.reflayers : "none")
+ "<br>Note: Other codes may be triggered by description, refer to "Application" section in each code.";
var popup = L.popup()
.setLatLng(queryCoordinates)
.setContent(content)
.openOn(map);
layer.bindPopup(content);
queryAddress = feature.properties.address;
}
});
selectedFeature.addTo(map);
}
map.on('click', function(e) {
var p = new Proj4js.Point(e.latlng.lng,e.latlng.lat);
Proj4js.transform(src, dst, p);
queryCoordinates = e.latlng
var defaultParameters = {
service : 'WFS',
version : '1.1.1',
request : 'GetFeature',
typeName : 'gcc_ips:GlenorchyInterimPlanningScheme',
maxFeatures : 100,
outputFormat : 'text/javascript',
format_options : 'callback:getJson',
SrsName : 'EPSG:4326'
};
var customParams = {
//bbox : map.getBounds().toBBoxString(),
cql_filter:'CONTAINS(geom, POINT(' + p.x + ' ' + p.y + '))'
};
var parameters = L.Util.extend(defaultParameters, customParams);
//console.log(owsrootUrl + L.Util.getParamString(parameters));
$.ajax({
url : owsrootUrl + L.Util.getParamString(parameters),
dataType : 'jsonp',
jsonpCallback : 'getJson',
success : handleJson
});
});
//Interactive Zone Boundaries
var defaultParameters = {
service : 'WFS',
version : '2.0',
request : 'GetFeature',
typeName : 'gcc_ips:ZoneBdy_GCC',
outputFormat : 'text/javascript',
format_options : 'callback:getJson',
SrsName : 'EPSG:4326'
};
var parameters = L.Util.extend(defaultParameters);
var zbURL = owsrootUrl + L.Util.getParamString(parameters);
var zb = null;
function getZB() {
$.ajax({
url : zbURL,
dataType : 'jsonp',
jsonpCallback : 'getJson',
success : function (response) {
zb = L.geoJson(response, {
style: function (feature) {
return {
stroke: true,
color: '#ffffff',
opacity: 0.1,
weight: 4
};
},
onEachFeature: function (feature, layer) {
popupOptions = {maxWidth: 200};
layer.bindPopup("<h3>Non-Cadastral Zone Boundary</h3>" +
"<b>ID: </b>" + feature.properties.id +
"<br><b>Description: </b>" + feature.properties.descrip +
"<br><b>Source: </b>" + feature.properties.source
,popupOptions);
}
});
}
});
};
getZB();
//a bit of a hack, needs to check for zb because the hash plugin gets triggered before zb is loaded.
map.on('viewreset', function() {
var zoom = this.getZoom();
if(zoom > 15) {
map.addLayer(zb);
} else {
map.removeLayer(zb);
}
},map);
var disclaimer = L.control({position: 'bottomright'});
disclaimer.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info-legend');
div.innerHTML = '<b>Glenorchy Draft Interim Planning Scheme 2014 <br>Last updated 5 March 2014</b>'
return div;
};
disclaimer.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>