Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
let phillyNeighborhoods = {};
let workingPhillyBike = phillyBike;
phillyGeo.features.forEach(function(geo) {
phillyNeighborhoods[geo.properties.listname] = {
count: 0,
cartodb_id: geo.properties.cartodb_id
};
let reducedPhillyBike = workingPhillyBike;
workingPhillyBike = [];
reducedPhillyBike.forEach(function(bike) {
if(d3Geo.geoContains(geo, [bike.end_lon, bike.end_lat])) {
phillyNeighborhoods[geo.properties.listname].count += 1;
} else {
workingPhillyBike.push(bike);
}
});
});
let neighborhoods = Object.keys(phillyNeighborhoods).map(function(n) {
return {"Neighborhood": n,
"Count": phillyNeighborhoods[n].count,
cartodb_id: phillyNeighborhoods[n].cartodb_id};
});
return neighborhoods;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.