Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE @a geometry, @b geometry, @c geometry
- SET @a = geometry::STGeomFromText('POLYGON((3 0, 3 2, 5 2, 5 0, 3 0))', 0)
- SET @b = geometry::STGeomFromText('LINESTRING(0 2, 2.5 3, 5 2)', 0)
- SET @c = geometry::STGeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0), (0.5 0.5, 1.5 0.5, 1.5 1.5, 0.5 1.5, 0.5 0.5))', 0)
- -- SELECT @a.STAsText(), @b.STAsText(), @c.STAsText()
- -- SELECT @a.STAsBinary(), @b.STAsBinary(), @c.STAsBinary()
- SELECT @a.ToString(), @b.ToString(), @c.ToString()
- SELECT @a AS geom1, 'A' AS etykieta1
- UNION ALL
- SELECT @b AS geom2, 'B'
- UNION ALL
- SELECT @c AS geom3, 'C'
- DECLARE @e geometry;
- DECLARE @f geometry;
- DECLARE @g geometry;
- DECLARE @h geometry;
- DECLARE @i geometry;
- SET @e = geometry::STGeomFromText('CIRCULARSTRING(0 0, 0 5, 5 5, 5 0, 0 0)', 0);
- SET @f = geometry::STGeomFromText('CURVEPOLYGON(CIRCULARSTRING(10 10, 10 5, 5 5, 5 10, 10 10))', 0);
- SET @g = geometry::STGeomFromText('CURVEPOLYGON(CIRCULARSTRING(0 5, 5 0, 0 -5, -5 0, 0 5), (0 5, 5 0, 0 -5, -5 0, 0 5))',0);
- SET @h = geometry::STGeomFromText('COMPOUNDCURVE(CIRCULARSTRING(10 0, 0 10, -10 0), (-10 0, 0 0))', 0);
- SET @i = geometry::STGeomFromText('CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(5 5, 0 10, -5 5), (-5 5, 5 5)))', 0);
- -- SELECT @e UNION ALL SELECT @f UNION ALL SELECT @g UNION ALL SELECT @h UNION ALL SELECT @i
- SELECT @e
- DECLARE @g geometry;
- DECLARE @f geometry;
- DECLARE @h geometry;
- SET @f = geometry::STGeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))', 0);
- SET @g = geometry::STGeomFromText('POLYGON((0 0, 1 1, 0 2 , 0 0))', 0);
- SET @h = geometry::STGeomFromText('POLYGON((3 3, 1 1, 2 3, 3 3))', 0);
- SELECT @f.STArea(), @g.STArea(), @h.STArea();
- SELECT @f.STLength(), @g.STLength(), @h.STLength();
- SELECT @f
- UNION ALL
- SELECT @g
- UNION ALL
- SELECT @h
- SELECT @f.STCentroid().ToString() AS CentroidF,
- @g.STCentroid().ToString() AS CentroidG,
- @h.STCentroid().ToString() AS CentroidH;
- SELECT @f.STCentroid().STDistance(@g.STCentroid()) AS FminG; --distance between centroids
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement