Skip to content

Commit

Permalink
fix up demo
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinmetcalf committed Aug 13, 2015
1 parent 1b6ca43 commit 21dde12
Show file tree
Hide file tree
Showing 2 changed files with 12,301 additions and 3,158 deletions.
112 changes: 65 additions & 47 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,65 @@
<!doctype html><html lang="en"> <head>
<meta charset='utf-8'/>
<title>
Preview
</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<style>
html { height: 100% }
body { height: 100%; margin: 0; padding: 0;}
#map{ height: 100% }
</style>
<link rel="stylesheet" href="gh-pages.css" />
</head>
<body><div class="github-fork-ribbon-wrapper right">
<div class="github-fork-ribbon">
<a href="https://github.com/calvinmetcalf/leaflet.shapefile">Fork me on GitHub</a>
</div>
</div>
<div id="map"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="shp.js"></script>
<script src="catiline.js"></script>
<script src="leaflet.shpfile.js"></script>
<script>
var m = L.map('map').setView([ 42.09618442380296, -71.5045166015625],8);
var watercolor = L.tileLayer('http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg',{attribution:'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'}).addTo(m);

var shpfile = new L.Shapefile('congress.zip',{onEachFeature:function(feature, layer) {
if (feature.properties) {
layer.bindPopup(Object.keys(feature.properties).map(function(k){
return k + ": " + feature.properties[k] ;
}).join("<br />"),{maxHeight:200});
}
}});
shpfile.addTo(m);
shpfile.once("load", function(){
console.log("finished loaded shapefile");
});

</script>
</body>
</html>


<!doctype html>
<html lang="en">

<head>
<meta charset='utf-8' />
<title>
Preview
</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<style>
html {
height: 100%
}

body {
height: 100%;
margin: 0;
padding: 0;
}

#map {
height: 100%
}
</style>
<link rel="stylesheet" href="gh-pages.css" />
</head>

<body>
<div class="github-fork-ribbon-wrapper right">
<div class="github-fork-ribbon">
<a href="https://github.com/calvinmetcalf/leaflet.shapefile">Fork me on GitHub</a>
</div>
</div>
<div id="map"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="catiline.js"></script>
<script src="leaflet.shpfile.js"></script>
<script>
var m = L.map('map').setView([42.09618442380296, -71.5045166015625], 8);
var watercolor = L.tileLayer('http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg', {
attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
}).addTo(m);

var shpfile = new L.Shapefile('congress.zip', {
onEachFeature: function(feature, layer) {
if (feature.properties) {
layer.bindPopup(Object.keys(feature.properties).map(function(k) {
return k + ": " + feature.properties[k];
}).join("<br />"), {
maxHeight: 200
});
}
}
});
shpfile.addTo(m);
shpfile.once("data:loaded", function() {
console.log("finished loaded shapefile");
});
</script>
</body>

</html>
Loading

1 comment on commit 21dde12

@sebsti34
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help me?
when i use this code, the button for import the shp is not here.

Please sign in to comment.