allow hiding unclassified, tracks

This commit is contained in:
zyphlar
2026-02-26 18:06:11 -08:00
parent bdaafd85ef
commit 3e114b05ac
2 changed files with 23 additions and 4 deletions
+18 -3
View File
@@ -123,10 +123,13 @@ function countyStyle(feature) {
// Filter function for OSM features
function shouldShowOsmFeature(feature) {
const props = feature.properties || {};
const isService = props.highway === 'service';
const isService = props.highway === 'service' || props.highway === 'track';
const isUnclassified = props.highway === 'unclassified';
const hideService = document.getElementById('hideService').checked;
const hideUnclassified = document.getElementById('hideUnclassified').checked;
if (isService && hideService) return false;
if (isUnclassified && hideUnclassified) return false;
return true;
}
@@ -172,11 +175,13 @@ function createOsmLayer() {
function shouldShowFeature(feature) {
const props = feature.properties || {};
const isRemoved = props.removed === true || props.removed === 'True';
const isService = props.highway === 'service';
const isService = props.highway === 'service' || props.highway === 'track';
const isUnclassified = props.highway === 'unclassified';
const showAdded = document.getElementById('showAdded').checked;
const showRemoved = document.getElementById('showRemoved').checked;
const hideService = document.getElementById('hideService').checked;
const hideUnclassified = document.getElementById('hideUnclassified').checked;
// Check removed/added filter
if (isRemoved && !showRemoved) return false;
@@ -184,6 +189,7 @@ function shouldShowFeature(feature) {
// Check service filter
if (isService && hideService) return false;
if (isUnclassified && hideUnclassified) return false;
return true;
}
@@ -229,10 +235,13 @@ function createDiffLayer() {
// Filter function for county features
function shouldShowCountyFeature(feature) {
const props = feature.properties || {};
const isService = props.highway === 'service';
const isService = props.highway === 'service' || props.highway === 'track';
const isUnclassified = props.highway === 'unclassified';
const hideService = document.getElementById('hideService').checked;
const hideUnclassified = document.getElementById('hideUnclassified').checked;
if (isService && hideService) return false;
if (isUnclassified && hideUnclassified) return false;
return true;
}
@@ -617,6 +626,12 @@ document.addEventListener('DOMContentLoaded', function() {
createCountyLayer();
});
document.getElementById('hideUnclassified').addEventListener('change', function() {
createDiffLayer();
createOsmLayer();
createCountyLayer();
});
// Load button
document.getElementById('loadButton').addEventListener('click', loadFiles);
+5 -1
View File
@@ -178,7 +178,11 @@
</label>
<label>
<input type="checkbox" id="hideService">
Hide highway=service
Hide highway=service/track
</label>
<label>
<input type="checkbox" id="hideUnclassified">
Hide highway=unclassified
</label>
<h3 style="margin-top: 15px;">Load Files</h3>