You could also think about having a database do some of the heavy lifting for you. MySQL spatial extensions are designed to solve this problem, and PostGIS does the same thing for Postgres.
PostGIS is my last resort... for simplicity sake, I didn't even want to use any SQL, but might try SQLite. If all else fails, then I will work with PostGIS (always looking for the simplest possible thing that could work well).
--
when small people start casting long shadows, it is time to go to bed
A good point, though sometimes simplicity can be very complicated. :) Please post back if you find any useful GIS stuff for SQLite or Berkeley DB; I've been meaning to look, but haven't yet.