DECLARE @geographyData geography;
//Convert wkt to geography
SET @geographyData = geography::Parse('LINESTRING(-132.360 50.657, -120.340 47.659)');
//Convert back to wkt from geography
(1) @geographyData.ToString();
(2) @geographyData.STAsText();
(1) and (2) giving me same result that is LINESTRING (-132.36 50.657, -120.340 47.659). What is the difference between ToString() and STAsText()?
Thanks.
According to the docs, ToString()
returns the value representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.
However, the STAsTEXT()
function text will not contain any Z (elevation) or M (measure) values carried by the instance.
There does seem to be some overlap in these SQL Geography functions.