More Locations

I found an easily parse-able list of ~1,100 US cities that includes their longitudes/latitudes and I wrote a little program to do the parsing and create the GIS-complaint SQL insert statements, and now there's all sorts of interesting points I can be near.


In June, Apple is supposed to release a new iPhone. I'm still sporting the "classic" model, because I wasn't that impressed with the 3G. I like the cool metallic backing of the original, and I'm not a fan of the new case design - to speak nothing of the so-so feature set. I have high hopes for the third-generation, which will hopefully be more than a simply-what-the-previous-generation-should-have-been phone.

In particular, I want a gps in my phone, finally.

With the little app that I'm writing, I should be able to "tag" a location, give it a brief description and push it to the database on my server. Not entirely unlike Loopt I admit, but this is mine - and that's important.

With potentially thousands of locations in the database, the SQL query to find the nearest point requires that PostGIS calculate the distance between the target point and each record in the location table. This isn't ideal. I read a brief conversation on this matter. The suggestion was to narrow the search to a bounding box (centered on the target point) that is relatively small, and increase the size of the box until at least one match is found.

But at what rate should the box size be increased? Double it every time? And what should the initial size be? A square mile? I guess it should be based on the density of points (on the order of a thousand spread across all of the US). Big enough that there's a sufficiently high probability of a hit on the first try, but not so large that there are many hits. Hrmm.


I was thinking that I should add an event table to the database. An event would have a location associated with it, and the event would be triggered when a Spot message indicated that I was within the specified tolerance of that location. An event might occur every time I am in/near the target location, or it might be a one-time thing. Then I could write a little bit of code to post certain messages to my blog when I finally arrived at a given camp on McKinley. Show a map. That sort of thing. I probably won't have time but I'm pondering it anyway.

No comments:

Post a Comment