In the time it took to act smart you could have just read the code and seen that his intuition was mostly right. The code is extremely simple. It reads like a half day project just for fun that happened to get picked up on HN. It doesn't seem to be at all related to his line of study either.
For you interest and information, he has a defined set of bounding boxes in the world for each of the user pickable regions. He generates random lat lons until one lands in an enabled region's bounding box and then makes a request for street view data to google. If google returns a 200 he sets the street view display to the lat Lon and otherwise tries to find another lat Lon. If he ever gets a 500 from
Google he quits.
I wasn't trying to figure out how it was done, I was trying to figure out how to do it fast (irrespective of the present implementation), responding to the question:
"I wonder if there's a faster way to do that with their API?"
I did check the source code. The most time is spent doing dozens to hundreds requests to Google API.
If instead of this you generated random locations just from "blue" regions of StreetView coverage, user experience would be better.
The simplest way how to do it would be to fetch StreetView coverage overlay PNG and use canvas getImageData to check pixel values for random locations, thus moving costly roundtrip validity query mostly to the browser.
This is not something terribly difficult and perfectly suitable for half day fun project.
There are ways how to get around cross-domain security restrictions. Long ago, I have done it myself by a simple server-side proxy here (few lines of PHP):
About Globe Genie optimization. In fact, I implemented it, sent a patch to the author and it's already live there (check the source code). It cuts cross-network locations validity lookups by about 60%.
Here I didn't do proxy, just fetched a complete set of overlay tiles once and stitched them together with a Python script:
It's just a static prebaked lookup map (served from the same domain), though if you really want to have it up-to-date, you could hook up Python script to cron.
All this took few hours (Sunday evening hacking) and was quite fun to do.
For you interest and information, he has a defined set of bounding boxes in the world for each of the user pickable regions. He generates random lat lons until one lands in an enabled region's bounding box and then makes a request for street view data to google. If google returns a 200 he sets the street view display to the lat Lon and otherwise tries to find another lat Lon. If he ever gets a 500 from Google he quits.