Geodesic Distance Function in PHP

I was working on some code to process some GPS track logs and I wanted to be able to accurately calculate the distance between 2 points in the log. I did some searches, but there were no obvious solutions written in PHP. However, I did run across Chris Veness’ version in javascript. I worked through his function and mashed it up as PHP. The result seems to work, but for me with slightly less accuracy than the javascript version. At this point the problems seems to be the limit on the number of significant digits that PHP is using vs. JavaScript. If anyone finds any other problems, definitely let me know.

Why is this so great? Not only is this distance based on a curved surface, but you can vary the ellipsoid model being used (see vars $a, $b, and $f) to get a result with even greater accuracy. Just to clarify, the HowFar function does require the points to be in radians, not degrees, so be sure to use the deg2rad function to convert your lat/long into a usable format.

How To Get Free Topo Maps

I really like a good map. A GPS + Laptop is great, but nothing works like a piece of paper when the batteries go dead or your laptop falls into the lake. Unfortunately, finding high quality topo maps for free is a chore.

When I first started searching for topo maps all I was able to find were those provided by Jared Benedict over at Then he started the map ransom project, which finally freed the maps. Now you can download any of the US Quads you want over at libre map. The drawback here is that the topos are all 100dpi scans (for most of the quads). Depending on how you print them, it can be difficult to make out some of the details.

Well, after some more searching I was directed to the USDA Forest Service geospatial data clearinghouse. Here you can download high quality (300dpi mostly) raster TIFs of the same quads, produced by the NFS. One great thing about the NFS maps is that the forest roads are all numbered.

The downside is that some of the NFS maps don’t have roads the USGS topos have, and vice versa. In practice it’s definitely best to have as many maps as you can of an area if you want to have the best coverage of an area.

Pseudo Patriotism

I am so frustrated lately by this pseudo-patriotism that serves merely as a whitewash to cover a deep and growing arrogance.

Let me explain myself.

As I've grown up I've been somewhat infatuated with my country and the values that it was founded upon. Freedom. Freedom from oppression. Freedom of speech. Freedom to criticize. Freedom to protest. Freedom to choose your own governmental representatives. Opportunity. Opportunity to work. Opportunity to serve. Opportunity to protect our liberties. For those values I have been, I am, and I always will be willing to lay down my life. Those are values I hold dear. They are blessings and should be viewed as such.

Yet as time has passed America has become infatuated not with the truths she was founded on, but infatuated with herself. A deep arrogance has begun to blossom. We are a conceited people, who demand vengence for the wrongs done to us not so much because they were horrible deeds, but because they were done to us, Great and Mighty America. Who art thou to challenge our greatness? Who are you to pick on us? We have become the self-concious bully on the playground, seeking to get revenge for the sand thrown in our eyes. I do not consider the events of Septemer 11, 2001 as insignificant. Thousands were murdered that day, and I consider that the most abhorrent of evils. I cannot articulate the sorrow and anger that wells up inside of me in response to the horrors committed. Yet also I find that I am deeply incensed at this conceit that wells up out of the general population. It is as if with one voice all are crying out, "How can you harm us!? As Americans we have a right not to be attacked! How dare you hurt might America!?" But who is standing and declaring the injustice that was done, and in turn crying out not for vengence, but for justice? On the surface it may seem insignificant. In either case, in fact, the response may be the same. But the underlying attutudes and motivations deviate wholly from that which this nation was established on. For when we seek not justice but vengence, we are becoming like the very evildoers who delivered that vile evil against us. Do we seek revenge or justice? An eye for an eye or the rod of discipline? Our we motivated by hatred or righteous anger? Are we filled with integrity or a blood lust?

If patriotism now means that I must declare my own existence more important that the existence of someone else on this earth, then I shall have no part in it. But if I can be part of a patriotism that declares that all men truly are created equal, that justice must be upheld, that freedom and libery are great blessings to be held onto with joy, that these blessings are only considered "rights" when those who are given them are blessed with a government who acknowledges these truths, and that we have no place to be arrogant because we ourselves are but stewards of these great values, then show me the way, for I will spill my blood first to defend this form of patriotism -- a patriotism upon which that "Great America" was built.

AT&T and My 8260

ATT Wireless is great. The Nokia 8260 is not.

Back in January I dumped SprintPCS for ATT and purchased a brand new Nokia 8260. At first the service was great. ATT was much more reliable than Sprint, and their customer service was so far beyond Sprint it isn't describable (though Sprint is so atrocious I'm not sure it would really take much). Then everyone started to sign up with ATT. And I mean everyone. Half my friends and several fellow employees at work jumped on the ATT bandwagon as they lowered their prices. With all these new customers ATT should be doing well right?

Apparently there have been so many new customers that ATT is struggling to keep up with all the new signups. Their infrastructure is being pushed to the limits, and as a result they've had to cut back on the bandwidth they allot to each user per call. Now for most users this really doesn't make too much of a difference. A few more pops and crackles here and there maybe, but that's pretty much it. But not for an 8260 user.

The Nokia 8260 is a sexy little phone that I had wanted for quite some time before I purchased it. Small and light, I was excited to get my new phone. The problem, however, is that the 8260 has an equally small antenna (internal no less) to go with its small case. This normally isn't a problem, but when ATT started to cut back on their bandwidth the 8260 just couldn't keep up. So for the last 4 months I've been having lots of problems. This week they became unbearable.

When I first started having problems with my phone (lots of dropped calls, missed calls, fast busy) I called ATT and complained. After thoroughly explaining my situation and going through a lot of tests they sent me a new 8260. This seemed like a good deal to me; at the time I still thought maybe I just had a defective phone. Then I started talking to others and found out that the 8260 is quite notorious for horrible reception, especially in the conditions I've been using it in. One friend has gone through over 5 8260s. Thus I wasn't very surprised when my new phone didn't operate any differently than my old one.

So today I called ATT up and made my case. They sold me an 8260 that was supposed to work on their network. I bought it in their store, and didn't even get a substantial discount on it when I purchased it. Now the phone I bought from them doesn't work on their network like it is supposed to. John at ATT looked back through the list of previous calls I had made to ATT explaining how my phone sucked and suggested that we try to find me a new phone. I heartily agreed. He offered me the 3360 for 29.99 after rebate. I explained that I already bought a new phone and I didn't want to buy one again. This was their fault the phone didn't work (indirectly) and paying for a new phone was not what I wanted. John agreed and credited my bill the 29.99. The phone will be FedExed overnight. So in another day or so I will have a new phone that should work and I won't have had to pay for it. This is why I am a big fan of ATT. They go out of their way to help the customer, and are willing to do things like send me a new phone for free to keep me as a customer.

Sprint, on the other hand, keeps sending me bills for $0.00 every month. Apparently they aren't willing to stop billing me. These bills are annoying, but part of me is very satisfied when they spend money every month to send me a bill for $0.00. I can't tell you how refreshing it is to deal with a company who's policy is, "solve all problems in one call," rather than, "Make sure the customer knows they are lucky we are letting them be our customer."