sql server - Spatial Data not returning correct distance -


i have 2 following locations.

they're both towns in australia , state of victoria

fitzroy,-37.798701, 144.978687 footscray,-37.799736, 144.899734 

i've followed tutorial to work out distance between 2 cities

after running geography::point(latitude, longitude , 4326) on latitude , longitude provided each location, geography column each row populated following:

fitzroy, 0xe6100000010c292499d53be642c0a7406667511f6240 footscray, 0xe6100000010c89b7cebf5de642c02d23f59eca1c6240 

in sql query, have following works out distance between both towns. geo being geography column

declare @s geography declare @t geography  set @s = (select geo location.cities stateid = 7 , id = 6918) -- fitzroy set @t = (select geo location.cities stateid = 7 , id = 6923) -- footscray  select @s.stdistance(@t) 

the result

6954.44911927616 

i looked @ formatting in australia go km after searching found 2 solutions 1 miles , other km

so changed select statement this

select @s.stdistance(@t)/1000  -- format km 

my result then

6.95444911927616 

when go google maps , direction request between locations provided above says 10.2km (depending on traffic)

now i'm new spatial data within sql, why different results?


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -