forked from Neerajpathak07/CityPulse_AI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex2.html
More file actions
46 lines (41 loc) · 1.27 KB
/
index2.html
File metadata and controls
46 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
<title>Click Map to Send Coordinates</title>
<meta charset="utf-8">
<style>
#map { height: 90vh; width: 100%; }
#result { padding: 10px; font-family: Arial; }
</style>
</head>
<body>
<div id="map"></div>
<div id="result">Click on the map to send coordinates to Python.</div>
<script>
function initMap() {
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 13,
center: { lat: 12.9716, lng: 77.5946 }, // Bengaluru
});
map.addListener("click", async function (e) {
const lat = e.latLng.lat();
const lng = e.latLng.lng();
// Send to Flask
const response = await fetch("http://localhost:5000/process-coordinates", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ lat, lng }),
});
const data = await response.json();
document.getElementById("result").innerText = data.message;
});
}
</script>
<!-- Replace YOUR_API_KEY with your actual Google Maps API key -->
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD0xpclQoMTs9FgXsyk1zvXYdiFfJb8YXM&callback=initMap">
</script>
</body>
</html>