From 69818eecba7057dc9cada3a695b3744dd3a2b48f Mon Sep 17 00:00:00 2001 From: zyphlar Date: Wed, 25 Feb 2026 10:25:48 -0800 Subject: [PATCH] Add file download ability --- web/server.py | 12 +++++++++++- web/static/map.js | 12 ++++++++++-- web/templates/index.html | 30 ++++++++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/web/server.py b/web/server.py index e7eeda5..087569f 100644 --- a/web/server.py +++ b/web/server.py @@ -30,9 +30,19 @@ def index(): 'Utilities': ['ls', 'make-new-latest'] } + # Get list of files + counties = os.listdir('/data/latest') + data_files = {} + for county in counties: + files = os.listdir('/data/latest/'+county) + data_files[county] = files + # data_files.append(county) + return render_template('index.html', script_map=script_map, - scripts_by_category=scripts_by_category) + scripts_by_category=scripts_by_category, + data_files=data_files + ) @app.route('/map') def map_viewer(): diff --git a/web/static/map.js b/web/static/map.js index 941c864..25da2fb 100644 --- a/web/static/map.js +++ b/web/static/map.js @@ -86,6 +86,11 @@ function osmStyle(feature) { }; } +// const leafIcon = new L.icon({ +// iconUrl: "https://docs.maptiler.com/sdk-js/examples/custom-points-icon-png/underground.png", //your custom pin +// iconSize: [24, 26], +// }); + function diffStyle(feature) { // Check if feature is accepted or rejected if (acceptedFeatures.has(feature)) { @@ -198,6 +203,9 @@ function createDiffLayer() { diffLayer = L.geoJSON(diffData, { style: diffStyle, + // pointToLayer: function (geoJsonPoint, latlng) { + // return L.marker(latlng, {icon: leafIcon}); + // } filter: shouldShowFeature, pane: 'diffPane', onEachFeature: function(feature, layer) { @@ -473,9 +481,9 @@ async function loadFiles() { diffFile = `latest/${county}/diff-paths.geojson`; countyFile = `latest/${county}/county-paths.geojson`; } else if (dataType === 'addresses') { - osmFile = null; // No OSM addresses file + osmFile = null; //`latest/${county}/addresses-existing.geojson`; diffFile = `latest/${county}/addresses-to-add.geojson`; - countyFile = `latest/${county}/addresses-existing.geojson`; + countyFile = null; } // Load files from server diff --git a/web/templates/index.html b/web/templates/index.html index 31fb0a8..789469d 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -3,7 +3,7 @@ - The Villages Import Tools + OSM Import Tools