In SQL Server geo-spatial I can't run a STBuffer
for MULTIPOLYGONS
.
DECLARE @g geography = geography::STMPolyFromText('MULTIPOLYGON(((1 1, 1 -1, -1 -1, -1 1, 1 1)),((1 1, 3 1, 3 3, 1 1)))', 4326);
SELECT @g -- no problem to run
SELECT @g.ToString() -- no problem to run
SELECT @g.STBuffer(1).ToString(); -- error
The error returned is:
Msg 6522, Level 16, State 1, Line 64
A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":System.ArgumentException: 24144: This operation cannot be completed because the instance is not valid. Use MakeValid to convert the instance to a valid instance. Note that MakeValid may cause the points of a geometry instance to shift slightly. System.ArgumentException: