Add file download ability
This commit is contained in:
+11
-1
@@ -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():
|
||||
|
||||
+10
-2
@@ -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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>The Villages Import Tools</title>
|
||||
<title>OSM Import Tools</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
@@ -63,6 +63,7 @@
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
transition: background 0.2s;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.script-button:hover {
|
||||
@@ -167,7 +168,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>The Villages Import Tools</h1>
|
||||
<h1>OSM Import Tools</h1>
|
||||
<p class="subtitle">Run data processing scripts and view results</p>
|
||||
|
||||
<div class="section">
|
||||
@@ -214,6 +215,31 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Data Downloads</h2>
|
||||
|
||||
{% for county, file_names in data_files.items() %}
|
||||
<div class="county-group">
|
||||
<h3>{{ county|title }}</h3>
|
||||
|
||||
{% for file_name in file_names %}
|
||||
<div class="button-grid">
|
||||
{% if 'lake' in county %}
|
||||
<a class="script-button lake" href="/data/latest/{{ county }}/{{ file_name }}">
|
||||
{{ file_name }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if 'sumter' in county %}
|
||||
<a class="script-button sumter" href="/data/latest/{{ county }}/{{ file_name }}">
|
||||
{{ file_name }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="log-viewer">
|
||||
<h2>Script Output</h2>
|
||||
<div id="status" class="status-message"></div>
|
||||
|
||||
Reference in New Issue
Block a user