Monte Carlo Neighborhoods

Neighborhood boundaries are hard to come by. The free data is limited, fragmented, and requires a lot of effort to clean up and merge together into a standardized easy-to-use format. The stuff for sale is expensive.

Google has pretty good neighborhood outlines but for some reason they don’t expose that data through their API. So I can’t just ask for the neighborhood boundaries :/

However they let you reverse-geocode random points: send google the latitude+longitude and out comes the street, neighborhood, city, and state it is in.

So let’s cause some mayhem :)

Drop 200 random points into Google’s 25,000 queries/day capped free reverse-geocoding service:

Store the results in your trusty database.

Group the points by neighborhood-name and generate their convex hulls. Display them as polygonal overlays:

200 data points

Not bad for just 200 random samples. Imagine what 20,000 intelligently chosen samples would gather. Could probably map out every neighborhood in New York City in a week or two.

The final improvement is implementing concave hulls, or alpha shapes like Flickr did, for each point-cloud representing a neighborhood. Mmmm I haven’t touched concave hulls since implementing a 3D tri-mesh collision response system for a robotics simulator 5+ years ago. Oh the nostalgia.

Update (Nov 2nd):

Improved sampling algorithm to choose points outside of existing convex hulls. 300 intelligent-samples later, we have some decent looking neighborhood polygons:

500 data points

Leave a Reply

Your email address will not be published. Required fields are marked *