Skip to content

Instantly share code, notes, and snippets.

@fkh
Created May 26, 2012 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fkh/2795546 to your computer and use it in GitHub Desktop.
Save fkh/2795546 to your computer and use it in GitHub Desktop.
Where will you go on NYC's bikeshare?

Here's a chord diagram of the first ~8,000 trips planned using cibi.me.

Process:

  • grabbed data on trips planned from cibi.me.
  • used the Flickr API to assign a neighborhood to each start/end pair (see php script).
  • Corrected the neighborhood names from Flickr (see list of names below), re-using some work done at OpenPlans for NYC bike share suggestions map.
  • Used Excel find the most popular destination pairs -- around 4,000 of the planned trips are between two of the following neighborhoods: Bedford-Stuyvesant, Lower Manhattan, East Village, Fort Greene, Greenpoint, Greenwich Village, LES, Midtown Manhattan, Soho, Tribeca, West Village and Williamsburg. Used a pivot table to make a matrix showing these trips plus aggregate "other" in each boro.
  • Modified this demo d3.js chord diagram to chart out the trips.

Obviously, neighborhood boundaries are debatable. Some neighborhoods are probably too small and end up lumped in "other", for example downtown Brooklyn, Brooklyn Heights, DUMBO and Vinegar Hill are all individually too small to make the cut for individual listing, but could be grouped in a similar fashion to "Lower Manhattan".

This product used the Flickr API but is not endorsed or certified by Flickr. Visualization with d3.js by Mike Bostock. cibi.me created by OpenPlans.

var w = 960,
h = 500,
r1 = h / 2,
r0 = r1 - 80;
//var fill = d3.scale.category20c();
var fill = d3.scale.ordinal()
.range(["#17becf",
"#756bb1", "#9e9ac8", "#bcbddc", "#de9ed6", "#dadaeb",
"#fd8d3c", "#31a354", "#fdae6b", "#fdd0a2", "#8c6d31",
"#74c476", "#a1d99b", "#c7e9c0", "#843c39",
"#e6550d"]);
var place = ["Bx",
"Bed-Stuy", "Ft Greene", "Greenpoint", "Williamsburg", "Brooklyn other",
"East Village", "Greenwich Village", "Lower East Side", "Lower Mnht", "Midtown",
"Soho", "Tribeca", "West Village", "Manhattan other",
"Qns"];
var chord = d3.layout.chord()
.padding(.04)
.sortSubgroups(d3.descending)
.sortChords(d3.descending)
.matrix([[0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,4],
[1,17,37,2,33,5,2,0,3,2,1,0,10,20,4,0],
[1,1,29,13,11,0,7,1,3,4,1,0,12,16,8,0],
[2,27,23,1,49,16,10,2,26,6,0,9,13,38,1,0],
[2,105,56,7,57,19,38,17,37,16,4,15,24,77,6,0],
[7,65,147,13,76,13,31,17,90,33,29,37,215,145,7,0],
[22,62,59,2,17,18,22,23,42,15,4,20,19,82,2,0],
[36,112,46,13,19,19,18,4,12,1,3,7,20,41,14,0],
[6,158,63,14,47,10,26,24,57,54,3,21,30,61,19,0],
[22,182,146,44,110,38,99,107,67,54,6,86,123,157,27,8],
[16,41,65,3,52,22,45,11,138,24,0,19,34,158,16,0],
[21,249,60,19,69,41,105,62,32,16,25,25,67,116,20,1],
[5,45,13,1,21,11,48,16,6,2,4,4,24,15,0,0],
[5,48,37,8,17,15,117,20,34,15,1,5,16,51,0,0],
[49,114,130,13,119,37,74,60,164,53,9,34,87,286,48,0],
[0,1,8,0,4,14,2,19,27,1,0,12,2,47,20,0]]);
var arc = d3.svg.arc()
.innerRadius(r0)
.outerRadius(r0 + 20);
var svg = d3.select("#chart").append("svg:svg")
.attr("width", w)
.attr("height", h)
.append("svg:g")
.attr("transform", "translate(" + w / 2 + "," + h / 2 + ")");
var g = svg.selectAll("g.group")
.data(chord.groups)
.enter().append("svg:g")
.attr("class", "group")
.on("mouseover", fade(.02))
.on("mouseout", fade(.80));
g.append("svg:path")
.style("stroke", function(d) { return fill(d.index); })
.style("fill", function(d) { return fill(d.index); })
.attr("d", arc);
g.append("svg:text")
.each(function(d) { d.angle = (d.startAngle + d.endAngle) / 2; })
.attr("dy", ".35em")
.attr("text-anchor", function(d) { return d.angle > Math.PI ? "end" : null; })
.attr("transform", function(d) {
return "rotate(" + (d.angle * 180 / Math.PI - 90) + ")"
+ "translate(" + (r0 + 26) + ")"
+ (d.angle > Math.PI ? "rotate(180)" : "");
})
.text(function(d) { return place[d.index]; });
svg.selectAll("path.chord")
.data(chord.chords)
.enter().append("svg:path")
.attr("class", "chord")
.style("stroke", function(d) { return d3.rgb(fill(d.source.index)).darker(); })
.style("fill", function(d) { return fill(d.source.index); })
.attr("d", d3.svg.chord().radius(r0));
// Returns an event handler for fading a given chord group.
function fade(opacity) {
return function(d, i) {
svg.selectAll("path.chord")
.filter(function(d) { return d.source.index != i && d.target.index != i; })
.transition()
.style("stroke-opacity", opacity)
.style("fill-opacity", opacity);
};
}
# some of the neighborhood names from Flickr's API are ... questionable. Here's a remapping.
# this list was originally created by Naama Lissar, Chris Abraham and Frank Hebbert at OpenPlans for use on nyc.gov/bikeshare.
boro, flickr output,sane version
Bronx, Allerton, Bronxdale
Bronx, Bathgate, Bathgate
Bronx, Baychester, Baychester
Bronx, Bedford Park, Bedford Park
Bronx, Belmont, Bedford Park
Bronx, Bronx Park South, Bronx Park South
Bronx, Bronx Park, Bronx Park
Bronx, Bronx River, Bronx River
Bronx, Bronxdale, Bronxdale
Bronx, Castel Hill, Castle Hill
Bronx, Castle Hill, Castle Hill
Bronx, Charlotte Gardens, Crotona Park
Bronx, City Island, City Island
Bronx, Claremont, Claremont
Bronx, Clarmont Village, Crotona Park
Bronx, Clason Point, Castle Hill
Bronx, Concourse Village, Concourse
Bronx, Concourse, Concourse
Bronx, Coop City, Coop City
Bronx, Country Club, Country Club
Bronx, Crotona Park East, Crotona Park
Bronx, East Concourse, Concourse
Bronx, East Morrisania, Morrisania
Bronx, East Tremont, East Tremont
Bronx, Eastchester Bay, Eastchester Bay
Bronx, Eastchester, Eastchester
Bronx, Edenwald, Baychester
Bronx, Edgewater Park, Edgewater Park
Bronx, Fieldston, Riverdale
Bronx, Fildston, Riverdale
Bronx, Fishbay, Williamsbridge
Bronx, Fordham, Fordham
Bronx, Harding Park, Harding Park
Bronx, Highbridge, Highbridge
Bronx, Hillside, Pelham Bay
Bronx, Historic Village, Pelham Bay
Bronx, Hunt's Point, Hunts Point
Bronx, Jerome Park, Kingsbridge
Bronx, John Adams Houses, Longwood
Bronx, Kings Bridge Heights, Kingsbridge Heights
Bronx, Kings Bridge, Kingsbridge
Bronx, Kingsbridge Heights, Kingsbridge Heights
Bronx, Kingsbridge, Kingsbridge
Bronx, Laconia, Laconia
Bronx, Lewis S Davidson Senior Houses, Longwood
Bronx, Locust Point, Throgs Neck
Bronx, Longwood, Longwood
Bronx, Melrose Houses, Concourse
Bronx, Melrose, Melrose
Bronx, Mill Brook Houses, Mott Haven
Bronx, Morris Heights, Morris Heights
Bronx, Morris Park, Morris Park
Bronx, Morrisania, Morrisania
Bronx, Mott Haven, Mott Haven
Bronx, Mount Eden, Mount Eden
Bronx, Mount Hope, Mount Hope
Bronx, North Baychester, Williamsbridge
Bronx, North Riverdale, North Riverdale
Bronx, Norwood, Norwood
Bronx, Olinville, Olinville
Bronx, Ollinville, Olinville
Bronx, Park of Edgewater, Eastchester
Bronx, Park Stratton, Van Nest
Bronx, Parkchester, Parkchester
Bronx, Patterson Houses, Mott Haven
Bronx, Pelham Bay Park, Pelham Bay
Bronx, Pelham Bay, Pelham Bay
Bronx, Pelham Gardens, Pelham Gardens
Bronx, Pelham Parkway, Pelham Parkway
Bronx, Plaza Borinquen, Mott Haven
Bronx, Plaza de Los Angeles, Mott Haven
Bronx, Port Morris, Port Morris
Bronx, Rikers Island, Rikers Island
Bronx, Riverdale, Riverdale
Bronx, Schuvilerville, Schuylerville
Bronx, Schuylerville, Schuylerville
Bronx, Silver Beach, Throgs Neck
Bronx, Soundview Bruckner, Soundview Bruckner
Bronx, Soundview Park, Soundview
Bronx, Soundview, Soundview
Bronx, South Bronx, Concourse
Bronx, South Riverdale, Riverdale
Bronx, Spuyten Duyvil, Spuyten Duyvil
Bronx, St. Mary's Park Houses, Mott Haven
Bronx, Throgs Neck, Throgs Neck
Bronx, Tremont, Tremont
Bronx, Unionport, Union Port
Bronx, University Heights, University Heights
Bronx, Van Cortlandt Park, Van Cortlandt Park
Bronx, Van Nest, Van Nest
Bronx, Wakefield, Wakefield
Bronx, West Concourse, Concourse
Bronx, West Farms, West Farms
Bronx, Westchester Square, Westchester Square
Bronx, Westchester, Westchester Square
Bronx, Williambridge, Willamsbridge
Bronx, Williams Bridge, Willamsbridge
Bronx, Williamsbridge, Williamsbridge
Bronx, Woodlawn, Woodlawn
Bronx, Woodstock, Melrose
Brooklyn, Adelphi, Clinton Hill
Brooklyn, Barren Island, Barren Island
Brooklyn, Bath Beach, Bath Beach
Brooklyn, Bayridge, Bay Ridge
Brooklyn, Bedford Stuyvesant, Bedford-Stuyvesant
Brooklyn, Bedford, Bedford-Stuyvesant
Brooklyn, Bensonhurst, Bensonhurst
Brooklyn, Bergen Beach, Bergen Beach
Brooklyn, Beverly Square West, Prospect Park South
Brooklyn, BoCoCa, Boerum Hill
Brooklyn, Boerum Hill, Boerum Hill
Brooklyn, Borough Park, Borough Park
Brooklyn, Brighton Beach, Brighton Beach
Brooklyn, Broadway Junction, Cypress Hills
Brooklyn, Brooklyn Heights, Brooklyn Heights
Brooklyn, Brownsville, Brownsville
Brooklyn, Bushwick, Bushwick
Brooklyn, Cadman Plaza, Downtown Brooklyn
Brooklyn, Canarsie, Canarsie
Brooklyn, Carroll Gardens, Carroll Gardens
Brooklyn, City Line, East New York
Brooklyn, Clinton Hill, Clinton Hill
Brooklyn, Cobble Hill, Cobble Hill
Brooklyn, Columbia St, Red Hook
Brooklyn, Coney Island, Coney Island
Brooklyn, Crown Heights South, Crown Heights
Brooklyn, Crown Heights, Crown Heights
Brooklyn, Crown Hights, Crown Heights
Brooklyn, Cypres Hills, Cypress Hills
Brooklyn, Cypress Hill, Cypress Hills
Brooklyn, Ditmas Park West, Prospect Park South
Brooklyn, Ditmas Park, Prospect Park South
Brooklyn, Down Town, Downtown Brooklyn
Brooklyn, Downtown Brooklyn, Downtown Brooklyn
Brooklyn, Dumbo, DUMBO
Brooklyn, Dyker Heights, Dyker Heights
Brooklyn, East Flatbush, East Flatbush
Brooklyn, East New York, East New York
Brooklyn, East Williamsburg, Williamsburg
Brooklyn, East Williasburg, Williamsburg
Brooklyn, Eastern Parkway, Crown Heights South
Brooklyn, Farragut, Farragut
Brooklyn, Fiske Terrace, Midwood
Brooklyn, Flatbush, Flatbush
Brooklyn, Flatlands, Flatlands
Brooklyn, Floyd Bennett, Floyd Bennett Field
Brooklyn, Fort Greene, Fort Greene
Brooklyn, Fort Hamilton, Fort Hamilton
Brooklyn, Fulton Ferry, DUMBO
Brooklyn, Georgetown, Bergen Beach
Brooklyn, Gerritsen Beach, Brooklyn Marine Park
Brooklyn, Gerritsen, Gerritsen Beach
Brooklyn, Gowanus, Gowanus
Brooklyn, Gravesend, Gravesend
Brooklyn, Greenpoint, Greenpoint
Brooklyn, Highland Park, Cypress Hills
Brooklyn, Home Crest, Homecrest
Brooklyn, Homecrest, Homecrest
Brooklyn, Kensington, Kensington
Brooklyn, Little Odessa, Brighton Beach
Brooklyn, Little Poland, Greenpoint
Brooklyn, Manhattan Beach, Manhattan Beach
Brooklyn, Manhattan Terrace, Manhattan Terrace
Brooklyn, Marine Park, Marine Park
Brooklyn, Midwood Park, Midwood
Brooklyn, Midwood, Midwood
Brooklyn, Mill Basin, Mill Basin
Brooklyn, Mill Island, Mill Basin
Brooklyn, Morgan Avenue, Williamsburg
Brooklyn, Navy Yard, Fort Greene
Brooklyn, New Lots, East New York
Brooklyn, New Utrecht, Bensonhurst
Brooklyn, New York Navy Yard, Fort Greene
Brooklyn, North Side, Williamsburg
Brooklyn, North Williamsburg - North Side, Williamsburg
Brooklyn, Ocean Hill, Bushwick
Brooklyn, Ocean Parkway, Midwood
Brooklyn, Ord-Stuyvesant, Bedford Stuyvesant
Brooklyn, Paedergat Basin, Canarsie
Brooklyn, Paerdegat, Canarsie
Brooklyn, Park Slope, Park Slope
Brooklyn, Parkville, Borough Park
Brooklyn, Plum Beach, Sheepshead Bay
Brooklyn, Prospect Heights, Prospect Heights
Brooklyn, Prospect Hights, Prospect Heights
Brooklyn, Prospect Leffert, Prospect Lefferts Gardens
Brooklyn, Prospect Park Sout, Prospect Park South
Brooklyn, Prospect Park South, Prospect Park South
Brooklyn, Prospect Park, Prospect Park
Brooklyn, Prospect, Prospect Lefferts Gardens
Brooklyn, Red Hook, Red Hook
Brooklyn, Remsen Village, East Flatbush
Brooklyn, Rugby, East Flatbush
Brooklyn, Sea Gate, Sea Gate
Brooklyn, Sheepshead Bay, Sheepshead Bay
Brooklyn, South Brooklyn, Gowanus
Brooklyn, South Midwood, South Midwood
Brooklyn, South Side, Williamsburg
Brooklyn, South Slope, Park Slope
Brooklyn, Spring Creek, Spring Creek
Brooklyn, Starrett City, Spring Creek
Brooklyn, Stuyvesant Heights, Bedford-Stuyvesant
Brooklyn, Sunset Park, Sunset Park
Brooklyn, Tulton Ferry, DUMBO
Brooklyn, Vinegar Hill, Vinegar Hill
Brooklyn, Weeksville, Crown Heights
Brooklyn, West Brighton, Brighton Beach
Brooklyn, West Ford Park, Flatbush
Brooklyn, Williamsburg - South Side, Williamsburg
Brooklyn, Williamsburg, Williamsburg
Brooklyn, Windsor Teraace, Windsor Terrace
Brooklyn, Windsor Terrace, Windsor Terrace
Brooklyn, Wingate, Crown Heights
New York, Alphabet City, Lower East Side
New York, Ansonia, Upper West Side
New York, Battery Park City, Lower Manhattan
New York, Beekman, Midtown East
New York, Bellevue, Kips Bay
New York, Bowery, Lower East Side
New York, Carnegie Hill, Upper East Side
New York, Carnegie Hills, Upper East Side
New York, Central Harlem, Harlem
New York, Chelsea, Chelsea
New York, Chinatown, SoHo
New York, City Hall Area, Lower Manhattan
New York, City Hall, City Hall
New York, Civic Center, Lower Manhattan
New York, Clinton, Hell's Kitchen
New York, Downtown, Downtown Manhattan
New York, East Harlem, East Harlem
New York, East Side, Midtown East
New York, East Village, East Village
New York, Financial District, Lower Manhattan
New York, Flatiron District, Flatiron District
New York, Flatiron, Midtown
New York, Fort George, Washington Heights
New York, Fort Jay, Governors Island
New York, Garment District, Herald Square
New York, Governor Alfred e Smith Houses, Lower Manhattan
New York, Gramercy, Gramercy
New York, Gramercy-Flatiron, Flatiron District
New York, Greenwich Village, Greenwich Village
New York, Hamilton Grange, Hamilton Heights
New York, Hamilton Heights, Hamilton Heights
New York, Hamilton Hights, Hamilton Heights
New York, Harlem, Harlem
New York, Hell's Kitchen, Hell's Kitchen
New York, Hudson Heights, Washington Heights
New York, Inwood, Inwood
New York, Kips Bay, Kips Bay
New York, Knickerbocker Village, Lower Manhattan
New York, Koreatown, Herald Square
New York, Lenox Hill, Upper East Side
New York, Lincoln Square, Upper West Side
New York, Little Germany, Lower East Side
New York, Little Italy, SoHo
New York, LoDel, Lower East Side
New York, LoHo, Lower East Side
New York, Loisaida, East Village
New York, Lower East Side, Lower East Side
New York, Lower Manhattan, Lower Manhattan
New York, Manhattan Valley, Upper West Side
New York, Manhattanville, Manhattanville
New York, Marble Hill, Inwood
New York, Meat Packing District, West Village
New York, Medical Centre, Kips Bay
New York, Midtown South, Flatiron District
New York, Midtown West, Midtown
New York, Midtown, Midtown
New York, Morningside Heights, Morningside Heights
New York, Morningside Hights, Morningside Heights
New York, Murray Hill, Murray Hill
New York, NoHo, Greenwich Village
New York, Nolita, SoHo
New York, Roosevelt Island, Roosevelt Island
New York, Rose Hill, Kips Bay
New York, San Juan Hill, Midtown
New York, Seaport, Lower Manhattan
New York, Soho, Soho
New York, Southern Tip, Lower Manhattan
New York, Spanish Harlem, East Harlem
New York, SPURA, Lower East Side
New York, St. Nicholas Terrace, Upper West Side
New York, Stuyvesant Town, East Village
New York, Sugar Hill, Hamilton Heights
New York, Sutton Place, Upper East Side
New York, Tenderloin, Midtown
New York, Theatre District, Midtown
New York, Tribeca, Tribeca
New York, Tudor City, Murray Hill
New York, Turtle Bay, Midtown
New York, Two Bridges, Lower Manhattan
New York, Union Square, Midtown
New York, Upper East Side, Upper East Side
New York, Upper West Side, Upper West Side
New York, Uptown, Manhattan
New York, Washington Heights, Washington Heights
New York, West Side, Upper West Side
New York, West Village, West Village
New York, York Ville, Upper East Side
New York, Yorkville, Upper East Side
Other, Lincoln, Lincoln
Other, Ludlow, Ludlow
Other, Sands Point, Sands Point
Queens, Arverne, Arverne
Queens, Arverne-Edgemere, Far Rockaway
Queens, Astoria Heights, Astoria
Queens, Astoria Hights, Astoria
Queens, Astoria South, Astoria
Queens, Astoria, Astoria
Queens, Auburndale, Auburndale
Queens, Bay Terrace (Queens), Bay Terrace
Queens, Bay Terrace, Bay Terrace
Queens, Bayside, Bayside
Queens, Bayswater, Bayswater
Queens, Beechhurst, Beechhurst
Queens, Bellaire, Bellaire
Queens, Belle Harbor, Belle Harbor
Queens, Bellerose, Bellerose
Queens, Blissville, Blissville
Queens, Boardwalk, Rockaway Park
Queens, Breezy Point, Breezy Point
Queens, Briarwood, Briarwood
Queens, Broad Channel, Broad Channel
Queens, Brooklyn Manor, Woodhaven
Queens, Brookville, Brookville
Queens, Browne Park, Clearview
Queens, Bushwick Junction, Maspeth
Queens, Cambria Heights, Cambria Heights
Queens, Cedar Manor, Jamaica
Queens, Clearview, Clearview
Queens, College Point, College Point
Queens, Corona, Corona
Queens, Douglaston, Douglaston
Queens, Down Town Flushing, Flushing
Queens, Dutch Kills, Sunnyside
Queens, East Elmhurst, East Elmhurst
Queens, East Flushing, Flushing
Queens, Edgemere, Edgemere
Queens, Elmhurst, Elmhurst
Queens, Far Rockaway, Far Rockaway
Queens, Floral Park, Floral Park
Queens, Flushing Meadows, Flushing Meadows
Queens, Flushing, Flushing
Queens, Forest Hills Gardens, Forest Hills Gardens
Queens, Forest Hills, Forest Hills
Queens, Forest Park, Forest Hills
Queens, Fort Tilden, Breezy Point
Queens, Fort Totten, Bay Terrace
Queens, Fresh Meadows, Fresh Meadows
Queens, Fresh Pond Junction, Ridgewood
Queens, Fresh Pond, Ridgewood
Queens, Glen Oaks, Glen Oaks
Queens, Glendale, Glendale
Queens, Haberman, Maspeth
Queens, Hamilton Beach, Howard Beach
Queens, Hammels, Hammels
Queens, Hill Crest, Hillcrest
Queens, Hillcrest, Hillcrest
Queens, Hillside, Hillcrest
Queens, Holland, Rockaway Park
Queens, Hollis, Hollis
Queens, Holliswood, Holliswood
Queens, Howard Beach, Howard Beach
Queens, Howard Park, Howard Beach
Queens, Hunters Point, Hunters Point
Queens, Jackson Heights, Jackson Heights
Queens, Jamaica Estates, Jamaica
Queens, Jamaica Hills, Jamaica
Queens, Jamaica, Jamaica
Queens, Kew Gardens Hill, Kew Gardens
Queens, Kew Gardens Hills, Kew Gardens
Queens, Kew Gardens, Kew Gardens
Queens, Laurelton, Laurelton
Queens, LeFrak City, Corona
Queens, Lidenwood, Lidenwood
Queens, Linden Hill, Maspeth
Queens, Lindenwood, Woodhaven
Queens, Little Neck, Little Neck
Queens, Locust Manor, Springfield Gardens
Queens, Locustwood Gotham, Locustwood Gotham
Queens, Long Island City, Long Island City
Queens, Malba, Malba
Queens, Maspeth, Maspeth
Queens, Middle Village, Middle Village
Queens, Morris Park, Richmond Hill
Queens, Murray Hill, Murray Hill
Queens, Murry Hill, Murray Hill
Queens, Neponsit & Belle, Neponsit
Queens, Neponsit & Belle, Belle Harbor
Queens, Neponsit, Neponsit
Queens, New Gardens Hills, Kew Gardens
Queens, North Bayside, Clearview
Queens, North Beach, Jackson Heights
Queens, North Corona, North Corona
Queens, Oakland Gardens, Oakland Gardens
Queens, Old Howard Beach, Old Howard Beach
Queens, Ozone Park, Ozone Park
Queens, Parkside, Forest Hills
Queens, Parsons Beach, Little Neck
Queens, Pomonok, Pomonok
Queens, Queens College, Queensboro Hill
Queens, Queens Village, Queens Village
Queens, Queensboro Hill, Queensboro Hill
Queens, Queensboro Hills, Queensboro Hill
Queens, Queensbridge, Long Island City
Queens, Ramblersville, Howard Beach
Queens, Ravenswood, Ravenswood
Queens, Rego Park, Rego Park
Queens, Richmond Hill, Richmond Hill
Queens, Ridgewood, Ridgewood
Queens, Rochdale, Rochdale
Queens, Rockaway Beach, Rockaway Park
Queens, Rockaway Park, Rockaway Park
Queens, Rockaway Point, Breezy Point
Queens, Rockwood Park, Howard Beach
Queens, Rosedale, Rosedale
Queens, Roxbury, Roxbury
Queens, Seaside, Seaside
Queens, Somerville, Somerville
Queens, South Corona, South Corona
Queens, South Jamaica, South Jamaica
Queens, South Ozone Park, South Ozone Park
Queens, South Richmond Hill, Richmond Hill
Queens, Springfield Gardens, Springfield Gardens
Queens, Springfield Grdn, Springfield Gardens
Queens, St. Albans, St. Albans
Queens, Steinway, Steinway
Queens, Sunnyside Gardens, Sunnyside Gardens
Queens, Sunnyside, Sunnyside
Queens, Terrace Heights, Holliswood
Queens, Tudor Village, Woodhaven
Queens, Utopia, Utopia
Queens, Wave Crest, Far Rockaway
Queens, Whitestone, Whitestone
Queens, Willets Point, Flushing
Queens, Woodhaven, Woodhaven
Queens, Woodside, Woodside
Staten Island, Annadale, Annadale
Staten Island, Arden Heights, Arden Heights
Staten Island, Arlington, Arlington
Staten Island, Arrochar, Arrochar
Staten Island, Aspen Knolls, Arden Heights
Staten Island, Bay Terrace (Staten Island), Bay Terrace
Staten Island, Bloomfield, Bloomfield
Staten Island, Brighton Heights, St. George
Staten Island, Bull's Head, Bulls Head
Staten Island, Bulls Head, Bulls Head
Staten Island, Butler Manor, Butler Manor
Staten Island, Castleton Corner, Castleton Corners
Staten Island, Castleton Corners, Castleton Corners
Staten Island, Charleston, Charleston
Staten Island, Chelsea, Chelsea
Staten Island, Clifton, Clifton
Staten Island, Concord, Concord
Staten Island, Crest Kills Park, Bay Terrace
Staten Island, Dongan Hills, Dongan Hills
Staten Island, Egbertville, Egbertville
Staten Island, Elm Park, Elm Park
Staten Island, Eltingville, Annadale
Staten Island, Emerson Hill, Emerson Hill
Staten Island, Fort Wadsworth, Arrochar
Staten Island, Fox Hills, Fox Hills
Staten Island, Fresh Kills, Fresh Kills
Staten Island, Grand City, Old town
Staten Island, Graniteville, Graniteville
Staten Island, Grant City, Grant City
Staten Island, Grasmere, Rosebank
Staten Island, Great Kills, Great Kills
Staten Island, Greenridge, Greenridge
Staten Island, Grymes Hill, Grymes Hill
Staten Island, Gulfport, Port Ivory
Staten Island, Hamilton Park, New Brighton
Staten Island, Heartland Village, Heartland Village
Staten Island, Howland Hook, Howland Hook
Staten Island, Howland Hook, Howland Hook
Staten Island, Huguenot, Huguenot
Staten Island, La Tourette Park, Todt Hill
Staten Island, Lighthouse Hill, Lighthouse Hill
Staten Island, Linden-Park, Grand City
Staten Island, Livingston, Livingston
Staten Island, Mariners Harbor, Mariner's Harbor
Staten Island, Meiers Corners, Castleton Corner
Staten Island, Midland Beach, Midland Beach
Staten Island, Miller Field, Midland Beach
Staten Island, New Brighton, New Brighton
Staten Island, New Dorp Beach, New Dorp Beach
Staten Island, New Dorp, New Dorp
Staten Island, New Springville, New Springville
Staten Island, Oakwood Beach, Oakwood Beach
Staten Island, Oakwood Heights Station, Oakwood
Staten Island, Oakwood, Oakwood
Staten Island, Ocean Breeze, Concord
Staten Island, Old Place, Old Place
Staten Island, Old Town Station, Old Town
Staten Island, Old Town, Old Town
Staten Island, Park Hill, Park Hill
Staten Island, Pleasant Plains, Pleasant Plains
Staten Island, Port Ivory, Port Ivory
Staten Island, Port Richmond, Port Richmond
Staten Island, Prince's Bay, Prince's Bay
Staten Island, Princes Bay, Prince's Bay
Staten Island, Randall Manor, Randall Manor
Staten Island, Richmond Town, Richmond Town
Staten Island, Richmond Valley, Richmond Valley
Staten Island, Richmond, St. George
Staten Island, Rosebank, Rosebank
Staten Island, Rossville, Rossville
Staten Island, Shore Acres, Shore Acres
Staten Island, Silver Lake, Silver Lake
Staten Island, South Beach, South Beach
Staten Island, St. George, St. George
Staten Island, Stapleton Heights, Stapleton
Staten Island, Stapleton, Stapleton
Staten Island, Sunnyside, Sunnyside
Staten Island, Todt Hill, Todt Hill
Staten Island, Tompkinsville, Tompkinsville
Staten Island, Tottenville Beach, Tottenviille
Staten Island, Tottenville, Tottenville
Staten Island, Travis, Travis
Staten Island, Ward Hill, Ward Hill
Staten Island, West Brighton, West Brighton
Staten Island, West New Brighton, West New Brighton
Staten Island, Westerleigh, Westerleigh
Staten Island, Willowbrook, Willowbrook
Staten Island, Woodrow, Woodrow
<?php
// flickr stuff
require('phpFlickr/phpFlickr.php');
$api_key = '';
$f = new phpFlickr($api_key);
// read from file
$locn_file = '/Users/fkh/cibi.me/cibi-locs.csv';
$trips = file($locn_file);
foreach ($trips as $trip_num => $trip) {
$locs = explode(",", $trip);
$output = $locs[4] . ",";
//ask flickr about the start locn
$fresponse = $f->places_findByLatLon($locs[0], $locs[1]);
$flickr_neighborhood = $fresponse["places"]["place"][0]["name"];
$flickr_neighborhood = explode(',', $flickr_neighborhood);
$flickr_neighborhood = $flickr_neighborhood[0];
$output .= $flickr_neighborhood . ",";
// wait a bit to avoid flickr throttling
sleep(1);
// ask about the end location
$fresponse = $f->places_findByLatLon($locs[2], $locs[3]);
$flickr_neighborhood = $fresponse["places"]["place"][0]["name"];
$flickr_neighborhood = explode(',', $flickr_neighborhood);
$flickr_neighborhood = $flickr_neighborhood[0];
$output .= $flickr_neighborhood . "\n";
// write all this to a file
$myFile = "output.txt";
$file = fopen($myFile, 'a') or die("can't open file");
fwrite($file, $output);
fclose($file);
// wait a bit to avoid flickr throttling
sleep(2);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script src="http://d3js.org/d3.v2.min.js?2.8.1"></script>
<style type="text/css">
text {
font-size: 10px;
}
</style>
</head>
<body>
<div id='chart'> </div><link href='chord.css' rel='stylesheet' type='text/css' /><script src='chord.js' type='text/javascript'> </script> </div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment