Last active
August 29, 2015 14:13
-
-
Save JimShady/4359bda5cce46339f0ee to your computer and use it in GitHub Desktop.
PM2.5 Levels on the London Underground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> | |
<script type="text/javascript" src="http://calvinmetcalf.github.io/leaflet-ajax/dist/leaflet.ajax.js"></script> | |
<script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> | |
<style> | |
body { | |
padding: 0; | |
margin: 0; | |
} | |
html, body, #map { | |
height: 100%; | |
width: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script> | |
var map = L.map('map').setView([51.504265, -0.151105], 12); | |
L.tileLayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', { | |
maxZoom: 18, | |
attribution: 'Map data © <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://mapbox.com">Mapbox</a>', | |
id: 'therealjimshady.map-3j8736fy' | |
}).addTo(map); | |
var tube = {"type": "FeatureCollection", "features": [{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.075616,51.51427]},"properties":{"id":"707","line":"Circle","station_name":"Aldgate","pm25":28,"cartodb_id":1,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.156907,51.523057]},"properties":{"id":"708","line":"Circle","station_name":"Baker Street","pm25":24,"cartodb_id":2,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.09771,51.520143]},"properties":{"id":"709","line":"Circle","station_name":"Barbican","pm25":26,"cartodb_id":3,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.188041,51.51223]},"properties":{"id":"710","line":"Circle","station_name":"Bayswater","pm25":11,"cartodb_id":4,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.103605,51.511489]},"properties":{"id":"711","line":"Circle","station_name":"Blackfriars","pm25":29,"cartodb_id":5,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.090694,51.511432]},"properties":{"id":"712","line":"Circle","station_name":"Cannon Street","pm25":28,"cartodb_id":6,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.167671,51.519917]},"properties":{"id":"713","line":"Circle","station_name":"Edgware Road Circle","pm25":18,"cartodb_id":7,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.122356,51.50724]},"properties":{"id":"714","line":"Circle","station_name":"Embankment","pm25":36,"cartodb_id":8,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.135831,51.525557]},"properties":{"id":"715","line":"Circle","station_name":"Euston Square","pm25":32,"cartodb_id":9,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.105063,51.520442]},"properties":{"id":"716","line":"Circle","station_name":"Farringdon","pm25":27,"cartodb_id":10,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.182992,51.494239]},"properties":{"id":"717","line":"Circle","station_name":"Gloucester Road","pm25":15,"cartodb_id":11,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.226746,51.50195]},"properties":{"id":"718","line":"Circle","station_name":"Goldhawk Road","pm25":5,"cartodb_id":12,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.14395,51.523716]},"properties":{"id":"719","line":"Circle","station_name":"Great Portland Street","pm25":33,"cartodb_id":13,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.2224,51.492568]},"properties":{"id":"720","line":"Circle","station_name":"Hammersmith","pm25":7,"cartodb_id":14,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.192505,51.500672]},"properties":{"id":"721","line":"Circle","station_name":"High Street Kensington","pm25":10,"cartodb_id":15,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.123854,51.530393]},"properties":{"id":"722","line":"Circle","station_name":"King's Cross St. Pancras","pm25":31,"cartodb_id":16,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.210862,51.517185]},"properties":{"id":"723","line":"Circle","station_name":"Ladbroke Grove","pm25":6,"cartodb_id":17,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.217779,51.51354]},"properties":{"id":"724","line":"Circle","station_name":"Latimer Road","pm25":6,"cartodb_id":18,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.082966,51.517349]},"properties":{"id":"725","line":"Circle","station_name":"Liverpool Street","pm25":26,"cartodb_id":19,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.094186,51.512019]},"properties":{"id":"726","line":"Circle","station_name":"Mansion House","pm25":27,"cartodb_id":20,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.088943,51.513346]},"properties":{"id":"727","line":"Circle","station_name":"Monument","pm25":27,"cartodb_id":21,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.089006,51.518365]},"properties":{"id":"728","line":"Circle","station_name":"Moorgate","pm25":23,"cartodb_id":22,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.196539,51.509061]},"properties":{"id":"729","line":"Circle","station_name":"Notting Hill Gate","pm25":9,"cartodb_id":23,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.175394,51.515307]},"properties":{"id":"730","line":"Circle","station_name":"Paddington","pm25":13,"cartodb_id":24,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.188233,51.519013]},"properties":{"id":"731","line":"Circle","station_name":"Royal Oak","pm25":12,"cartodb_id":25,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.226303,51.505558]},"properties":{"id":"732","line":"Circle","station_name":"Shepherd's Bush Market","pm25":5,"cartodb_id":26,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.156492,51.492288]},"properties":{"id":"733","line":"Circle","station_name":"Sloane Square","pm25":27,"cartodb_id":27,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.173926,51.493999]},"properties":{"id":"734","line":"Circle","station_name":"South Kensington","pm25":19,"cartodb_id":28,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.134178,51.499345]},"properties":{"id":"735","line":"Circle","station_name":"St. James's Park","pm25":29,"cartodb_id":29,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.1137,51.510968]},"properties":{"id":"736","line":"Circle","station_name":"Temple","pm25":27,"cartodb_id":30,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.076355,51.510065]},"properties":{"id":"737","line":"Circle","station_name":"Tower Hill","pm25":29,"cartodb_id":31,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.143852,51.496342]},"properties":{"id":"738","line":"Circle","station_name":"Victoria","pm25":27,"cartodb_id":32,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.200885,51.520917]},"properties":{"id":"739","line":"Circle","station_name":"Westbourne Park","pm25":9,"cartodb_id":33,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.124813,51.501084]},"properties":{"id":"740","line":"Circle","station_name":"Westminster","pm25":36,"cartodb_id":34,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.2242,51.5098]},"properties":{"id":"741","line":"Circle","station_name":"Wood Lane","pm25":6,"cartodb_id":35,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.105789,51.532495]},"properties":{"id":"742","line":"Northern","station_name":"Angel","pm25":83,"cartodb_id":36,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.13511,51.565427]},"properties":{"id":"743","line":"Northern","station_name":"Archway","pm25":99,"cartodb_id":37,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.153212,51.443326]},"properties":{"id":"744","line":"Northern","station_name":"Balham","pm25":91,"cartodb_id":38,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.088916,51.513301]},"properties":{"id":"745","line":"Northern","station_name":"Bank","pm25":92,"cartodb_id":39,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.093701,51.501194]},"properties":{"id":"746","line":"Northern","station_name":"Borough","pm25":115,"cartodb_id":40,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.14272,51.539407]},"properties":{"id":"747","line":"Northern","station_name":"Camden Town","pm25":112,"cartodb_id":41,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.12475,51.508591]},"properties":{"id":"748","line":"Northern","station_name":"Charing Cross","pm25":120,"cartodb_id":42,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.138318,51.461732]},"properties":{"id":"749","line":"Northern","station_name":"Clapham Common","pm25":96,"cartodb_id":43,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.129524,51.464847]},"properties":{"id":"750","line":"Northern","station_name":"Clapham North","pm25":121,"cartodb_id":44,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.147987,51.452604]},"properties":{"id":"751","line":"Northern","station_name":"Clapham South","pm25":87,"cartodb_id":45,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.177701,51.418071]},"properties":{"id":"752","line":"Northern","station_name":"Colliers Wood","pm25":88,"cartodb_id":46,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.164732,51.587269]},"properties":{"id":"753","line":"Northern","station_name":"East Finchley","pm25":38,"cartodb_id":47,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.100727,51.495777]},"properties":{"id":"754","line":"Northern","station_name":"Elephant & Castle","pm25":125,"cartodb_id":48,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.122356,51.50724]},"properties":{"id":"755","line":"Northern","station_name":"Embankment","pm25":124,"cartodb_id":49,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.133285,51.528592]},"properties":{"id":"756","line":"Northern","station_name":"Euston","pm25":112,"cartodb_id":50,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.192453,51.600972]},"properties":{"id":"757","line":"Northern","station_name":"Finchley Central","pm25":26,"cartodb_id":51,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.134657,51.520422]},"properties":{"id":"758","line":"Northern","station_name":"Goodge Street","pm25":105,"cartodb_id":52,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.194758,51.6506]},"properties":{"id":"759","line":"Northern","station_name":"High Barnet","pm25":16,"cartodb_id":53,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.146634,51.577597]},"properties":{"id":"760","line":"Northern","station_name":"Highgate","pm25":63,"cartodb_id":54,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.105482,51.48812]},"properties":{"id":"761","line":"Northern","station_name":"Kennington","pm25":144,"cartodb_id":55,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.140459,51.550306]},"properties":{"id":"762","line":"Northern","station_name":"Kentish Town","pm25":109,"cartodb_id":56,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.123854,51.530393]},"properties":{"id":"763","line":"Northern","station_name":"King's Cross St. Pancras","pm25":103,"cartodb_id":57,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.128231,51.511219]},"properties":{"id":"764","line":"Northern","station_name":"Leicester Square","pm25":114,"cartodb_id":58,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.086922,51.505499]},"properties":{"id":"765","line":"Northern","station_name":"London Bridge","pm25":116,"cartodb_id":59,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.089006,51.518365]},"properties":{"id":"766","line":"Northern","station_name":"Moorgate","pm25":85,"cartodb_id":60,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.194788,51.402338]},"properties":{"id":"767","line":"Northern","station_name":"Morden","pm25":63,"cartodb_id":61,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.138837,51.534211]},"properties":{"id":"768","line":"Northern","station_name":"Mornington Crescent","pm25":107,"cartodb_id":62,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.08755,51.525598]},"properties":{"id":"769","line":"Northern","station_name":"Old Street","pm25":81,"cartodb_id":63,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.112889,51.482107]},"properties":{"id":"770","line":"Northern","station_name":"Oval","pm25":138,"cartodb_id":64,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.191978,51.41528]},"properties":{"id":"771","line":"Northern","station_name":"South Wimbledon","pm25":78,"cartodb_id":65,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.122903,51.472169]},"properties":{"id":"772","line":"Northern","station_name":"Stockwell","pm25":116,"cartodb_id":66,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.159704,51.435757]},"properties":{"id":"773","line":"Northern","station_name":"Tooting Bec","pm25":97,"cartodb_id":67,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.167979,51.427434]},"properties":{"id":"774","line":"Northern","station_name":"Tooting Broadway","pm25":113,"cartodb_id":68,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.130866,51.516207]},"properties":{"id":"775","line":"Northern","station_name":"Tottenham Court Road","pm25":99,"cartodb_id":69,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.179255,51.630209]},"properties":{"id":"776","line":"Northern","station_name":"Totteridge & Whetstone","pm25":20,"cartodb_id":70,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.13792,51.556668]},"properties":{"id":"777","line":"Northern","station_name":"Tufnell Park","pm25":103,"cartodb_id":71,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.138267,51.524508]},"properties":{"id":"778","line":"Northern","station_name":"Warren Street","pm25":102,"cartodb_id":72,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.114066,51.503501]},"properties":{"id":"779","line":"Northern","station_name":"Waterloo","pm25":118,"cartodb_id":73,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.188475,51.609489]},"properties":{"id":"780","line":"Northern","station_name":"West Finchley","pm25":22,"cartodb_id":74,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.185428,51.617814]},"properties":{"id":"781","line":"Northern","station_name":"Woodside Park","pm25":21,"cartodb_id":75,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.11463,51.462585]},"properties":{"id":"782","line":"Victoria","station_name":"Brixton","pm25":125,"cartodb_id":76,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.133285,51.528592]},"properties":{"id":"783","line":"Victoria","station_name":"Euston","pm25":70,"cartodb_id":77,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.106512,51.564403]},"properties":{"id":"784","line":"Victoria","station_name":"Finsbury Park","pm25":163,"cartodb_id":78,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.142921,51.506848]},"properties":{"id":"785","line":"Victoria","station_name":"Green Park","pm25":110,"cartodb_id":79,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.103963,51.546233]},"properties":{"id":"786","line":"Victoria","station_name":"Highbury & Islington","pm25":133,"cartodb_id":80,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.123854,51.530393]},"properties":{"id":"787","line":"Victoria","station_name":"King's Cross St. Pancras","pm25":73,"cartodb_id":81,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.141763,51.515121]},"properties":{"id":"788","line":"Victoria","station_name":"Oxford Circus","pm25":106,"cartodb_id":82,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.133742,51.489194]},"properties":{"id":"789","line":"Victoria","station_name":"Pimlico","pm25":161,"cartodb_id":83,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.072496,51.583354]},"properties":{"id":"790","line":"Victoria","station_name":"Seven Sisters","pm25":146,"cartodb_id":84,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.122903,51.472169]},"properties":{"id":"791","line":"Victoria","station_name":"Stockwell","pm25":219,"cartodb_id":85,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.123744,51.485734]},"properties":{"id":"792","line":"Victoria","station_name":"Vauxhall","pm25":167,"cartodb_id":86,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.143852,51.496342]},"properties":{"id":"793","line":"Victoria","station_name":"Victoria","pm25":98,"cartodb_id":87,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.138267,51.524508]},"properties":{"id":"794","line":"Victoria","station_name":"Warren Street","pm25":107,"cartodb_id":88,"created_at":"2015-01-09T16:49:17Z","updated_at":"2015-01-09T16:49:17Z"}}]}; | |
function getPi() { | |
return Math.PI | |
} | |
L.geoJson(tube, { | |
pointToLayer: function (feature, latlng) { | |
var popupOptions = { maxWith: 200 }; | |
var popupContent = "Station: " + feature.properties.station_name + "</br>" + "PM2.5: " + feature.properties.pm25; | |
function getOptions(properties) { | |
if (properties.line === "Circle") { | |
return { | |
radius: Math.sqrt(properties.pm25*5 / getPi()), | |
color: "black", | |
fillColor: "#FFCC00" | |
}; | |
} else if (properties.line === "Northern") { | |
return { | |
radius: Math.sqrt(properties.pm25*5 / getPi()), | |
color: "black", | |
fillColor: "#000000" | |
}; | |
} else { | |
return { | |
radius: Math.sqrt(properties.pm25*5 / getPi()), | |
color: "black", | |
fillColor: "#0099CC" | |
}; | |
} | |
} | |
return L.circleMarker(latlng, getOptions(feature.properties)).bindPopup(popupContent, popupOptions); | |
} | |
}).addTo(map); | |
</script> | |
</body> | |
</html> |
Thanks for your help Brian, that works a treat. I was just about getting there myself, but I like this way of doing it better.
Happy to help!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try this: