Saturday, February 25, 2012 3:32 AM
Im a beginner in spatial data. So, I know how to draw complex polygone with hole like
DECLARE @g GEOMETRY SET @g = 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0), (1 1, 4 5, 4 1, 1 1))' SELECT @g
but how to draw circle into circle like donut ??
Saturday, February 25, 2012 7:58 AMAnswerer
You declare it exactly the same way - with the exterior ring (the outside of the circle) listed first, and then the inner ring (the "hole") listed second.
SQL Server 2008/R2 doesn't support truly curved geometries (but then again neither does the Google Maps example you've given). You can create approximate "circular" n-sided polygons around a point using STBuffer(), like this:
DECLARE @Centre geography = 'POINT(151.2 -33.9)'; --Sydney, Australia DECLARE @RadiusOfCircle float = 150000; --150km DECLARE @RadiusOfHole float = 70000; --70km -- Create a Doughnut polygon by subtracting hole from the circle SELECT @Centre.STBuffer(@RadiusOfCircle).STDifference(@Centre.STBuffer(@RadiusOfHole));
Or, if you're using SQL Server 2012, you can use the BufferWithCurves() method to create CurvePolygon of the same.
twitter: @alastaira blog: http://alastaira.wordpress.com/