Monday, April 21, 2008

Some surprsing progress (for me)

I've managed to have broken the PHP barrier and have begun to understand how it's functionality works - however the Drupal connection still doesn't make sense to me, not entirely.

I spent the rest of Sunday night trying to come up with a clever way to implement the Find module. Since we want to find all of the CD's within a distance of a user's current location, I figure we can use Google maps' latitude and longitude measurements and some calculation to pick out the CD's nearest the search location. As far as I know, the call to Google we're making and the values we're pulling from the return are in degrees so using something like the Great Circle Distance Formula may actually feasible. Here are some steps I think can be followed:
  1. Have the user input the address they're located, city, state, and maybe zip code
  2. Search the data base for CD's in given location (more on this regarding problems in a bit)
  3. Go through list and calculate distances, only keeping points that are within specified distance
  4. Render map with points on it (have info regarding distance of sorts)

I think it should work, but there is an issues we'll have to contend with. If we're searching through a city, there may be many CDs that are returned. The Great-Circle Distance formula uses sine, cosine, and arcosine to calculate the distance, this may cause some inefficiencies.

I have to run this approach with the rest of the group. As I've mentioned before, Jason is working on this as well, but I have not heard anything from him, so I'm not sure what kind of progress he's made. If this works and the group goes along with it, all we would need to do is put the Google map on the page and it should be working (I've managed to have gotten most everything working, just have to double check the distances).

One final note, I'll have to double check and make sure this matches the requirements document. Don't want to go about just adding things al troche-moche. But we'll see!

No comments: