Given this scenario:
I am developing in C # and places stored on SQL Server 2008.
So, as I see it, I have these 3 options:
Save locations as longitude floats and do calculations in C #.
Store locations as geographic data types and perform calculations in SQL Server 2008 as follows:
CREATE TABLE UserLocations [UserId] [bigint] NOT NULL, [CurrentLocation] [geography] NOT NULL ALTER PROCEDURE sp_GetCurrentUsersInRange @userPoint geography, @RangeInMeters int AS BEGIN select UserId from UserLocations where @userPoint.STDistance(CurrentLocation) <= @RangeInMeters and UserId <> @userId END
Disadvantages: problems using geographic data with LinqToSQL and LinqToEntities.
Advantages: using dbms processing power on big data and using SQL Server spatial index.
3. -, Google. -.
? , .
, lat/long pc BETWEEN . 79% , , . .
BETWEEN
, SQL Server.
( STDistance) . , , .
100 000 , , , - #, , (.. Haversine). , , -.
, ( SQL Server), SQL Server, . . SQL Server , , , .
LINQ , SqlConnection Reader. , LINQ, Spatials, .
Google, -?