That seems like a lot, but I actually narrowed it down from a list more than ten million locations I had information about. =) When I tried to run queries with that much data, however, the performance hit was dramatic. Maybe it was just on my development machine, but that much data had trouble, so I cut out a lot of it. And really, why did I need a list of a million locations in Russia? It's not like that country was a hotbed of letterboxing activity! So poof--I deleted all but the largest 1,000 cities or so. I could always add individual cities as needed later.
At the time, the only cities that AQ supported were ones that it already knew about. And being able to support addresses--specific points on the globe--wasn't even a twinkle in my eye. I was just happy I could support so many cities and towns from around the world. When I started my little project, I wasn't sure I'd be able to find the data I needed, or be able to make it run fast enough to be useful.
I was so proud of how many different cities that AQ could recognize, I even added that as a statistic on the AQ Statistics page. The number doesn't change very much, but occasionally, when a new city is added, the number might increase by one every now and then. As of this writing, it's up to 540,093.
Later, I learned about the Google geocoder--a wonderful little service that Google provides which allows me to send it a location (address or otherwise), and it'll return the latitude and longitude coordinates of that point. This was very cool, and I immediately set to work in incorporating it into Atlas Quest. It has its quirks, but without it, there would be no way to list boxes in locations more specific than being "somewhere in a city." It was a revolutionary development. I basically rewrote the core of the search engine around that Google geocoder.
But, oh, how quickly technology becomes obsolete.... Earlier this year, while working on a somewhat unrelated issue, I discovered that the version of the Google geocoder I was using had been deprecated. Which is a fancy word meaning it had been replaced with a bigger and better geocoder and that the old one could be discontinued at any time and should no longer be used. I needed to.... upgrade. *sigh*
I looked at the specs for the new Google geocoder version and didn't much like it. It seemed needlessly complicated, and I started poking around for other geocoders. By now, surely Yahoo or MapQuest or something had publicly available geocoders for use, so I poked around and discovered that I really liked Yahoo's newest entry into the world of geocoding.
I also decided that it would be a bad idea to rely on just one geocoder. What if it goes down, is changed, or discontinued unexpectedly? What if the Yahoo geocoder is depreciated to be replaced with something bigger and better later?
Without getting into the technical details, I wanted to create an interface that would allow me to switch out geocoders on the fly, almost like Lego pieces. This actually provides additional advantages--it means if I try using one geocoder and it cannot find the latitude and longitude coordinates of a location, I can try again with a different geocoder. And another. In the end, I now have about a dozen different geocoders working under the hood to try to interpret your locations.
The number of cities supported now is something of a misnomer. I created that statistic when the only cities supported were those that AQ already knew about. Once I added that first Google geocoder, it was capable of learning new cities automatically that it didn't know about before. I don't know how many cities the Google geocoder knows about, but it's certainly a heck of a lot more than AQ is familiar with, and there's not really any way for me to accurately count this number.
These new geocoders I'm adding support for, however, I'm designing from the ground up. The only locations the new database tables support are those that are actually being used by someone somewhere on Atlas Quest. So all those cities that AQ used to already know about in Lybia that never really got used will be gone. I'll depend on the geocoders to find that information for me as people need it.
As of right now--I'm still in the process of converting the old letterbox locations into new ones so this number will still go up (although probably not by much)--there are 19,207 different cities being used. A far cry from the 540,093 currently "supported," but that just goes to show that most of those locations just never got used. Not even half the cities and towns in the United States were being used.
In the Next Big Update, that "supported number of cities" in the statistics will be retired and replaced with a "number of cities used" statistic. I don't know how many cities are supported by the various geocoders, but I know it's even larger than ever before. Being able to look up specific coordinates for addresses in all sorts of countries has been added, and as companies like Yahoo and Google will continue to add more and better support for more and more countries throughout the world, AQ will also seemingly get smarter and smarter with each passing day.
AQ turns seven years old today. In that time, that original core search feature has been rewritten essentially from scratch twice. Which doesn't even include the countless minor tweaks I've had to make to it over the years. I'd like to think, "This time it's it. Once this is done, I'll never have to rewrite this stuff again." I want to think this, I see nothing on the horizon to think it's not true, but I also thought the same thing those last two times I wrote this part of AQ. I'd like to think I learned something from those first two coding attempts and that the third time's a charm--but I know I wouldn't make any bets on it. That's for sure. =)
On a completely unrelated note.... I wrote a small piece of code a couple of months ago capable of counting the number of various file types I've developed.
As of this minute, on my development machine (I didn't install the code on the live website), you'll find these numbers:
- 982 HTML files: that's now many individual URLs that AQ handles and knows about. Some of these, admittedly, are test pages that I have no intention of ever uploading to the live website.
- 3739 image files: each icon, logo, background image--there are 3739 images for use across the website. GIF files rule with 1896, and JPGs are runner up with 1278 files. PNG files make up the bulk of the rest.
- 117 CSS files: as a general rule of thumb, each CSS is usually one theme, but there are a few that are not.
- 10 MP3 files: these are mostly for the chat room sounds, but one was used for the last April Fools Day =)
Anyhow.... enough reminiscing.... there's code I need to be working on! =)