const PARCEL_LOAD_KEY = "parcelsLoaded";
+const PICK_ZONINGS = new Set([
+ "SR-C1", "SR-C2", "SR-C3", "SR-V1", "SR-V2", "TR-C1", "TR-C2", "TR-C3",
+ "TR-C4", "TR-V1", "TR-V2", "TR-U1", "TR-U2", "TR-R", "TR-P"
+]);
+
+const MIN_LOT_SIZE_ACRES = 0.5;
+const MAX_LOT_SIZE_ACRES = 1.5;
+
function transposeCoordinates(coordList) {
return coordList.map(
poly => poly.map(
}
const store = db.query("features", "readonly");
- const PICK_ZONINGS = new Set(["TR-V2", "TR-U1", "TR-U2"]);
- overlay.innerText = "filtering & rendering parcels";
- let matchCount = 0;
+ overlay.innerText = "filtering parcels";
+ const matches = [];
let noZoningCount = 0;
let noLotSizeCount = 0;
// store.getAll doesn't work for some reason.
const zoningParts = (feature.properties.ZoningAll ?? "").split(", ");
const zoningMatch = zoningParts.length && new Set(zoningParts).intersection(PICK_ZONINGS).size;
const lotSizeAcres = feature.properties.LotSize / 43560;
- if (zoningMatch && lotSizeAcres >= 0.5 && lotSizeAcres <= 1.5) {
- const leafletCoords = transposeCoordinates(feature.geometry.coordinates);
- L.polygon(leafletCoords, {color: "blue", weight: 1}).addTo(map);
- matchCount += 1;
+ if (zoningMatch && lotSizeAcres >= MIN_LOT_SIZE_ACRES && lotSizeAcres <= MAX_LOT_SIZE_ACRES) {
+ matches.push(feature);
}
if (!zoningParts.length) {
noZoningCount += 1;
console.log(
"Searched %d parcels: %d matches, %d with no zoning, %d with no size",
await store.count(),
- matchCount,
+ matches.length,
noZoningCount,
noLotSizeCount,
);
+ overlay.innerText = "rendering parcels";
+ for (const feature of matches) {
+ const leafletCoords = transposeCoordinates(feature.geometry.coordinates);
+ L.polygon(leafletCoords, {color: "blue", weight: 1}).addTo(map);
+ }
+
overlay.style["display"] = "none";
}