allow hiding unclassified, tracks
This commit is contained in:
+18
-3
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user