feat: implement heat map visualization with Leaflet.heat plugin

- Integrate Leaflet.heat plugin for heat map overlay
- Add heat map toggle control in MapFilters component
- Configure heat map intensity based on report quantity levels (minimal: 0.3, moderate: 0.5, significant: 0.7, severe: 1.0)
- Implement heat map layer management with proper cleanup
- Add custom gradient colors (blue to red) for visual intensity representation
- Configure heat map with radius: 25px, blur: 15, maxZoom: 17
- Add TypeScript type declarations for leaflet.heat
- Heat map respects existing filter state (date range, litter type, quantity)

Implements task 5: Create heat map visualization
Requirements: 3.1, 3.5
This commit is contained in:
2025-11-16 16:05:31 +00:00
parent ba324b370e
commit 8f297e1ec4
5 changed files with 114 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ export function MapPage() {
const [selectedReportId, setSelectedReportId] = useState<string | null>(null);
const [filters, setFilters] = useState<FilterState>({});
const [showClusters, setShowClusters] = useState(true);
const [showHeatmap, setShowHeatmap] = useState(false);
// Sample data for demonstration (will be replaced with API data in later tasks)
const sampleReports: Report[] = [
@@ -119,6 +120,10 @@ export function MapPage() {
setShowClusters(!showClusters);
};
const handleToggleHeatmap = () => {
setShowHeatmap(!showHeatmap);
};
return (
<div className="h-screen flex flex-col">
<div className="bg-white border-b border-gray-200 px-4 py-4 sm:px-6 lg:px-8">
@@ -134,6 +139,7 @@ export function MapPage() {
reports={sampleReports}
filters={filters}
showClusters={showClusters}
showHeatmap={showHeatmap}
onMarkerClick={handleMarkerClick}
onMapClick={handleMapClick}
/>
@@ -143,6 +149,8 @@ export function MapPage() {
onFiltersChange={setFilters}
onToggleClusters={handleToggleClusters}
showClusters={showClusters}
onToggleHeatmap={handleToggleHeatmap}
showHeatmap={showHeatmap}
/>
</div>
</div>