Skip to content

Commit ac9e7dd

Browse files
committed
robust
1 parent 3f2abc0 commit ac9e7dd

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

data.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
[]

index.html

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<script type="module" src="https://unpkg.com/little-planet@0.6.2"></script>
99
<script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"></script>
1010
<script src="https://unpkg.com/leaflet.markercluster@1.4.1"></script>
11-
<script src="https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js?v1.3.0"></script>
1211

1312
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css" />
1413
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css" />

index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ async function init() {
112112

113113
map.addLayer(topo);
114114
map.addLayer(group);
115-
map.fitBounds(group.getBounds());
115+
116+
let bounds = group.getBounds();
117+
if (bounds.isValid()) {
118+
map.fitBounds(bounds);
119+
} else {
120+
map.setView([0, 0], 2);
121+
}
116122

117123
fromURL(data);
118124
}

0 commit comments

Comments
 (0)