221 lines
7.1 KiB
HTML
221 lines
7.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Polygon Analysis & Editor</title>
|
|
<link rel="stylesheet" href="../theme.css">
|
|
<style>
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: #faf8f3;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin: 0;
|
|
}
|
|
header {
|
|
background: linear-gradient(135deg, var(--sc-primary) 0%, var(--sc-primary-light) 100%);
|
|
color: white;
|
|
padding: 15px 20px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 20px;
|
|
}
|
|
.back-btn {
|
|
background: rgba(255,255,255,0.2);
|
|
color: white;
|
|
border: 1px solid rgba(255,255,255,0.3);
|
|
padding: 8px 12px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
transition: background 0.3s ease;
|
|
flex-shrink: 0;
|
|
}
|
|
.back-btn:hover {
|
|
background: rgba(255,255,255,0.3);
|
|
}
|
|
header h1 {
|
|
font-size: 24px;
|
|
font-weight: 600;
|
|
flex: 1;
|
|
margin: 0;
|
|
}
|
|
.container {
|
|
flex: 1;
|
|
max-width: 1200px;
|
|
margin: 30px auto;
|
|
width: 100%;
|
|
padding: 0 20px;
|
|
box-sizing: border-box;
|
|
}
|
|
.card {
|
|
background: white;
|
|
padding: 25px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
border: 1px solid #e0d9d0;
|
|
margin-bottom: 20px;
|
|
}
|
|
.card h2 {
|
|
margin-top: 0;
|
|
color: #333;
|
|
border-bottom: 2px solid var(--sc-primary);
|
|
padding-bottom: 10px;
|
|
margin-bottom: 15px;
|
|
}
|
|
.file-input-wrapper {
|
|
position: relative;
|
|
display: inline-block;
|
|
width: 100%;
|
|
margin-top: 10px;
|
|
}
|
|
.file-input-label {
|
|
display: block;
|
|
padding: 30px;
|
|
border: 2px dashed var(--sc-primary);
|
|
border-radius: 6px;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.3s;
|
|
background: rgba(42, 171, 149, 0.05);
|
|
}
|
|
.file-input-label:hover {
|
|
border-color: var(--sc-primary-light);
|
|
background: rgba(37, 150, 190, 0.05);
|
|
}
|
|
.file-input-wrapper input[type="file"] {
|
|
display: none;
|
|
}
|
|
button {
|
|
background: var(--sc-primary);
|
|
color: white;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
transition: background 0.3s ease;
|
|
}
|
|
button:hover {
|
|
background: #238b7d;
|
|
}
|
|
button:disabled {
|
|
background: #ccc;
|
|
cursor: not-allowed;
|
|
}
|
|
.log-output {
|
|
background: #1e1e1e;
|
|
color: #d4d4d4;
|
|
padding: 15px;
|
|
border-radius: 4px;
|
|
font-family: 'Consolas', 'Monaco', monospace;
|
|
white-space: pre-wrap;
|
|
max-height: 400px;
|
|
overflow-y: auto;
|
|
margin-bottom: 15px;
|
|
font-size: 13px;
|
|
}
|
|
.hidden {
|
|
display: none;
|
|
}
|
|
.actions-row {
|
|
display: flex;
|
|
gap: 10px;
|
|
margin-top: 15px;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
}
|
|
footer {
|
|
background: white;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
margin-top: 20px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
text-align: center;
|
|
font-size: 13px;
|
|
color: #666;
|
|
border: 1px solid #e0d9d0;
|
|
}
|
|
/* Spinner */
|
|
.spinner {
|
|
border: 4px solid #f3f3f3;
|
|
border-top: 4px solid var(--sc-primary);
|
|
border-radius: 50%;
|
|
width: 20px;
|
|
height: 20px;
|
|
animation: spin 2s linear infinite;
|
|
display: inline-block;
|
|
vertical-align: middle;
|
|
margin-right: 10px;
|
|
}
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
if (sessionStorage.getItem('authenticated') !== 'true') {
|
|
window.location.href = '../login.html';
|
|
}
|
|
</script>
|
|
<header>
|
|
<button class="back-btn" onclick="window.location.href='../';" title="Back to main tools">← Back</button>
|
|
<h1>🔷 Polygon Analysis & Editor</h1>
|
|
</header>
|
|
|
|
<div class="container">
|
|
<div class="card">
|
|
<h2><span style="font-size: 24px;">🗺️</span> Upload GeoJSON</h2>
|
|
<p>Upload a GeoJSON file containing the polygons to analyze. The tool will check for overlaps and other issues.</p>
|
|
<div class="file-input-wrapper" id="dropZone">
|
|
<label class="file-input-label" for="geojsonFile">
|
|
<div id="fileLabelText">Drop your GeoJSON file here<br><small>or click to browse</small></div>
|
|
</label>
|
|
<input type="file" id="geojsonFile" accept=".geojson,.json" />
|
|
</div>
|
|
<div style="text-align: center; margin-top: 20px;">
|
|
<button id="analyzeBtn" disabled>Analyze Polygons</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card hidden" id="resultsCard">
|
|
<h2>Analysis Log</h2>
|
|
<div id="logOutput" class="log-output"></div>
|
|
|
|
<div class="actions-row">
|
|
<button id="downloadLogBtn">Download Log</button>
|
|
<button id="downloadCsvBtn">Download Overlap CSV</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card hidden" id="editCard">
|
|
<h2>Apply Edits?</h2>
|
|
<p>Would you like to automatically clean the polygons based on the analysis? (Fields with >30% overlap will be deleted, others trimmed)</p>
|
|
<div class="actions-row">
|
|
<button id="applyEditsBtn">✅ Yes, Apply Edits</button>
|
|
</div>
|
|
<div id="editResults" class="hidden" style="margin-top: 20px;">
|
|
<h3>Edit Results</h3>
|
|
<div id="editLogOutput" class="log-output"></div>
|
|
<button id="downloadCleanedBtn">Download Cleaned GeoJSON</button>
|
|
<button id="downloadEditLogBtn">Download Edit Log</button>
|
|
</div>
|
|
</div>
|
|
|
|
<footer>
|
|
Polygon Analysis Editor | Powered by Turf.js
|
|
</footer>
|
|
</div>
|
|
|
|
<!-- Libraries -->
|
|
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/rbush@3/rbush.min.js"></script>
|
|
<script src="app.js"></script>
|
|
</body>
|
|
</html>
|