0

If I have the point POINT (-75.45454 25.12345 1024 ) in a geometry or geography column in SQL Server, but render it with STAsText() I lose the Z dimension.

SELECT geography::STGeomFromText('POINT (-75.45454 25.12345 1024 )', 4326).STAsText() AS point

POINT (-75.45454 25.12345)

How do I get the full WKT? There is nothing listed in OGC Methods on Geography Instances.

2

The answer is AsTextZM (), which is listed on the Extended Methods on Geography.

WITH geo AS (
    SELECT geography::STGeomFromText('POINT (-75.45454 25.12345 1024 )', 4326) AS point)
SELECT 
    geo.point.AsTextZM() AS WTKFull,
    geo.point.STAsText() AS WTK2d
FROM geo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.