-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsda-prototype.html
More file actions
121 lines (104 loc) · 3.58 KB
/
sda-prototype.html
File metadata and controls
121 lines (104 loc) · 3.58 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Geolocation Example</title>
<style>
#map {
height: 400px;
width: 100%;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 10px;
text-align: left;
border: 1px solid #ddd;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/three@0.147/build/three.min.js"></script>
</head>
<body>
<h1>Your Geographical Location</h1>
<p><a href="geomap.html">geomap sample</a></p>
<div id="map"></div>
<script>
// Get the user's location using the Geolocation API
navigator.geolocation.getCurrentPosition(
(position) => {
const latitude = position.coords.latitude;
const longitude = position.coords.longitude;
const centerCoordinates = `${latitude}, ${longitude}`;
// Create a map centered at the user's location
const map = new google.maps.Map(document.getElementById('map'), {
center: { lat: latitude, lng: longitude },
zoom: 15
});
// Add a marker to the map
new google.maps.Marker({
position: { lat: latitude, lng: longitude },
map: map,
title: 'Your Location'
});
},
(error) => {
console.error('Error getting location:', error.message);
}
);
</script>
<!-- Include the Google Maps JavaScript API -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDuG8DG7xPrUlgSJlkV2me2QaV4LswBFz8"></script>
<h1>Sample Spatial Data Architecture</h1>
<script>
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// Sample population density data (replace with your data)
const densityData = [[100, 250, 300], [500, 700, 1200], [400, 800, 900]];
const gridSize = densityData.length;
const cellSize = 1; // Adjust cell size as needed
// Function to create a colored cube based on density
function createDensityCube(density) {
const geometry = new THREE.BoxGeometry(cellSize, cellSize, cellSize);
const material = new THREE.MeshBasicMaterial({ color: getDensityColor(density) });
const cube = new THREE.Mesh(geometry, material);
return cube;
}
// Function to define color based on density (adjust color mapping as needed)
function getDensityColor(density) {
const colorMap = {
low: '#add8e6', // Light blue for low density
medium: '#fffa99', // Yellow for medium density
high: '#ff595e' // Red for high density
};
if (density < 500) {
return colorMap.low;
} else if (density < 1000) {
return colorMap.medium;
} else {
return colorMap.high;
}
}
// Create and position cubes based on density data
for (let i = 0; i < gridSize; i++) {
for (let j = 0; j < gridSize; j++) {
const density = densityData[i][j];
const cube = createDensityCube(density);
cube.position.set(i * cellSize, j * cellSize, density / 1000); // Scale z-axis based on density
scene.add(cube);
}
}
camera.position.z = 5;
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>