Skip to content

Commit 4425134

Browse files
authored
Merge pull request #11 from DigitalMitford/HJBhtmlBranch
geoMapping
2 parents d8b9e57 + f592c88 commit 4425134

File tree

4 files changed

+1871
-0
lines changed

4 files changed

+1871
-0
lines changed

docs/subDocs/map.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE html>
3+
<html xmlns="http://www.w3.org/1999/xhtml">
4+
<head>
5+
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
7+
<title>Mitford Map</title>
8+
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
9+
<style>
10+
#map {
11+
height: 500px;
12+
}
13+
</style>
14+
</head>
15+
<body>
16+
17+
<div id="map"></div>
18+
19+
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
20+
21+
<script>
22+
var map = L.map('map').setView([51.509865, -0.118092], 5); // Centered at London, England
23+
24+
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
25+
attribution: '&amp;copy; OpenStreetMap contributors'
26+
}).addTo(map);
27+
28+
// Use an AJAX request to load the GeoJSON file
29+
fetch('mapData.geojson')
30+
.then(response => response.json())
31+
.then(geoJsonData => {
32+
console.log('GeoJSON Data:', geoJsonData); // Log GeoJSON data for debugging
33+
34+
// Iterate through features and create circles using L.circle
35+
geoJsonData.features.forEach(feature => {
36+
var coordinates = feature.geometry.coordinates;
37+
var count = feature.properties.count;
38+
39+
// Create a circle with radius based on the "count" value
40+
var circle = L.circleMarker(coordinates, {
41+
radius: count * 2, // Adjust the multiplier based on the desired scale
42+
color: 'blue', // Circle color
43+
fillOpacity: 0.5 // Opacity of the fill
44+
}).addTo(map);
45+
46+
// Add a popup with information
47+
circle.bindPopup(`Place: ${feature.properties.placeName}<br/>Count: ${count}`);
48+
});
49+
});
50+
</script>
51+
52+
53+
</body>
54+
</html>

0 commit comments

Comments
 (0)