Skip to content

Commit 2321a4b

Browse files
committed
fix
1 parent 96540cd commit 2321a4b

6 files changed

+1868
-120
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.DS_Store
2+
*.qmd

index.html

+34-118
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ <h4 class="modal-title" id="exampleModalLabel"></h4>
6767

6868
<div id='map'></div>
6969

70-
<script type="text/javascript" src="js/fbc.js"></script>
71-
<script type="text/javascript" src="js/fbc-large-zones.js"></script>
7270
<script type="text/javascript" src="js/permitted-use-table-by-zone.js"></script>
7371

7472
<script type="text/javascript">
@@ -78,9 +76,6 @@ <h4 class="modal-title" id="exampleModalLabel"></h4>
7876
keyboard: false
7977
})
8078

81-
82-
83-
8479
const colors = {
8580
'C3': {'color': 'f1dbda', 'name': 'C3 Community 3'},
8681
'C4': {'color': 'c4a4a6', 'name': 'C4 Community 4'},
@@ -104,41 +99,17 @@ <h4 class="modal-title" id="exampleModalLabel"></h4>
10499
'UX4': {'color': 'afbcc2', 'name': 'UX4 Urban Flex 4'},
105100
'UX5': {'color': '6f809a', 'name': 'UX5 Urban Flex 5'}
106101
}
107-
const map = L.map('map').setView([41.496273, -81.633495], 13);
102+
const map = L.map('map').setView([41.495721047150596, -81.67991638183595], 13);
108103

109104
const tiles = L.tileLayer('https://tiles.stadiamaps.com/tiles/alidade_smooth/{z}/{x}/{y}{r}.{ext}', {
110-
minZoom: 0,
111-
maxZoom: 20,
112-
ext: 'png'}).addTo(map);
113-
114-
// control that shows state info on hover
115-
const info = L.control();
116-
117-
info.onAdd = function (map) {
118-
this._div = L.DomUtil.create('div', 'info');
119-
this.update();
120-
return this._div;
121-
};
122-
123-
info.update = function (props) {
124-
const contents = props ? `<b>Parcel PIN: ${props.parcelpin}</b><br />Zoning District: ${colors[props.fbc_zoning]['name']}` : 'Hover over a parcel';
125-
// this._div.innerHTML = `<h4>Cleveland's Form-Based Zoning Code</h4>${contents}`;
126-
};
127-
128-
// info.addTo(map);
129-
105+
minZoom: 0,
106+
maxZoom: 20,
107+
ext: 'png'}
108+
).addTo(map);
130109

131110
// get color depending on population density value
132111
function getColor(d) {
133-
// console.log(d)
134112
return '#'+colors[d]['color'];
135-
return d > 1000 ? '#800026' :
136-
d > 500 ? '#BD0026' :
137-
d > 200 ? '#E31A1C' :
138-
d > 100 ? '#FC4E2A' :
139-
d > 50 ? '#FD8D3C' :
140-
d > 20 ? '#FEB24C' :
141-
d > 10 ? '#FED976' : '#FFEDA0';
142113
}
143114

144115
function style(feature) {
@@ -174,13 +145,11 @@ <h4 class="modal-title" id="exampleModalLabel"></h4>
174145
});
175146

176147
layer.bringToFront();
177-
178-
// info.update(layer.feature.properties);
179148
}
180149

181150
/* load parcels in the FBC areas */
182151
var geojson;
183-
fetch('js/fbc-parcels.geojson') // Replace with the path to your GeoJSON file
152+
fetch('js/fbc-parcels.geojson')
184153
.then(response => {
185154
if (!response.ok) {
186155
throw new Error("Network response was not ok");
@@ -194,24 +163,34 @@ <h4 class="modal-title" id="exampleModalLabel"></h4>
194163
}).addTo(map);
195164
map.fitBounds(geojson.getBounds());
196165
});
197-
198-
199166

200-
// add zone labels
201-
const geojsonZones = L.geoJson(zones, {
202-
style: styleZones,
203-
interactive: false,
204-
onEachFeature: function (feature, layer) {
205-
var centroid = turf.centroid(feature);
206-
var latLng = L.latLng(centroid.geometry.coordinates[1], centroid.geometry.coordinates[0]);
207-
var tooltip = L.tooltip({
208-
permanent: true,
209-
direction: 'center',
210-
className: 'geojson-label'
211-
}).setContent(feature.properties.fbc_zoning).setLatLng(latLng);
212-
layer.bindTooltip(tooltip);
213-
}
214-
}).addTo(map);
167+
var geojsonZones;
168+
fetch('js/fbc-large-zones.geojson')
169+
.then(response => {
170+
if (!response.ok) {
171+
throw new Error("Network response was not ok");
172+
}
173+
return response.json();
174+
})
175+
.then(data => {
176+
geojsonZones = L.geoJson(data, {
177+
style: styleZones,
178+
interactive: false,
179+
onEachFeature: function (feature, layer) {
180+
var centroid = turf.centroid(feature);
181+
var latLng = L.latLng(centroid.geometry.coordinates[1], centroid.geometry.coordinates[0]);
182+
var tooltip = L.tooltip({
183+
permanent: true,
184+
direction: 'center',
185+
className: 'geojson-label'
186+
}).setContent(feature.properties.fbc_zoning).setLatLng(latLng);
187+
layer.bindTooltip(tooltip);
188+
}
189+
}).addTo(map);
190+
map.fire('zoomend');
191+
});
192+
193+
215194

216195
function resetHighlight(e) {
217196
geojson.resetStyle(e.target);
@@ -254,67 +233,7 @@ <h4 class="modal-title" id="exampleModalLabel"></h4>
254233
mouseout: resetHighlight,
255234
click: openThePopup
256235
});
257-
258-
// popup_data = '<h2>Parcel '+feature.properties.parcelpin+' <a target="_blank" href="http://neocando.case.edu/cando/propLaunch.jsp?type=aud&parcel='+feature.properties.parcelpin+'"><i class="fa-solid fa-link"></i></a></h2><h3>Zoning: '+colors[feature.properties.fbc_zoning]['name']+'</h3><div style="height:100px;overflow:hidden;overflow-y:scroll;"><b>Property Uses:</b><br><table class="table table-striped">';
259-
260-
// for (const [key, value] of Object.entries(permitted_uses_by_zone[feature.properties.fbc_zoning])) {
261-
// if (value == 'P') {
262-
// text_value = '<i class="fa-regular fa-circle-check"></i></td><td>OK'
263-
// } else if (value == 'C') {
264-
// text_value = '<i class="fa-solid fa-triangle-exclamation"></i></td><td>Conditional, CPC approval req.'
265-
// } else if (value == 'P*') {
266-
// text_value = '<i class="fa-regular fa-circle-check"></i></td><td>OK, w/rules'
267-
// } else if (value == 'C*') {
268-
// text_value = '<i class="fa-solid fa-triangle-exclamation"></i></td><td>Conditional, CPC approval req. & w/rules'
269-
// } else if (value == 'NP') {
270-
// text_value = '<i class="fa-solid fa-square-xmark"></i></td><td>Variance req.'
271-
// }
272-
// popup_data += `<td>${key}</td><td> ${text_value}</td>`;
273-
// }
274-
// popup_data += "</table>";
275-
// popup_data += '<img width=200 src="imgs/'+feature.properties.fbc_zoning + '-SITE.jpg"><br><img width=200 src="imgs/'+feature.properties.fbc_zoning + '-BUILDING.jpg"></div>';
276-
277-
// layer.bindPopup(popup_data, {
278-
// maxWidth : 560
279-
// });
280-
281-
282-
283-
284-
285236
}
286-
287-
288-
289-
const legend = L.control({position: 'bottomright'});
290-
291-
legend.onAdd = function (map) {
292-
293-
const div = L.DomUtil.create('div', 'info legend');
294-
const grades = [0, 10, 20, 50, 100, 200, 500, 1000];
295-
const labels = [];
296-
const zones = ['C3', 'C4', 'CV', 'CX3', 'CX4']
297-
298-
let from, to;
299-
300-
// for (let i = 0; i < zones.length; i++) {
301-
// // from = grades[i];
302-
// // to = grades[i + 1];
303-
304-
// labels.push(`<i style="background:#${colors[zones[i]]}"></i> ${zones[i]}`);
305-
// }
306-
307-
for (const [key, value] of Object.entries(colors)) {
308-
labels.push(`<i style="background:#${value['color']}"></i> ${value['name']}`);
309-
}
310-
311-
div.innerHTML = labels.join('<br>');
312-
return div;
313-
};
314-
315-
// legend.addTo(map);
316-
317-
318237
// Minimum zoom level for labels to be visible
319238
var minLabelZoom = 16;
320239

@@ -335,8 +254,5 @@ <h4 class="modal-title" id="exampleModalLabel"></h4>
335254
map.fire('zoomend');
336255

337256
</script>
338-
339-
340-
341257
</body>
342-
</html>
258+
</html>

0 commit comments

Comments
 (0)