(. @tdammers), (Lat, Long) . , .
, SQL Server 2008, . (, , ), SQL-:
DECLARE @Point geography = 'POINT(-83.12345 45.12345)'
SELECT *
FROM tblStreetLamps
WHERE location.STDistance(@point) < 1 * 1609.344
, SQL Spatial .NET. : http://www.microsoft.com/downloads/en/details.aspx?FamilyID=CEB4346F-657F-4D28-83F5-AAE0C5C83D52 ( Microsoft® System CLR Types SQL Server® 2008 R2).
LINQ. . Haversine , .
var yourLocation = SqlGeography.Point(Latitude, Longitude, 4326);
var query = from fac in FacilityList
let distance = SqlGeography
.Point(fac.Lat, fac.Lon, 4326)
.STDistance(yourLocation)
.Value
where distance < 1 * 1609.344
orderby distance
select fac;
return query.Distinct().ToList();