|
Posted by Jason Barnett on 10/21/45 11:05
Richard: I found this post incredibly useful. Thank you!
Richard Lynch wrote:
> If you only want "close" things to a given location, the curvature of the
> earth is pretty insignificant.
>
....
>
> I realized one day that at a distance of a hundred miles or less, I just
> didn't *CARE* about curvature of the earth, and replaced that trig with
> your basic Cartesian distance.
>
> Made a *HUGE* difference in performance.
>
....
> Put a longitude and latitude column on your existing table, and default it
> to NULL.
>
> Write your business logic so that *ANY* time a zip code is changed, the
> longitude/latitude is re-set to NULL. (Or use triggers or whatever you
> want to make this happen. I don't care.)
>
> Finally, write a cron job (scheduled task in Windoze) to find N records at
> random in your table where the long/lat is NULL, and *copy* over the
> long/lat from the zips table.
....
>
> PPS You can pay $$$ for the "complete" databases of zips, or use the TIGER
> data for free just interpolate from existing entries to make up long/lats
> for new zips. EG: If tomorrow the USPS creates zip code 60609, I can be
> pretty damn sure it's "close enough" to 60601 through 60608 and just
> average them to make up bogus long/lat. Sure, it's "wrong". It's also
> FREE and "close enough" for what I (and almost for sure you) are doing.
>
--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://www.php.net/manual/en/index.php
php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2
Navigation:
[Reply to this message]
|