CSNET's picture
ลองสร้าง html5 ที่ใช้ NDVI กับไร่จริงในประเทศไทยมาซัก 1 แปลงให้ดูให้เห็นภาพหน่อย
b263139 verified
Raw History Blame Contribute Delete
24.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ThaiRice NDVI Visualizer - Real-time Crop Health Monitoring</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<link rel="stylesheet" href="style.css">
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
<script src="components/ndvi-legend.js"></script>
</head>
<body class="bg-gray-50 text-gray-800">
<!-- Navigation -->
<custom-navbar></custom-navbar>
<!-- Hero Section -->
<section class="relative bg-gradient-to-r from-green-600 to-emerald-800 text-white py-16 md:py-24">
<div class="container mx-auto px-4">
<div class="max-w-3xl mx-auto text-center">
<h1 class="text-4xl md:text-6xl font-bold mb-6">ThaiRice NDVI Visualizer</h1>
<p class="text-xl md:text-2xl mb-8 opacity-90">Real-time Normalized Difference Vegetation Index monitoring for rice fields in Thailand</p>
<div class="flex flex-wrap justify-center gap-4">
<a href="#ndvi-map" class="bg-white text-green-700 hover:bg-green-50 font-semibold py-3 px-8 rounded-lg shadow-lg transition duration-300 transform hover:-translate-y-1">
<i data-feather="map" class="inline mr-2"></i> View NDVI Map
</a>
<a href="#field-details" class="bg-transparent border-2 border-white hover:bg-white/20 font-semibold py-3 px-8 rounded-lg transition duration-300">
<i data-feather="info" class="inline mr-2"></i> Field Details
</a>
</div>
</div>
</div>
<div class="absolute bottom-0 left-0 right-0">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
<path fill="#f9fafb" fill-opacity="1" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path>
</svg>
</div>
</section>
<!-- Main Content -->
<main class="container mx-auto px-4 py-12">
<!-- NDVI Map Section -->
<section id="ndvi-map" class="mb-20">
<div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-8">
<div>
<h2 class="text-3xl font-bold text-gray-900 mb-2">Rice Field NDVI Analysis</h2>
<p class="text-gray-600">Field ID: TH-RF-2023-042 • Last updated: Today, 14:30</p>
</div>
<div class="mt-4 md:mt-0">
<div class="inline-flex items-center bg-white rounded-lg shadow p-3">
<i data-feather="calendar" class="text-green-600 mr-2"></i>
<span class="font-medium">Growing Season: June - November 2023</span>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Map Visualization -->
<div class="lg:col-span-2">
<div class="bg-white rounded-2xl shadow-xl overflow-hidden border border-gray-200">
<div class="bg-gray-100 p-4 border-b border-gray-200">
<div class="flex items-center justify-between">
<h3 class="text-xl font-semibold text-gray-800">
<i data-feather="map-pin" class="inline mr-2 text-green-600"></i>
Rice Field Location: Suphan Buri Province
</h3>
<span class="bg-green-100 text-green-800 text-sm font-medium px-3 py-1 rounded-full">
15.3 Hectares
</span>
</div>
</div>
<div class="relative">
<!-- NDVI Map Image -->
<div class="relative h-96 overflow-hidden">
<img src="http://static.photos/agriculture/1200x630/78" alt="Rice Field NDVI Map" class="w-full h-full object-cover">
<div class="absolute inset-0 bg-gradient-to-t from-black/30 to-transparent"></div>
<!-- Map Overlay Elements -->
<div class="absolute top-4 left-4 bg-white/90 backdrop-blur-sm rounded-lg p-3 shadow-lg">
<div class="flex items-center">
<div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
<span class="font-medium">Healthy Vegetation</span>
</div>
</div>
<div class="absolute bottom-4 right-4 bg-white/90 backdrop-blur-sm rounded-lg p-3 shadow-lg">
<div class="text-sm">
<div class="font-semibold text-gray-800">NDVI Range: 0.4 - 0.8</div>
<div class="text-gray-600">Average: 0.62</div>
</div>
</div>
</div>
<!-- Map Controls -->
<div class="absolute bottom-4 left-4 flex space-x-2">
<button class="bg-white hover:bg-gray-100 text-gray-800 p-2 rounded-lg shadow-md transition duration-200">
<i data-feather="zoom-in"></i>
</button>
<button class="bg-white hover:bg-gray-100 text-gray-800 p-2 rounded-lg shadow-md transition duration-200">
<i data-feather="zoom-out"></i>
</button>
<button class="bg-white hover:bg-gray-100 text-gray-800 p-2 rounded-lg shadow-md transition duration-200">
<i data-feather="maximize"></i>
</button>
</div>
</div>
<div class="p-6">
<custom-ndvi-legend></custom-ndvi-legend>
</div>
</div>
</div>
<!-- Field Statistics -->
<div class="space-y-6">
<!-- Overall Health Card -->
<div class="bg-white rounded-2xl shadow-xl p-6 border border-gray-200">
<div class="flex items-center justify-between mb-4">
<h3 class="text-xl font-semibold text-gray-800">Field Health Score</h3>
<i data-feather="activity" class="text-green-600"></i>
</div>
<div class="text-center mb-6">
<div class="inline-flex items-center justify-center w-32 h-32 rounded-full bg-gradient-to-r from-green-500 to-emerald-600 shadow-lg">
<span class="text-4xl font-bold text-white">82%</span>
</div>
<p class="text-gray-600 mt-4">Excellent growing conditions</p>
</div>
<div class="space-y-4">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-600">Vegetation Density</span>
<span class="font-medium text-green-700">High</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-600 h-2 rounded-full" style="width: 85%"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-600">Water Stress</span>
<span class="font-medium text-green-700">Low</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full" style="width: 22%"></div>
</div>
</div>
</div>
</div>
<!-- Quick Actions -->
<div class="bg-gradient-to-br from-green-50 to-emerald-50 rounded-2xl shadow-lg p-6 border border-green-100">
<h3 class="text-xl font-semibold text-gray-800 mb-4">Quick Actions</h3>
<div class="space-y-3">
<button class="w-full flex items-center justify-between bg-white hover:bg-green-50 text-gray-800 p-3 rounded-lg border border-green-200 transition duration-200 group">
<div class="flex items-center">
<i data-feather="download" class="text-green-600 mr-3"></i>
<span>Download NDVI Report</span>
</div>
<i data-feather="chevron-right" class="text-gray-400 group-hover:text-green-600"></i>
</button>
<button class="w-full flex items-center justify-between bg-white hover:bg-green-50 text-gray-800 p-3 rounded-lg border border-green-200 transition duration-200 group">
<div class="flex items-center">
<i data-feather="share-2" class="text-green-600 mr-3"></i>
<span>Share with Team</span>
</div>
<i data-feather="chevron-right" class="text-gray-400 group-hover:text-green-600"></i>
</button>
<button class="w-full flex items-center justify-between bg-white hover:bg-green-50 text-gray-800 p-3 rounded-lg border border-green-200 transition duration-200 group">
<div class="flex items-center">
<i data-feather="bell" class="text-green-600 mr-3"></i>
<span>Set Health Alerts</span>
</div>
<i data-feather="chevron-right" class="text-gray-400 group-hover:text-green-600"></i>
</button>
</div>
</div>
</div>
</div>
</section>
<!-- Field Details Section -->
<section id="field-details" class="mb-20">
<h2 class="text-3xl font-bold text-gray-900 mb-8">Field Details & Historical Data</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-10">
<!-- Info Cards -->
<div class="bg-white rounded-xl shadow-lg p-6 border border-gray-200 hover:shadow-xl transition duration-300">
<div class="flex items-center mb-4">
<div class="bg-blue-100 p-3 rounded-lg mr-4">
<i data-feather="map-pin" class="text-blue-600"></i>
</div>
<div>
<h4 class="font-semibold text-gray-800">Location</h4>
<p class="text-gray-600 text-sm">Suphan Buri, Thailand</p>
</div>
</div>
<p class="text-gray-700">Lat: 14.4745° N, Long: 100.1175° E</p>
</div>
<div class="bg-white rounded-xl shadow-lg p-6 border border-gray-200 hover:shadow-xl transition duration-300">
<div class="flex items-center mb-4">
<div class="bg-green-100 p-3 rounded-lg mr-4">
<i data-feather="droplet" class="text-green-600"></i>
</div>
<div>
<h4 class="font-semibold text-gray-800">Rice Variety</h4>
<p class="text-gray-600 text-sm">Hom Mali 105</p>
</div>
</div>
<p class="text-gray-700">Premium Jasmine Rice</p>
</div>
<div class="bg-white rounded-xl shadow-lg p-6 border border-gray-200 hover:shadow-xl transition duration-300">
<div class="flex items-center mb-4">
<div class="bg-amber-100 p-3 rounded-lg mr-4">
<i data-feather="sun" class="text-amber-600"></i>
</div>
<div>
<h4 class="font-semibold text-gray-800">Planting Date</h4>
<p class="text-gray-600 text-sm">June 15, 2023</p>
</div>
</div>
<p class="text-gray-700">Day 87 of growth cycle</p>
</div>
<div class="bg-white rounded-xl shadow-lg p-6 border border-gray-200 hover:shadow-xl transition duration-300">
<div class="flex items-center mb-4">
<div class="bg-purple-100 p-3 rounded-lg mr-4">
<i data-feather="trending-up" class="text-purple-600"></i>
</div>
<div>
<h4 class="font-semibold text-gray-800">Expected Yield</h4>
<p class="text-gray-600 text-sm">8.2 tons/hectare</p>
</div>
</div>
<p class="text-gray-700">+12% vs. regional average</p>
</div>
</div>
<!-- Historical Chart -->
<div class="bg-white rounded-2xl shadow-xl p-6 border border-gray-200">
<div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-8">
<div>
<h3 class="text-2xl font-bold text-gray-900 mb-2">NDVI Trend (Last 30 Days)</h3>
<p class="text-gray-600">Tracking vegetation health throughout the growing season</p>
</div>
<div class="mt-4 md:mt-0">
<div class="inline-flex bg-gray-100 rounded-lg p-1">
<button class="px-4 py-2 rounded-md bg-white shadow text-gray-800 font-medium">30D</button>
<button class="px-4 py-2 rounded-md text-gray-600 hover:text-gray-800 font-medium">90D</button>
<button class="px-4 py-2 rounded-md text-gray-600 hover:text-gray-800 font-medium">1Y</button>
</div>
</div>
</div>
<!-- Chart Container -->
<div class="h-80 relative">
<!-- Simulated Chart -->
<div class="absolute inset-0 flex items-end">
<!-- Chart bars simulation -->
<div class="flex-1 h-full flex items-end justify-around px-4">
<div class="w-8 bg-gradient-to-t from-red-400 to-red-300 rounded-t-lg" style="height: 40%"></div>
<div class="w-8 bg-gradient-to-t from-orange-400 to-orange-300 rounded-t-lg" style="height: 55%"></div>
<div class="w-8 bg-gradient-to-t from-yellow-400 to-yellow-300 rounded-t-lg" style="height: 65%"></div>
<div class="w-8 bg-gradient-to-t from-green-400 to-green-300 rounded-t-lg" style="height: 75%"></div>
<div class="w-8 bg-gradient-to-t from-green-500 to-green-400 rounded-t-lg" style="height: 82%"></div>
<div class="w-8 bg-gradient-to-t from-green-600 to-green-500 rounded-t-lg" style="height: 85%"></div>
<div class="w-8 bg-gradient-to-t from-green-700 to-green-600 rounded-t-lg" style="height: 88%"></div>
</div>
</div>
<!-- Chart Labels -->
<div class="absolute bottom-0 left-0 right-0 border-t border-gray-200 pt-2">
<div class="flex justify-around text-sm text-gray-500">
<span>Week 1</span>
<span>Week 2</span>
<span>Week 3</span>
<span>Week 4</span>
</div>
</div>
<!-- Current NDVI Indicator -->
<div class="absolute top-8 right-8 bg-white border border-green-200 rounded-lg p-4 shadow-lg">
<div class="text-center">
<div class="text-2xl font-bold text-green-700">0.62</div>
<div class="text-sm text-gray-600">Current NDVI</div>
<div class="text-xs text-green-600 mt-1">
<i data-feather="trending-up" class="inline w-4 h-4"></i>
+0.08 from last week
</div>
</div>
</div>
</div>
<!-- Chart Legend -->
<div class="flex flex-wrap justify-center gap-6 mt-8 pt-6 border-t border-gray-200">
<div class="flex items-center">
<div class="w-4 h-4 rounded-full bg-red-400 mr-2"></div>
<span class="text-sm text-gray-700">Low Vegetation (0.0-0.2)</span>
</div>
<div class="flex items-center">
<div class="w-4 h-4 rounded-full bg-green-400 mr-2"></div>
<span class="text-sm text-gray-700">Moderate (0.2-0.5)</span>
</div>
<div class="flex items-center">
<div class="w-4 h-4 rounded-full bg-green-600 mr-2"></div>
<span class="text-sm text-gray-700">High (0.5-0.8)</span>
</div>
</div>
</div>
</section>
<!-- Recommendations Section -->
<section class="mb-20">
<h2 class="text-3xl font-bold text-gray-900 mb-8">AI-Powered Recommendations</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-gradient-to-br from-blue-50 to-white rounded-2xl shadow-lg p-6 border border-blue-100">
<div class="flex items-center mb-4">
<div class="bg-blue-100 p-3 rounded-lg mr-4">
<i data-feather="droplet" class="text-blue-600"></i>
</div>
<div>
<h3 class="text-xl font-semibold text-gray-800">Irrigation</h3>
<p class="text-blue-600 text-sm">Optimal Schedule</p>
</div>
</div>
<p class="text-gray-700 mb-4">Water levels are optimal. Next irrigation recommended in 48 hours.</p>
<div class="text-sm text-gray-600">
<i data-feather="check-circle" class="inline mr-1 text-green-500 w-4 h-4"></i>
Soil moisture: 78%
</div>
</div>
<div class="bg-gradient-to-br from-amber-50 to-white rounded-2xl shadow-lg p-6 border border-amber-100">
<div class="flex items-center mb-4">
<div class="bg-amber-100 p-3 rounded-lg mr-4">
<i data-feather="package" class="text-amber-600"></i>
</div>
<div>
<h3 class="text-xl font-semibold text-gray-800">Fertilization</h3>
<p class="text-amber-600 text-sm">Scheduled Next Week</p>
</div>
</div>
<p class="text-gray-700 mb-4">Nitrogen levels showing slight decline. Apply NPK 16-16-8 at 25kg/hectare.</p>
<div class="text-sm text-gray-600">
<i data-feather="alert-circle" class="inline mr-1 text-amber-500 w-4 h-4"></i>
Nitrogen index: 0.42
</div>
</div>
<div class="bg-gradient-to-br from-green-50 to-white rounded-2xl shadow-lg p-6 border border-green-100">
<div class="flex items-center mb-4">
<div class="bg-green-100 p-3 rounded-lg mr-4">
<i data-feather="shield" class="text-green-600"></i>
</div>
<div>
<h3 class="text-xl font-semibold text-gray-800">Pest Control</h3>
<p class="text-green-600 text-sm">Low Risk</p>
</div>
</div>
<p class="text-gray-700 mb-4">No signs of pest infestation detected. Continue regular monitoring.</p>
<div class="text-sm text-gray-600">
<i data-feather="check-circle" class="inline mr-1 text-green-500 w-4 h-4"></i>
Last inspection: 5 days ago
</div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<custom-footer></custom-footer>
<!-- Scripts -->
<script src="script.js"></script>
<script>
feather.replace();
// Initialize tooltips
document.addEventListener('DOMContentLoaded', function() {
const tooltipTriggers = document.querySelectorAll('[data-tooltip]');
tooltipTriggers.forEach(trigger => {
trigger.addEventListener('mouseenter', function(e) {
const tooltip = document.createElement('div');
tooltip.className = 'absolute z-50 px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm tooltip';
tooltip.textContent = this.getAttribute('data-tooltip');
document.body.appendChild(tooltip);
const rect = this.getBoundingClientRect();
tooltip.style.left = `${rect.left + rect.width/2 - tooltip.offsetWidth/2}px`;
tooltip.style.top = `${rect.top - tooltip.offsetHeight - 10}px`;
this._tooltip = tooltip;
});
trigger.addEventListener('mouseleave', function() {
if (this._tooltip) {
this._tooltip.remove();
this._tooltip = null;
}
});
});
});
</script>
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
</body>
</html>