Add file download ability
This commit is contained in:
+11
-1
@@ -30,9 +30,19 @@ def index():
|
|||||||
'Utilities': ['ls', 'make-new-latest']
|
'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',
|
return render_template('index.html',
|
||||||
script_map=script_map,
|
script_map=script_map,
|
||||||
scripts_by_category=scripts_by_category)
|
scripts_by_category=scripts_by_category,
|
||||||
|
data_files=data_files
|
||||||
|
)
|
||||||
|
|
||||||
@app.route('/map')
|
@app.route('/map')
|
||||||
def map_viewer():
|
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) {
|
function diffStyle(feature) {
|
||||||
// Check if feature is accepted or rejected
|
// Check if feature is accepted or rejected
|
||||||
if (acceptedFeatures.has(feature)) {
|
if (acceptedFeatures.has(feature)) {
|
||||||
@@ -198,6 +203,9 @@ function createDiffLayer() {
|
|||||||
|
|
||||||
diffLayer = L.geoJSON(diffData, {
|
diffLayer = L.geoJSON(diffData, {
|
||||||
style: diffStyle,
|
style: diffStyle,
|
||||||
|
// pointToLayer: function (geoJsonPoint, latlng) {
|
||||||
|
// return L.marker(latlng, {icon: leafIcon});
|
||||||
|
// }
|
||||||
filter: shouldShowFeature,
|
filter: shouldShowFeature,
|
||||||
pane: 'diffPane',
|
pane: 'diffPane',
|
||||||
onEachFeature: function(feature, layer) {
|
onEachFeature: function(feature, layer) {
|
||||||
@@ -473,9 +481,9 @@ async function loadFiles() {
|
|||||||
diffFile = `latest/${county}/diff-paths.geojson`;
|
diffFile = `latest/${county}/diff-paths.geojson`;
|
||||||
countyFile = `latest/${county}/county-paths.geojson`;
|
countyFile = `latest/${county}/county-paths.geojson`;
|
||||||
} else if (dataType === 'addresses') {
|
} else if (dataType === 'addresses') {
|
||||||
osmFile = null; // No OSM addresses file
|
osmFile = null; //`latest/${county}/addresses-existing.geojson`;
|
||||||
diffFile = `latest/${county}/addresses-to-add.geojson`;
|
diffFile = `latest/${county}/addresses-to-add.geojson`;
|
||||||
countyFile = `latest/${county}/addresses-existing.geojson`;
|
countyFile = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load files from server
|
// Load files from server
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>The Villages Import Tools</title>
|
<title>OSM Import Tools</title>
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
transition: background 0.2s;
|
transition: background 0.2s;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.script-button:hover {
|
.script-button:hover {
|
||||||
@@ -167,7 +168,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<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>
|
<p class="subtitle">Run data processing scripts and view results</p>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
@@ -214,6 +215,31 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</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">
|
<div class="log-viewer">
|
||||||
<h2>Script Output</h2>
|
<h2>Script Output</h2>
|
||||||
<div id="status" class="status-message"></div>
|
<div id="status" class="status-message"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user