Skip to content

Instantly share code, notes, and snippets.

@gavinr
Created September 14, 2013 20:12
Show Gist options
  • Save gavinr/6565237 to your computer and use it in GitHub Desktop.
Save gavinr/6565237 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Test</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>
#map { height: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script>
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('http://{s}.tile.cloudmade.com/3c674276894b4bd1bcb0e98ecbdf875b/997/256/{z}/{x}/{y}.png', {
attribution: '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>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
maxZoom: 18
}).addTo(map);
var drawnItems = new L.FeatureGroup();
map.addLayer(drawnItems);
map.on('layeradd', function (e) {
drawnItems.addLayer(e.layer);
alert(JSON.stringify(e.layer.toGeoJSON()));
});
var circle = L.circle([51.508, -0.11], 500, {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5
}).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment