Forum Discussion
Tippelschniff175
Mar 09, 2020Copper Contributor
SHORTEST DISTANCE
Hi all, I am looking to create a function that i can then use on two tables. The first table with UPRN (unique premise ref.), Latitude and Longitude coordinates, geolocation and type. The second ta...
parksuseong
Mar 17, 2020Copper Contributor
Do you simply mean straight distance? I think I can use STDistance function.
DECLARE @g geography;
DECLARE @h geography;
SET @g = geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326);
SET @h = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326);
SELECT @g.STDistance(@h);
https://docs.microsoft.com/nl-be/sql/t-sql/spatial-geography/stdistance-geography-data-type?view=sql-server-2016