I have a following piece of code

DECLARE @g geometry;
DECLARE @borders geography;   
SET @g = geometry::STGeomFromText('SOME WKT', 0); 
SET @borders = GEOGRAPHY::STGeomFromText(@g.MakeValid().STAsText(),4326)
SELECT @borders;

Since it's too long to paste it here, WKT Can be fond at this link: https://justpaste.it/6qw0a

Can someone please explain to me, why it displays well when I draw it as geometry, but when I try to draw it as a geography, it displays entire world instead of a small group of islands.

Here's the screenshot: enter image description here


1 Answer 1

DECLARE @geom GEOMETRY = 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))';
DECLARE @geog GEOGRAPHY = @geom.MakeValid().STUnion(@geom.STStartPoint()).STAsText()

This topic had the answer to my question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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