diff --git a/src/components/map/Processing.tsx b/src/components/map/Processing.tsx index 7f82616..844b4e5 100644 --- a/src/components/map/Processing.tsx +++ b/src/components/map/Processing.tsx @@ -1,9 +1,7 @@ -import { useAreaStore } from "@/state/areaStore"; import { css, keyframes } from "@emotion/react"; import { Loader2 } from "lucide-react"; -import React, { useState } from "react"; -interface Building { +export interface Building { id: number; tags: { [key: string]: string | undefined }; geometry?: { lat: number; lng: number }[]; @@ -14,85 +12,37 @@ from { transform: rotate(0deg); } to { transform: rotate(360deg); } `; -export function BuildingHeights({ area }: { area: any }) { - const [buildings, setBuildings] = useState([]); - const [loading, setLoading] = useState(false); - - const appendAreas = useAreaStore((state) => state.appendAreas); - - const requestBuildings = () => { - setLoading(true); - - const south = area[1].lat; - const west = area[1].lng; - const north = area[0].lat; - const east = area[0].lng; - console.log(south, west, north, east); - const query = `[out:json][timeout:25];(way["building"]( ${south},${west},${north},${east} );relation["building"]( ${south},${west},${north},${east} ););out body geom;`; - fetch("https://overpass-api.de/api/interpreter", { - method: "POST", - body: query, - headers: { "Content-Type": "application/x-www-form-urlencoded" }, - }) - .then((response) => response.json()) - .then((data) => { - const blds: any = data.elements.map((element) => ({ - id: element.id, - tags: element.tags, - geometry: element.geometry - ? element.geometry.map((pt) => ({ lat: pt.lat, lng: pt.lon })) - : undefined, - })); - setBuildings(blds); - appendAreas(blds); - - console.log("Building Data:", blds); - }) - .catch((error) => { - console.error("Error fetching building data:", error); - }) - .finally(() => { - setLoading(false); - }); - }; - +export function BuildingHeights({ + buildings, + loading, +}: { + buildings: Building[]; + loading: boolean; +}) { return (
- + Fetching building information... +
+ )}