UNPKG

1.72 kBHTMLView Raw
1<!DOCTYPE html>
2<html>
3
4<head>
5 <meta charset='utf-8' />
6
7 <title>Shapefile in Leaflet!</title>
8 <style>
9 html {
10 height: 100%
11 }
12
13 body {
14 height: 100%;
15 margin: 0;
16 padding: 0;
17 }
18
19 #map {
20 height: 100%
21 }
22 </style>
23 <link rel="stylesheet" href="site/leaflet.css" />
24 <!--[if lte IE 8]>
25 <link rel="stylesheet" href="site/leaflet.ie.css" />
26<![endif]-->
27 <link rel="stylesheet" href="site/gh-fork-ribbon.css" />
28 <script src="site/leaflet.js"></script>
29 <script>
30 (function (i, s, o, g, r, a, m) {
31 i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
32 (i[r].q = i[r].q || []).push(arguments)
33 }, i[r].l = 1 * new Date(); a = s.createElement(o),
34 m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
35 })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
36
37 ga('create', 'UA-40454900-1', 'calvinmetcalf.github.io');
38 ga('send', 'pageview');
39 </script>
40</head>
41
42<body>
43 <div class="github-fork-ribbon-wrapper right">
44 <div class="github-fork-ribbon">
45 <a href="https://github.com/calvinmetcalf/shapefile-js">Fork me on GitHub</a>
46 </div>
47 </div>
48 <div id="map"></div>
49 <script src="dist/shp.js"> </script>
50 <script>
51 var m = L.map('map').setView([34.74161249883172, 18.6328125], 2);
52 var geo = L.geoJson({ features: [] }, {
53 onEachFeature: function popUp(f, l) {
54 var out = [];
55 if (f.properties) {
56 for (var key in f.properties) {
57 out.push(key + ": " + f.properties[key]);
58 }
59 l.bindPopup(out.join("<br />"));
60 }
61 }
62 }).addTo(m);
63 var base = 'files/TM_WORLD_BORDERS_SIMPL-0.3.zip';
64 shp(base).then(function (data) {
65 geo.addData(data);
66 });
67
68 </script>
69</body>
70
71</html>
\No newline at end of file