-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·259 lines (226 loc) · 8.9 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<base target="_top">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CLE Form-Based Code</title>
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<script src="https://kit.fontawesome.com/a7ec421c16.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js"></script>
<style>
html, body {
height: 100%;
margin: 0;
}
.leaflet-container {
height: 100%;
width: 100%;
max-width: 100%;
max-height: 100%;
}
.geojson-label {
background-color: rgba(255, 255, 255, 0.3);
border-radius: 4px;
padding: 2px 4px;
font-size: 12px;
color: black;
font-weight: bold;
}
.hidden-label {
display: none;
}
</style>
<style>#map { width: 100%; height: 100%; }
.info { padding: 6px 8px; font: 14px/16px Arial, Helvetica, sans-serif; background: white; background: rgba(255,255,255,0.8); box-shadow: 0 0 15px rgba(0,0,0,0.2); border-radius: 5px; } .info h4 { margin: 0 0 5px; color: #777; }
.legend { text-align: left; line-height: 18px; color: #555; } .legend i { width: 18px; height: 18px; float: left; margin-right: 8px; opacity: 0.7; }</style>
</head>
<body>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel"></h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<div id='map'></div>
<script type="text/javascript" src="js/permitted-use-table-by-zone.js"></script>
<script type="text/javascript">
const exampleModal = document.getElementById('exampleModal')
var myModal = new bootstrap.Modal(exampleModal, {
keyboard: false
})
const colors = {
'C3': {'color': 'f1dbda', 'name': 'C3 Community 3'},
'C4': {'color': 'c4a4a6', 'name': 'C4 Community 4'},
'CV': {'color': 'adafaf', 'name': 'CV Civic'},
'CX3': {'color': 'dbb2b1', 'name': 'CX3 Community Flex 3'},
'CX4': {'color': 'be7268', 'name': 'CX4 Community Flex 4'},
'H3': {'color': 'fef5c4', 'name': 'H3 House 3'},
'H4': {'color': 'fbe78b', 'name': 'H4 House 4'},
'IX3': {'color': 'b8acb8', 'name': 'IX3 Industrial Flex 3'},
'IX5': {'color': '7e7794', 'name': 'IX5 Industrial Flex 5'},
'IX7': {'color': '7e7794', 'name': 'IX7 Industrial Flex 7'},
'N2.5': {'color': 'f0ca81', 'name': 'N2.5 Neighorhood 2.5'},
'NX3': {'color': 'e1a14b', 'name': 'NX3 Neighborhood Flex 3'},
'PK': {'color': 'abb687', 'name': 'PK Park'},
'UI4': {'color': 'e5ced3', 'name': 'UI4 Urban Innovation 4'},
'UIC': {'color': 'c498a8', 'name': 'UIC Urban Innovation Campus'},
'UN3': {'color': 'a6c3c0', 'name': 'UN3 Urban Node 3'},
'UN4': {'color': '619290', 'name': 'UN4 Urban Node 4'},
'UN5': {'color': '3f6b68', 'name': 'UN5 Urban Node 5'},
'UX3': {'color': 'cfdce4', 'name': 'UX3 Urban Flex 3'},
'UX4': {'color': 'afbcc2', 'name': 'UX4 Urban Flex 4'},
'UX5': {'color': '6f809a', 'name': 'UX5 Urban Flex 5'}
}
const map = L.map('map').setView([41.495721047150596, -81.67991638183595], 13);
const tiles = L.tileLayer('https://tiles.stadiamaps.com/tiles/alidade_smooth/{z}/{x}/{y}{r}.{ext}', {
minZoom: 0,
maxZoom: 20,
ext: 'png'}
).addTo(map);
// get color depending on population density value
function getColor(d) {
return '#'+colors[d]['color'];
}
function style(feature) {
return {
weight: 1,
opacity: 1,
color: 'gray',
dashArray: '3',
fillOpacity: 0,
fillColor: getColor(feature.properties.fbc_zoning)
};
}
function styleZones(feature) {
return {
weight: 0,
opacity: 0,
color: 'gray',
dashArray: '3',
fillOpacity: 0.7,
fillColor: getColor(feature.properties.fbc_zoning)
};
}
function highlightFeature(e) {
const layer = e.target;
layer.setStyle({
weight: 5,
color: '#666',
dashArray: '',
fillOpacity: 0.7
});
layer.bringToFront();
}
/* load parcels in the FBC areas */
var geojson;
fetch('js/fbc-parcels.geojson')
.then(response => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then(data => {
geojson = L.geoJson(data, {
style,
onEachFeature
}).addTo(map);
map.fitBounds(geojson.getBounds());
});
var geojsonZones;
fetch('js/fbc-large-zones.geojson')
.then(response => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then(data => {
geojsonZones = L.geoJson(data, {
style: styleZones,
interactive: false,
onEachFeature: function (feature, layer) {
var centroid = turf.centroid(feature);
var latLng = L.latLng(centroid.geometry.coordinates[1], centroid.geometry.coordinates[0]);
var tooltip = L.tooltip({
permanent: true,
direction: 'center',
className: 'geojson-label'
}).setContent(feature.properties.fbc_zoning).setLatLng(latLng);
layer.bindTooltip(tooltip);
}
}).addTo(map);
map.fire('zoomend');
});
function resetHighlight(e) {
geojson.resetStyle(e.target);
info.update();
}
function updateModal(zoning, parcelpin, address) {
$('#exampleModalLabel').html('Parcel '+parcelpin+' (<a target="_blank" href="http://neocando.case.edu/cando/propLaunch.jsp?type=aud&parcel='+parcelpin+'">MyPlace <i class="fa-solid fa-arrow-up-right-from-square"></i></a>)<br><h6>'+address+'</h6>');
popup_data = '<h4>Zoning: <u>' + colors[zoning]['name']+'</u></h4><img width=100% src="imgs/'+zoning + '-INTENT.jpg"><br><img width=100% src="imgs/'+zoning + '-SITE.jpg"><br><img width=100% src="imgs/'+zoning + '-BUILDING.jpg"></div>';
popup_data += '<br><hr><div style="overflow:hidden;overflow-y:scroll;"><h4>Property Uses:</h4><br><table class="table table-striped"><tr>';
for (const [key, value] of Object.entries(permitted_uses_by_zone[zoning])) {
if (value == 'P') {
text_value = '<i class="fa-regular fa-circle-check"></i></td><td>(P) Permitted'
} else if (value == 'C') {
text_value = '<i class="fa-solid fa-triangle-exclamation"></i></td><td>(C) Conditional,<br>CPC approval req.'
} else if (value == 'P*') {
text_value = '<i class="fa-regular fa-circle-check"></i></td><td>(P*) Permitted,<br>w/additional use standards'
} else if (value == 'C*') {
text_value = '<i class="fa-solid fa-triangle-exclamation"></i></td><td>(C*) Conditional,<br>CPC approval req.<br>w/additional use standards'
} else if (value == 'NP') {
text_value = '<i class="fa-solid fa-square-xmark"></i></td><td>Variance required'
}
popup_data += `<td>${key}</td><td> ${text_value}</td></tr>`;
}
popup_data += "</table>";
$('.modal-body').html(popup_data)
}
function openThePopup(e) {
updateModal(e.target.feature.properties.fbc_zoning, e.target.feature.properties.parcelpin, e.target.feature.properties.par_addr_a)
myModal.show()
}
function onEachFeature(feature, layer) {
layer.on({
mouseover: highlightFeature,
mouseout: resetHighlight,
click: openThePopup
});
}
// Minimum zoom level for labels to be visible
var minLabelZoom = 16;
// Show or hide labels based on zoom level
map.on('zoomend', function () {
var zoom = map.getZoom();
var labels = document.getElementsByClassName('geojson-label');
for (var i = 0; i < labels.length; i++) {
if (zoom >= minLabelZoom) {
labels[i].classList.remove('hidden-label');
} else {
labels[i].classList.add('hidden-label');
}
}
});
// Trigger zoomend to initialize the labels correctly
map.fire('zoomend');
</script>
</body>
</html>