Skip to content

Instantly share code, notes, and snippets.

@pvernier
Last active March 21, 2017 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvernier/7881630 to your computer and use it in GitHub Desktop.
Save pvernier/7881630 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Wifis Barranco</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/site_media/js/Leaflet/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="../leaflet.ie.css" /><![endif]-->
</head>
<body>
<div id="map" style="width: 600px; height: 400px"></div>
<script src="/site_media/js/Leaflet/leaflet.js"></script>
<script src="/site_media/js/demo/wifis_barranco.geojson" type="text/javascript"></script>
<script>
var map = L.map('map').setView([-12.1473, -77.021], 16);
L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, &copy;<a href="https://cartodb.com/attributions">CartoDB</a>'
}).addTo(map);
function onEachFeature(feature, layer) {
var popupContent = "<p>Número de wifis detectados:</p>";
if (feature.properties && feature.properties.num_wifis) {
popupContent += feature.properties.num_wifis;
}
layer.bindPopup(popupContent);
}
L.geoJson(wifis, {
onEachFeature: onEachFeature
}).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment