I put up some code snippets for a Location model in a Rails application. They include simple things like:
- degree< ->radians conversions
- distance between two locations
- Min/Max latitude & longitudes given a location and radius
- Database queries for locations in a given range from a center point
Essentially they're making up for not have a true GIS interface to the database running PostgreSQL and PostGIS.
Most of the functions actually came from another project, but I unfortunately lost the note, so if you can properly id the originator of some of the functions, please do!