Posts

Showing posts from 2012

#techie Unless your interested in maps and calculating distances..... ignore this one!

Bit of a techie one this but I thought I'd add it in case somebody found it useful! I've been doing a bit of work with Google Maps and  http://www.openstreetmap.org/  an open data source project which I have a lot of respect for. I won't go into details but I've needed to calculate distances between two points based on there coordinates and some of this has to be done on a database server...... So I've put together this very quick SQL function which returns the distance between two coordinates in God's own measurement, no not cubits, miles! set   ANSI_NULLS   ON set   QUOTED_IDENTIFIER   ON go -- ============================================= -- Author:        <Christian Miles> -- ============================================= ALTER   FUNCTION  [dbo] . [calculateDistanceBetweenCoordinates] (     @lat1   float ,     @lon1   float ,     @lat2   float ,     @lon2   float ) RETURNS   float AS BEGIN  -- Assumes the Rad