Skip to content

Instantly share code, notes, and snippets.

@brightrain
Created August 7, 2013 19:54
Show Gist options
  • Save brightrain/6177940 to your computer and use it in GitHub Desktop.
Save brightrain/6177940 to your computer and use it in GitHub Desktop.
via:geojson.io
<!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":"Asia"},"geometry":{"type":"Polygon","coordinates":[[[-0.703125,68.65655498475735],[101.25,82.98340359715496],[191.95312499999997,68.39918004344189],[152.2265625,-51.618016548773696],[109.3359375,-46.31658418182218],[105.29296874999999,-21.943045533438166],[54.140625,13.923403897723347],[44.384765625,11.824341483849048],[42.3193359375,13.838079936422476],[32.4755859375,29.80251790576445],[12.12890625,37.579412513438385],[1.40625,37.71859032558816],[-4.5703125,35.7286770448517],[-5.3118896484375,35.98856306735638],[-5.8371734619140625,35.94243575255426],[-39.19921875,48.80686346108517],[-0.703125,68.65655498475735]]]}},{"type":"Feature","properties":{"Name":"Africa"},"geometry":{"type":"Polygon","coordinates":[[[-7.998046875,35.764343479667176],[-20.8740234375,33.02708758002874],[-30.585937499999996,12.983147716796566],[-6.064453125,-17.392579271057766],[2.548828125,-42.09822241118973],[85.60546875,-56.413901376006756],[69.66430664062499,2.075961651504306],[54.03076171874999,13.77406640805484],[44.329833984375,11.706030770773827],[42.2479248046875,13.80074084711067],[32.420654296875,29.788216909678965],[12.1014404296875,37.522797055259616],[1.4392089843749998,37.640334898059486],[-4.581298828125,35.64836915737426],[-5.318756103515625,35.9635576265708],[-5.826873779296875,35.91685961322499],[-7.998046875,35.764343479667176]]]}},{"type":"Feature","properties":{"Name":"Latin America and the Caribbean"},"geometry":{"type":"Polygon","coordinates":[[[-97.119140625,25.958044673317843],[-99.11865234374999,26.42138972529502],[-101.458740234375,29.783449456820605],[-102.7001953125,29.6880527498568],[-103.16162109375,29.008140362978157],[-104.578857421875,29.7453016622136],[-105.49072265625,30.996445897426373],[-106.41357421875,31.756196257571325],[-108.21533203125,31.793555207271424],[-108.19335937499999,31.3348710339506],[-110.972900390625,31.31610138349565],[-114.840087890625,32.509761735919426],[-114.730224609375,32.731840896865684],[-117.1142578125,32.54681317351514],[-87.36328125,-60.50052541051129],[-4.921875,-59.7120971733229],[-17.75390625,-14.94478487508836],[-37.79296875,10.833305983642491],[-76.4208984375,27.780771643348196],[-79.453125,27.293689224852407],[-79.43115234375,23.644524198573688],[-93.6474609375,24.966140159912975],[-97.119140625,25.958044673317843]]]}},{"type":"Feature","properties":{"Name":"United States"},"geometry":{"type":"Polygon","coordinates":[[[-194.58984375,50.51342652633956],[-168.92578125,64.84893726357947],[-170.859375,72.39570570653261],[-140.625,72.1279362810559],[-140.80078125,49.03786794532644],[-124.727783203125,48.494767515307295],[-123.56323242187499,48.20271028869972],[-123.134765625,48.40003249610685],[-123.24462890625,48.67645370777654],[-123.01391601562499,48.7996273507997],[-123.31054687499999,49.009050809382046],[-95.16357421875,48.99463598353408],[-95.185546875,49.38237278700955],[-94.7900390625,49.33944093715546],[-94.6142578125,48.748945343432936],[-93.80126953124999,48.56024979174331],[-93.09814453125,48.63290858589532],[-92.4169921875,48.25394114463431],[-91.99951171875,48.32703913063476],[-91.3623046875,48.04870994288686],[-90.90087890624999,48.25394114463431],[-90.1318359375,48.122101028190805],[-89.56054687499999,48.019324184801185],[-84.78149414062499,46.86770273172814],[-84.74853515625,45.81348649679971],[-82.386474609375,45.19752230305685],[-82.3974609375,43.0287452513488],[-82.59521484375,42.53689200787317],[-83.111572265625,42.261049162113856],[-83.16650390625,41.9921602333763],[-83.46313476562499,41.69752591075902],[-82.44140625,41.40153558289846],[-81.661376953125,41.549700145132725],[-78.826904296875,42.80346172417078],[-79.068603515625,43.26920624914964],[-78.607177734375,43.35713822211053],[-77.398681640625,43.26920624914964],[-76.849365234375,43.32517767999296],[-76.256103515625,43.874138181474734],[-76.35498046875,44.166444664458595],[-74.87182617187499,44.98811302615805],[-71.488037109375,45.01141864227728],[-71.2353515625,45.32897866218559],[-70.86181640625,45.321254361171476],[-70.6201171875,45.62172169252446],[-70.07080078125,46.45299704748289],[-69.993896484375,46.70973594407157],[-69.19189453125,47.47266286861342],[-68.84033203125,47.212105775622426],[-68.31298828125,47.331377157798244],[-67.796630859375,47.07012182383309],[-67.763671875,45.706179285330855],[-67.39013671875,45.57560020947799],[-67.43408203124999,45.336701909968106],[-67.401123046875,45.1433047394883],[-67.19238281249999,45.1278045274732],[-66.90673828125,44.83249999349062],[-66.412353515625,44.75453548416007],[-76.53076171875,28.07198030177986],[-79.65087890624999,27.488781168937997],[-79.6728515625,23.94609601499837],[-93.58154296875,25.20494115356912],[-97.1630859375,26.13571361317392],[-99.07470703125,26.49024045886963],[-101.326904296875,29.821582720575016],[-102.733154296875,29.79298413547051],[-103.216552734375,29.132970130878636],[-104.501953125,29.821582720575016],[-105.457763671875,31.062345409804408],[-106.248779296875,31.793555207271424],[-108.2373046875,31.89621446335144],[-108.314208984375,31.409912194070973],[-110.950927734375,31.409912194070973],[-114.7412109375,32.54681317351514],[-114.576416015625,32.75032260780972],[-114.730224609375,32.8149783969858],[-117.147216796875,32.63012300670739],[-135.6591796875,31.87755764334002],[-140.80078125,48.63290858589532],[-194.58984375,50.51342652633956]]]}}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment