Skip to content

Commit 0d8b9a2

Browse files
committed
use Leaflet for community map
1 parent 3ec4fa9 commit 0d8b9a2

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

docs/community/index.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,52 @@
22
title: Community
33
---
44

5+
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css"/>
6+
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
7+
<style>
8+
#map {
9+
width: 600px;
10+
height: 200px;
11+
}
12+
.leaflet-marker-icon {
13+
background: transparent !important;
14+
box-shadow: none;
15+
}
16+
</style>
17+
518
# Community
619

7-
<script src="https://embed.github.com/view/geojson/geopython/pygeoapi.io/gh-pages/community/live-deployments.geojson"> </script>
20+
<div id="map"></div>
21+
22+
<script>
23+
const map = L.map('map', {
24+
attributionControl: false
25+
}).setView([20, 0], 1);
26+
27+
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
28+
attribution: '&copy; OpenStreetMap contributors'
29+
}).addTo(map);
30+
31+
const icon = L.icon({
32+
iconUrl: 'marker.png',
33+
iconSize: [25, 41],
34+
iconAnchor: [12, 41],
35+
shadowUrl: null
36+
});
37+
38+
fetch('https://raw.githubusercontent.com/geopython/pygeoapi.io/gh-pages/community/live-deployments.geojson')
39+
.then(r => r.json())
40+
.then(data => {
41+
const layer = L.geoJSON(data, {
42+
pointToLayer: (feature, latlng) => {
43+
return L.marker(latlng);
44+
}
45+
}).addTo(map);
46+
47+
map.fitBounds(layer.getBounds());
48+
});
49+
</script>
50+
851

952
<div class="pygeoapi-powered">
1053
<a href="https://www.ga.gov.au"><img alt="Geoscience Australia" src="/img/org-logos/aus-ga.png"/></a>

0 commit comments

Comments
 (0)