Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting from distance for geography coordinates
Message
From
23/11/2011 08:36:22
 
 
To
23/11/2011 08:27:40
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01529492
Message ID:
01529660
Views:
13
>>In all honesty - you may need that
>>
>>When I was taking my walk yesterday I figured out the use of the first clause
>>
>>If you do not have that many records, it does not matter, but with a lot of records there will be a difference in speed
>>
>>The first clause restricts the set to those that are in a square around you (latitude between .. and ... and longitude between .. and ...)
>>
>>The second one calculates the radius of the points in the square
>
>This is to be executed against 3000 to 4000 records. And, this is temporary. There is a good chance that by the time this goes in production, that we will be using spatial data type as we will have SQL Server 2008. So, this will look like this:
>
>
>DECLARE @GeographyCoordinate Geography
>DECLARE @Area Geography
>
>SET @GeographyCoordinate=Geography::Point(47.7795,-65.7191,4326)
>SET @Area=@GeographyCoordinate.STBuffer(50*1000)
>
>SELECT Client.Numero,@GeographyCoordinate.STDistance(GeographyPoint)/1000 AS Distance
>FROM (SELECT *,Geography::Point(Latitude,Longitude,4326) AS GeographyPoint FROM Client) Client
>WHERE @Area.STIntersects(Client.GeographyPoint)=1
>
>
>From what I read, this is meters by default.


Ok, Thanks for the 2008 version
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform