Skip to content

Instantly share code, notes, and snippets.

Created August 6, 2013 18:42
Show Gist options
  • Save anonymous/6167343 to your computer and use it in GitHub Desktop.
Save anonymous/6167343 to your computer and use it in GitHub Desktop.
Gist from edit-GeoJSON
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker-properties {
border-collapse:collapse;
font-size:11px;
border:1px solid #eee;
margin:0;
}
.marker-properties th {
white-space:nowrap;
border:1px solid #eee;
padding:5px 10px;
}
.marker-properties td {
border:1px solid #eee;
padding:5px 10px;
}
.marker-properties tr:last-child td,
.marker-properties tr:last-child th {
border-bottom:none;
}
.marker-properties tr:nth-child(even) th,
.marker-properties tr:nth-child(even) td {
background-color:#f7f7f7;
}
</style>
<script src='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.js'></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>
<link href='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.css' rel='stylesheet' />
<!--[if lte IE 8]>
<link href='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.ie.css' rel='stylesheet' >
<![endif]-->
</head>
<body>
<div id='map'></div>
<script type='text/javascript'>
var map = L.mapbox.map('map');
L.mapbox.tileLayer('tmcw.map-ajwqaq7t', {
retinaVersion: 'tmcw.map-u8vb5w83',
detectRetina: true
}).addTo(map);
map.attributionControl.addAttribution('<a href="http://geojson.io/">geojson.io</a>');
$.getJSON('map.geojson', function(geojson) {
var geojsonLayer = L.geoJson(geojson).addTo(map);
map.fitBounds(geojsonLayer.getBounds());
geojsonLayer.eachLayer(function(l) {
showProperties(l);
});
});
function showProperties(l) {
var properties = l.toGeoJSON().properties, table = '';
for (var key in properties) {
table += '<tr><th>' + key + '</th>' +
'<td>' + properties[key] + '</td></tr>';
}
if (table) l.bindPopup('<table class="marker-properties display">' + table + '</table>');
}
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"name":"ACTIVE LOG 016","time":"2013-08-01T19:31:04Z"},"geometry":{"type":"LineString","coordinates":[[-83.0650804,42.3055626],[-83.0650582,42.3056236],[-83.0650091,42.3056449],[-83.0650002,42.3056506],[-83.0649849,42.3056625],[-83.0650651,42.3056438]]}},{"type":"Feature","properties":{"name":"002","desc":"29-JUL-13 12:04:58PM","ele":"191.4267578","sym":"Flag, Red"},"geometry":{"type":"Point","coordinates":[-83.068185,42.3074619]}},{"type":"Feature","properties":{"name":"003","desc":"29-JUL-13 12:06:52PM","ele":"173.4022217","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0679618,42.3068606]}},{"type":"Feature","properties":{"name":"004","desc":"29-JUL-13 12:08:51PM","ele":"189.2639160","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0678824,42.3057836]}},{"type":"Feature","properties":{"name":"005","desc":"29-JUL-13 12:10:51PM","ele":"182.0000000","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0678632,42.3048311]}},{"type":"Feature","properties":{"name":"006","desc":"29-JUL-13 12:11:56PM","ele":"184.4572754","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0677123,42.3050654]}},{"type":"Feature","properties":{"name":"007","desc":"29-JUL-13 12:13:58PM","ele":"179.8909912","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0679782,42.3040685]}},{"type":"Feature","properties":{"name":"008","desc":"29-JUL-13 12:19:46PM","ele":"195.2719727","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0649157,42.3051678]}},{"type":"Feature","properties":{"name":"009","desc":"29-JUL-13 12:20:31PM","ele":"195.7526855","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0650214,42.3049399]}},{"type":"Feature","properties":{"name":"010","desc":"29-JUL-13 12:22:06PM","ele":"191.1865234","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0650649,42.305643]}},{"type":"Feature","properties":{"name":"011","desc":"30-JUL-13 11:31:24AM","ele":"189.2639160","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.068157,42.308326]}},{"type":"Feature","properties":{"name":"012","desc":"30-JUL-13 11:35:13AM","ele":"195.9930420","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0665439,42.3079367]}},{"type":"Feature","properties":{"name":"013","desc":"30-JUL-13 11:36:33AM","ele":"187.8217773","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0664252,42.307348]}},{"type":"Feature","properties":{"name":"014","desc":"30-JUL-13 11:38:08AM","ele":"192.3881836","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0654763,42.3067935]}},{"type":"Feature","properties":{"name":"015","desc":"30-JUL-13 11:39:05AM","ele":"197.6752930","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0658543,42.3065651]}},{"type":"Feature","properties":{"name":"016","desc":"30-JUL-13 11:41:43AM","ele":"199.1171875","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0661853,42.3054092]}},{"type":"Feature","properties":{"name":"017","desc":"30-JUL-13 11:44:52AM","ele":"185.1782227","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0672347,42.3070301]}},{"type":"Feature","properties":{"name":"018","desc":"30-JUL-13 11:45:31AM","ele":"179.4104004","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0667958,42.307086]}},{"type":"Feature","properties":{"name":"019","desc":"01-AUG-13 2:31:17PM","ele":"182.5346680","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.065062,42.305622]}},{"type":"Feature","properties":{"name":"020","desc":"01-AUG-13 2:31:51PM","ele":"182.2943115","sym":"Flag, Blue"},"geometry":{"type":"Point","coordinates":[-83.0649728,42.3056625]}}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment