-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajaxgist.html
61 lines (43 loc) · 1.11 KB
/
ajaxgist.html
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
<html>
<head>
<title>AJAXGIST</title>
<meta charset="utf-8">
<script src="jquery.min.js"></script>
<link rel="stylesheet" href="leaflet.css">
<script src="leaflet.js"></script>
<script src="leaflet.restoreview.js"></script>
<script src="leaflet.hash.js"></script>
<style type="text/css">
#map {
height: 400px;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map("map");
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map);
var fc_url = "https://gist.githubusercontent.com/anonymous/902a8afcf971f7ef5913/raw/16f2e05d88e03a011f4bc91ec1fa11cb88125b09/map.geojson";
var fc;
$.ajax(fc_url,{
success: function(data) {
fc = data;
},
// dataType: "jsonp",
// jsonpcallback: "cb",
});
var jsonLayer = L.geoJson(fc, {
style: {
"color": "#ff0000",
"weight": 3,
"fillOpacity": 0.8
}
}).addTo(map);
if (!map.restoreView()) {
map.setView([53, 11], 7); // Somewhere in Europe
}
new L.Hash("map");
</script>
</body>
</html>