How I Solved an Interesting Problem and Made a Web App in 72 Hours

 

On Tuesday night my friend Brian and I tried out a new restaurant in Tokyo. An Izakaya is a tiny bar that also serves food, popular with Salarymen. Usually the food is huddled way over on the unhealthy end of the spectrum, but we found a macrobiotic one with good reviews. We sat there bemoaning how difficult it is to find places in Tokyo. Streets don’t have names and the address system is a bit confusing. The conversation moved on to talking about how difficult it is to express a location to someone. GPS coordinates are awkward, google maps links can’t be sent by SMS or over the phone, and not everywhere has an address. Even some addresses are confusing enough that they get miscommunicated. And how do you concisely give someone the exact location for “that bridge in the middle of the park”?

Is there a better way, we wondered? Could a location be expressed in just a short string of characters?

As I walked home, my mind was churning trying to figure out just how short of a string I could pack any location on earth into. As soon as I got home I visited wolframalpha.com, using it for a legitimate purpose for the very first time.

Consumer GPS devices have a resolution of about one square meter, which seemed to be the appropriate range to aim for. I was tempted to go for ten meters to make the string shorter, but decided it would be too inexact.

So, into Wolfram I put in “Surface area of planet earth in square meters”. That gave me a fifteen digit long number, meaning that if I wanted to stick to just decimals, the new notation would have to be fifteen characters long. Too long.

I took that number (5100000000000000) and put into Wolfram “5100000000000000 in Base 36”, which represents how long the string would be if I used all of the letters and numbers. That gave me a ten digit number, which was still longer than I wanted.

I changed base 36 to base 62, which represents all of the upper (26) and lowercase (26) letters as well as numbers (10). That gave me nine digits, but the first one was a two, meaning that it was just barely over twice as many locations as I’d need to get down to eight. I decided to split the globe in half and add a plus or minus to the beginning.

That brought me down to just about 20% more locations than I would need for eight digits. To bridge the gap I cut off everything above and below the northernmost and southernmost cities with 1000 residents respectively. I also had to stretch the map just slightly (4%), which resulted in a slight decrease in accuracy, but I thought it worth it for a shorter string.

The biggest technical problem followed. Although there were enough locations in my narrowed-down field, there wasn’t an easy way to use them all. That’s because the maximum latitude or longitude that a four character alphanumeric string could hold was about 167.00000. I needed 179.99999 for the latitude, but only around 126.00000 for the longitude. In other words, I couldn’t just have a pair of four character strings; I needed to “borrow” the extra space from the longitude and use it for the latitude. This took me a full twenty-four hours to figure out, and by figure out, I really just mean that I posted it to quora.com and a really nice guy told me how to do it.

Hey, it’s not all glory.

The next two days were spent learning how to use the Google Maps API and throw the whole thing together in a usable fashion. It could still use a bit of work, my code desperately needs to be cleaned up, and I need to make a mobile version for phones / Kindle, but enough functionality is there that I think people will find it a useful service.

To check it out, go to ToFind.Me and search for an address in the search box. You can also click the map to “unfreeze” the findme code and it will update as you move the mouse around until you click again.

I’d love to hear your feedback… is this useful to you? Could I change it to be more useful to you? Do you want to make an iPhone or Android app for it?

###

If you’re in Tokyo, check out the cool bar/restaurant in the basement here: http://ToFind.Me/+remkjuka. It’s built out like a cave. I didn’t eat there, but my friends did and they really liked it.

Since photos of me slumped in a couch eating mikan oranges while programming aren’t exciting, here’s a picture Todd took when we were on the roof of this building.

I don’t have a picture yet, but I got to visit NHK (like the BBC of Japan) because my friend Miwa works there. It was really fun playing with the weather green screen and sitting in the anchor’s chair.


Posted

in

by

Tags:

Comments

Leave a Reply

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