Skip to content

Instantly share code, notes, and snippets.

@mollietaylor
Created January 3, 2014 01:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mollietaylor/8230639 to your computer and use it in GitHub Desktop.
Save mollietaylor/8230639 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title>Audio Demo</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]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script type="text/javascript" src="leaflet.ajax.js"></script>
<style type="text/css">
html {
height: 100%;
}
body {
height: 100%;
}
#map {
height: 95%;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var map = L.map('map').setView([34, -100], 4);
var audioIcon = L.icon({
iconUrl: 'audio.png',
iconSize: [32, 37],
shadowSize: [0, 0],
iconAnchor: [16, 37],
shadowAnchor: [0, 0],
popupAnchor: [0, -37]
});
function onEachAudio(feature, layer) {
layer.bindPopup(feature.properties.name + "<br>" + feature.properties.html);
};
new L.GeoJSON.AJAX("audio.geojson", {
onEachFeature: onEachAudio,
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {icon: audioIcon});
}
}).addTo(map);
L.tileLayer('http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png',
{
attribution: '<a href="http://maps.stamen.com/">Stamen base map</a>',
maxZoom: 18
}).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment