Skip to content

Instantly share code, notes, and snippets.

@schwanksta
Last active December 27, 2015 10:39
Show Gist options
  • Save schwanksta/7312935 to your computer and use it in GitHub Desktop.
Save schwanksta/7312935 to your computer and use it in GitHub Desktop.
high homicide tracts
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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 type="text/javascript">
geojson = {"type":"FeatureCollection","features":[{"type":"Feature","id":651,"properties":{"GEOID10":"06037600304","CT10":"600304","LABEL":"6003.04","X_Center":6472482.0,"Y_Center":1798989.0,"Shape_area":4798305.86046,"Shape_len":9662.240288860000874,"PNTCNT":15.0,"SumLev":"140","AreaName":"CensusTract6003.04","State":"06","AreaLand":"445759","AreaWatr":"0","TotPop":"3424","Wht":"50","Blk":"1330","Asn":"7","Hisp":"1986","Oth":"51","NAMELSAD10":"CensusTract6003.04","per_capita":0.0043808411,"PopInt":3424},"geometry":{"type":"Polygon","coordinates":[[[-118.291637000512452,33.939880999892225],[-118.291639000350102,33.939056000142166],[-118.29164100025902,33.938203999794219],[-118.291609999987102,33.938017000348438],[-118.29160999984056,33.937309999761375],[-118.291612000323155,33.93644100039603],[-118.291612999879675,33.935795000016647],[-118.291616000168332,33.934574999864118],[-118.291618000297163,33.933352000179632],[-118.291621999766917,33.931370999950225],[-118.291524999991466,33.930962000385378],[-118.291664000055832,33.930963000324027],[-118.291952999897433,33.930922000155405],[-118.292917999634398,33.930914999956968],[-118.293182999941365,33.930913999850979],[-118.293874000032403,33.930913000296094],[-118.294278000083139,33.930911999732999],[-118.294530000346114,33.930911000443878],[-118.295209999863758,33.930908999576268],[-118.29541600033447,33.930908000151923],[-118.295855999775597,33.930909000344634],[-118.296063999995653,33.930908000316101],[-118.296272999839147,33.930907999967367],[-118.296650999805152,33.930907000338458],[-118.296651999891509,33.930968000395069],[-118.296651999853879,33.931029999997783],[-118.296653999957684,33.931655999779146],[-118.296657000231747,33.932281000047631],[-118.296654000174698,33.932826000342544],[-118.296651999680279,33.933116000312779],[-118.296652999873601,33.934035999601157],[-118.296670999523414,33.934595000373719],[-118.296228999992209,33.934603999612449],[-118.296213999557253,33.935229000080781],[-118.29620999961881,33.935511000375627],[-118.296214000428336,33.936254999599051],[-118.296216000246247,33.936410999862076],[-118.296222999836516,33.937309000085669],[-118.296211999990177,33.937704000267495],[-118.296208999910021,33.93883999966561],[-118.296204000220882,33.939195999632162],[-118.296208999884087,33.940037999563472],[-118.29553499964581,33.940032000069266],[-118.293529999890694,33.940013999814774],[-118.292547999652527,33.940024000197781],[-118.292275999772642,33.940027000058357],[-118.291833999948366,33.9400070000125],[-118.291637000512452,33.939880999892225]]]}},{"type":"Feature","id":897,"properties":{"GEOID10":"06037542402","CT10":"542402","LABEL":"5424.02","X_Center":6497193.0,"Y_Center":1779496.0,"Shape_area":16874307.3372,"Shape_len":18942.138475200001267,"PNTCNT":12.0,"SumLev":"140","AreaName":"CensusTract5424.02","State":"06","AreaLand":"1567564","AreaWatr":"0","TotPop":"3152","Wht":"48","Blk":"1249","Asn":"63","Hisp":"1746","Oth":"46","NAMELSAD10":"CensusTract5424.02","per_capita":0.0038071066,"PopInt":3152},"geometry":{"type":"Polygon","coordinates":[[[-118.207051999860639,33.88869000013613],[-118.206785999777878,33.887833000131572],[-118.206459000014647,33.886778999784646],[-118.206317999473541,33.88628800035341],[-118.205945999744941,33.884987000364717],[-118.205578999598146,33.883759000318278],[-118.205369000134993,33.883057000155389],[-118.205122000092913,33.882216999715901],[-118.204868999614732,33.881357999646426],[-118.204850000369007,33.881322000081617],[-118.205205999990966,33.881319999790499],[-118.207172000423355,33.881311999692905],[-118.207199000006099,33.881312000155482],[-118.208079000267944,33.881305999842866],[-118.208672999978816,33.88129699977754],[-118.208740999685077,33.881293000081747],[-118.208873999749827,33.88129199974852],[-118.208869999581907,33.880827000205201],[-118.208738999562627,33.880826999992422],[-118.208666000258731,33.880824999728354],[-118.208518000189315,33.880821999609168],[-118.208519000066346,33.880778999990184],[-118.208513000157595,33.879775999807123],[-118.208499999895437,33.878324999988102],[-118.208493999836335,33.876815000183818],[-118.208494999833675,33.875977999997211],[-118.208488000430791,33.875179999834316],[-118.208557999510319,33.874888999669487],[-118.20856600003188,33.874856999992367],[-118.208564999528633,33.874794999878098],[-118.208436999854456,33.874796000253752],[-118.208237000038721,33.874796999620813],[-118.208187000056853,33.874798000149219],[-118.208134999496835,33.874798999604657],[-118.208133999582373,33.874784999868091],[-118.208134000450286,33.874626000181813],[-118.208133999850276,33.874422000369933],[-118.208017000263467,33.874427000264511],[-118.208015999572979,33.874265000261175],[-118.208134999695943,33.874263999648186],[-118.208240000534701,33.874264000354437],[-118.208346999771464,33.874264000218623],[-118.208598999941458,33.874262999914478],[-118.209823000289333,33.87426100023734],[-118.213028999810049,33.874243000242558],[-118.213765000289015,33.874244000281429],[-118.214153999944386,33.874249999769809],[-118.214544000084572,33.874255000044762],[-118.214418999762714,33.873595999767424],[-118.214800999898728,33.873587000255831],[-118.214931999705584,33.873584999703333],[-118.215696999579606,33.873570000085493],[-118.216111000125323,33.8735649995714],[-118.21607300052969,33.873362000056865],[-118.21623999971068,33.873361999804757],[-118.216543000390033,33.873363000003565],[-118.216568999849358,33.873363000159557],[-118.216598000052443,33.873563999903332],[-118.216621000423743,33.87372800044183],[-118.216680999911276,33.874147999623489],[-118.216689999722689,33.874240000410182],[-118.216703000299518,33.874303000304373],[-118.2167530000944,33.874652000428753],[-118.216788999535893,33.874916999805698],[-118.216812000008886,33.875025999657474],[-118.216829000211732,33.875314000271686],[-118.216831000133183,33.875482999635501],[-118.216833999629173,33.875705000118607],[-118.216855999720323,33.876079000125848],[-118.217088000199652,33.87748299980754],[-118.217422000524238,33.879568000305049],[-118.217604999772192,33.880840000209254],[-118.217674000354677,33.881263000343914],[-118.217948000462471,33.882958000044134],[-118.218148999869044,33.88426500002582],[-118.218408000409639,33.885878999697958],[-118.218707000463397,33.887809999601295],[-118.21880800003953,33.888462999864778],[-118.218827999795849,33.888586999897484],[-118.218679000473912,33.888587999656863],[-118.217795000145799,33.888596000192443],[-118.216008999627817,33.888606999826102],[-118.21432499989082,33.88860000018645],[-118.213478000171548,33.888594000037735],[-118.213177000530735,33.888593000213824],[-118.212597000196794,33.88860200040633],[-118.212137999479083,33.888609999675261],[-118.211044999967797,33.888615999672467],[-118.209937000354728,33.888633999771145],[-118.209830999581555,33.888636000017989],[-118.208866000528218,33.888678999972647],[-118.207577999935083,33.888688999816303],[-118.207218999899084,33.888692000284699],[-118.207051999860639,33.88869000013613]]]}},{"type":"Feature","id":1055,"properties":{"GEOID10":"06037600202","CT10":"600202","LABEL":"6002.02","X_Center":6470934.0,"Y_Center":1801629.0,"Shape_area":8925264.92463,"Shape_len":14579.082558599999174,"PNTCNT":30.0,"SumLev":"140","AreaName":"CensusTract6002.02","State":"06","AreaLand":"829152","AreaWatr":"0","TotPop":"6205","Wht":"64","Blk":"2825","Asn":"27","Hisp":"3196","Oth":"93","NAMELSAD10":"CensusTract6002.02","per_capita":0.0048348106,"PopInt":6205},"geometry":{"type":"Polygon","coordinates":[[[-118.291624999572619,33.945490999584578],[-118.291626999782238,33.944584000368302],[-118.291627999532523,33.943750999885914],[-118.291630000166279,33.943033999825886],[-118.291631999684142,33.942316999810167],[-118.29163300036484,33.941502000219593],[-118.291635000400078,33.94070499990795],[-118.291637000512452,33.939880999892225],[-118.291833999948366,33.9400070000125],[-118.292275999772642,33.940027000058357],[-118.292547999652527,33.940024000197781],[-118.293529999890694,33.940013999814774],[-118.29553499964581,33.940032000069266],[-118.296208999884087,33.940037999563472],[-118.296862999791287,33.940037999802207],[-118.300205999762269,33.940040000079854],[-118.300271000459347,33.940042999905039],[-118.302032999955614,33.940040000056776],[-118.304651999591599,33.940039999983583],[-118.304973000252772,33.940040000036994],[-118.308940999542301,33.940015999872848],[-118.309019000283485,33.940020000237567],[-118.309017000330954,33.940714999963447],[-118.309017000267261,33.94092699987479],[-118.309014999764983,33.941832999789035],[-118.30786099957615,33.941835000008034],[-118.306806999795512,33.941836000087008],[-118.305735999742524,33.941837999585964],[-118.305336999503098,33.941838999601806],[-118.30519099958677,33.94184500007556],[-118.305187000002363,33.943199999576514],[-118.305180000053937,33.94546699961456],[-118.304635999765551,33.945468999657201],[-118.30245400028106,33.945473999973551],[-118.301470999679992,33.945489000400258],[-118.300270999827049,33.945490999566843],[-118.299883999684042,33.945480999895651],[-118.299130999500946,33.945491999579737],[-118.296195000339665,33.945492999934956],[-118.2958549998378,33.945495999910165],[-118.294148999768154,33.945489999913988],[-118.292508999554656,33.945499000119888],[-118.291888000335618,33.945494000123261],[-118.29182199969614,33.945491999782583],[-118.291624999572619,33.945490999584578]]]}},{"type":"Feature","id":1065,"properties":{"GEOID10":"06037239601","CT10":"239601","LABEL":"2396.01","X_Center":6478197.0,"Y_Center":1812611.0,"Shape_area":4545298.93737,"Shape_len":9594.699927699999535,"PNTCNT":15.0,"SumLev":"140","AreaName":"CensusTract2396.01","State":"06","AreaLand":"422264","AreaWatr":"0","TotPop":"3755","Wht":"13","Blk":"617","Asn":"8","Hisp":"3087","Oth":"30","NAMELSAD10":"CensusTract2396.01","per_capita":0.0039946738,"PopInt":3755},"geometry":{"type":"Polygon","coordinates":[[[-118.269533999838558,33.971314999754213],[-118.27391400016343,33.971294000081237],[-118.273910999941947,33.970822000241029],[-118.278295000435804,33.970804000336997],[-118.280323000102811,33.970795000425035],[-118.280716999658736,33.970793999558438],[-118.280711999894919,33.974664999910203],[-118.280373000318022,33.974666000033736],[-118.278298999980819,33.974675000308778],[-118.27392900045831,33.974692999665159],[-118.269546000247914,33.974713999878929],[-118.269542999718837,33.97384699974193],[-118.269539999864236,33.972996999736992],[-118.269536999877985,33.972154000134964],[-118.269533999838558,33.971314999754213]]]}}]};
</script>
<style type="text/css">
html, body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outline:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
/* APP */
html, body {
width: 100%;
height: 100%;
overflow:hidden;
}
#map-canvas {
width: 100%;
height: 100%;
position: absolute;
}
</style>
<div id="map-canvas"></div>
<script type="text/javascript">
map = new L.map('map-canvas', {scrollWheelZoom: false, maxZoom:15, minZoom:9});
/* Zoom and extent */
var center = new L.LatLng(33.93, -118.32);
map.setView(center, 12);
/* Google Tiles */
googleLayer = L.tileLayer("http://{s}.google.com/vt/?hl=en&x={x}&y={y}&z={z}&s={s}", {
attribution: "Map data: Copyright Google, 2013",
subdomains: ['mt0','mt1','mt2','mt3']
});
map.addLayer(googleLayer);
/* Process and add it to a map. */
/* geojson is a variable defined in map-points-1.js */
/* Now we've added onEachFeature to bind a popup, and
* a style function to color by the average score.
*/
L.geoJson(geojson, {
style: function (feature) {
return {
color: "#b00",
weight: 1,
fillColor: "#b00",
opacity: 0.5,
fillOpacity: 0.3
}
},
onEachFeature: function(feature, layer) {
if (feature.properties) {
var data = feature.properties;
layer.bindPopup(data.PNTCNT + " homicides. " + data.PopInt + " people. " + Math.round(data.per_capita * 10000) + " homicides per 10,000 people.");
}
}
}).addTo(map);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment