Saturday, June 28, 2014

43,634 Street View Houses in Detroit


The New York Times has released a really impressive visualization using Google Maps Street View to show the 43,634 Properties in Detroit That Were on the Brink of Foreclosure This Year.

The mosaic of 43,634 pictures of Detroit houses is a very effective method to convey the sheer scale of the problem facing many Detroit homeowners.

It's possible that the New York Times gave the job of hunting out the Street View images of 43,634 properties to one of their interns. However it is more likely that the Times used the Google Maps API to geocode the addresses and then used the latitude and longitudes to return the static Street View images of the houses from the Street View Image API.

This isn't as easy as it sounds. If you just enter a latitude and longitude into the Street View Image API you will get a random facing Street View from that location. To actually retrieve the Street View image of the desired house you also need the correct heading to tell the API which direction to look.

Herein lies the problem. How do you quickly retrieve the correct heading for 42,623 addresses to ensure that your Street View images are all facing in the correct direction. One solution is to use the Google Maps API to find the nearest available Street View to the address and then use the computeHeading (from: LatLng, to:LatLng) function to calculate the correct heading (the two LatLngs being your nearest available Street View latitude and longitude and the latitude and longitude of your address).

I can't find a good map that demonstrates this function in action - in order to show the Street View of a house. However this Point the Street View to a Marker demo uses the exact same principal to find the correct heading to show a Street View looking towards a marker on a map.

No comments: