Skip to content

Commit 35aa523

Browse files
committed
more
1 parent c2d4c4a commit 35aa523

21 files changed

Lines changed: 312 additions & 347 deletions

docs/t-sql/spatial-geography/unionaggregate-geography-data-type.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,15 @@ UnionAggregate ( geography_operand )
5252
## Examples
5353
The following example performs a `UnionAggregate` on a set of **geography** location points within a city.
5454

55-
`USE AdventureWorks2012`
56-
57-
`GO`
58-
59-
`SELECT City,`
60-
61-
`geography::UnionAggregate(SpatialLocation) AS SpatialLocation`
62-
63-
`FROM Person.Address`
64-
65-
`WHERE PostalCode LIKE('981%')`
66-
67-
`GROUP BY City;`
55+
```
56+
USE AdventureWorks2012
57+
GO
58+
SELECT City,
59+
geography::UnionAggregate(SpatialLocation) AS SpatialLocation
60+
FROM Person.Address
61+
WHERE PostalCode LIKE('981%')
62+
GROUP BY City;
63+
```
6864

6965
## See Also
7066
[Extended Static Geography Methods](../../t-sql/spatial-geography/extended-static-geography-methods.md)

docs/t-sql/spatial-geometry/bufferwithcurves-geometry-data-type.md

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -75,75 +75,81 @@ SQL Server return type: **geometry**
7575
### A. Calling BufferWithCurves() with a parameter value < 0 on one dimensional geometry instance
7676
The following example returns an empty `GeometryCollection` instance:
7777

78-
`DECLARE @g geometry= 'LINESTRING(3 4, 8 11)';`
79-
80-
`SELECT @g.BufferWithCurves(-1).ToString();`
78+
```
79+
DECLARE @g geometry= 'LINESTRING(3 4, 8 11)';
80+
SELECT @g.BufferWithCurves(-1).ToString();
81+
```
8182

8283
### B. Calling BufferWithCurves() with a parameter value < 0 on a two dimensional geometry instance
8384
The following example returns a `CurvePolygon` instance with a negative buffer:
8485

85-
`DECLARE @g geometry = 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 4, 4 0, 8 4), (8 4, 0 4)))';`
86-
87-
`SELECT @g.BufferWithCurves(-1).ToString()`
86+
```
87+
DECLARE @g geometry = 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 4, 4 0, 8 4), (8 4, 0 4)))';
88+
SELECT @g.BufferWithCurves(-1).ToString()
89+
```
8890

8991
### C. Calling BufferWithCurves() with a parameter value < 0 that returns an empty GeometryCollection
9092
The following example shows what occurs when the *distance* parameter equals -2:
9193

92-
`DECLARE @g geometry = 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 4, 4 0, 8 4), (8 4, 0 4)))';`
93-
94-
`SELECT @g.BufferWithCurves(-2).ToString();`
94+
```
95+
DECLARE @g geometry = 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 4, 4 0, 8 4), (8 4, 0 4)))';
96+
SELECT @g.BufferWithCurves(-2).ToString();
97+
```
9598

9699
This **SELECT** statement returns `GEOMETRYCOLLECTION EMPTY`
97100

98101
### D. Calling BufferWithCurves() with a parameter value = 0
99102
The following example returns a copy of the calling **geometry** instance:
100103

101-
`DECLARE @g geometry = 'LINESTRING(3 4, 8 11)';`
102-
103-
`SELECT @g.BufferWithCurves(0).ToString();`
104+
```
105+
DECLARE @g geometry = 'LINESTRING(3 4, 8 11)';
106+
SELECT @g.BufferWithCurves(0).ToString();
107+
```
104108

105109
### E. Calling BufferWithCurves() with a non-zero parameter value that is extremely small
106110
The following example also returns a copy of the calling **geometry** instance:
107111

108-
`DECLARE @g geometry = 'LINESTRING(3 4, 8 11)';`
109-
110-
`DECLARE @distance float = 1e-20;`
111-
112-
`SELECT @g.BufferWithCurves(@distance).ToString();`
112+
```
113+
DECLARE @g geometry = 'LINESTRING(3 4, 8 11)';
114+
DECLARE @distance float = 1e-20;
115+
SELECT @g.BufferWithCurves(@distance).ToString();
116+
```
113117

114118
### F. Calling BufferWithCurves() with a parameter value > 0
115119
The following example returns a `CurvePolygon` instance:
116120

117-
`DECLARE @g geometry= 'LINESTRING(3 4, 8 11)';`
118-
119-
`SELECT @g.BufferWithCurves(2).ToString();`
121+
```
122+
DECLARE @g geometry= 'LINESTRING(3 4, 8 11)';
123+
SELECT @g.BufferWithCurves(2).ToString();
124+
```
120125

121126
### G. Passing a valid string parameter
122127
The following example returns the same `CurvePolygon` instance as mentioned earlier, but a string parameter is passed to the method:
123128

124-
`DECLARE @g geometry= 'LINESTRING(3 4, 8 11)';`
125-
126-
`SELECT @g.BufferWithCurves('2').ToString();`
129+
```
130+
DECLARE @g geometry= 'LINESTRING(3 4, 8 11)';
131+
SELECT @g.BufferWithCurves('2').ToString();
132+
```
127133

128134
### H. Passing an invalid string parameter
129135
The following example will throw an error:
130136

131-
`DECLARE @g geometry = 'LINESTRING(3 4, 8 11)'`
132-
133-
`SELECT @g.BufferWithCurves('a').ToString();`
137+
```
138+
DECLARE @g geometry = 'LINESTRING(3 4, 8 11)'
139+
SELECT @g.BufferWithCurves('a').ToString();
140+
```
134141

135142
Note that the previous two examples passed a string literal to the `BufferWithCurves()` method. The first example works because the string literal can be converted to a numeric value. However, the second example throws an `ArgumentException`.
136143

137144
### I. Calling BufferWithCurves() on MultiPoint instance
138145
The following example returns two `GeometryCollection` instances and one `CurvePolygon` instance:
139146

140-
`DECLARE @g geometry = 'MULTIPOINT((1 1),(1 4))';`
141-
142-
`SELECT @g.BufferWithCurves(1).ToString();`
143-
144-
`SELECT @g.BufferWithCurves(1.5).ToString();`
145-
146-
`SELECT @g.BufferWithCurves(1.6).ToString();`
147+
```
148+
DECLARE @g geometry = 'MULTIPOINT((1 1),(1 4))';
149+
SELECT @g.BufferWithCurves(1).ToString();
150+
SELECT @g.BufferWithCurves(1.5).ToString();
151+
SELECT @g.BufferWithCurves(1.6).ToString();
152+
```
147153

148154
The first two **SELECT** statements return a `GeometryCollection` instance because the parameter *distance* is less than or equal to 1/2 the distance between the two points (1 1) and (1 4). The third **SELECT** statement returns a `CurvePolygon` instance because the buffered instances of the two points (1 1) and (1 4) overlap.
149155

docs/t-sql/spatial-geometry/collectionaggregate-geometry-data-type.md

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,20 @@ CollectionAggregate ( geometry_operand )
5252
## Examples
5353
The following example returns a `GeometryCollection` instance that contains a `CurvePolygon` and a `Polygon`.
5454

55-
`-- Setup table variable for CollectionAggregate example`
56-
57-
`DECLARE @Geom TABLE`
58-
59-
`(`
60-
61-
`shape geometry,`
62-
63-
`shapeType nvarchar(50)`
64-
65-
`)`
66-
67-
`INSERT INTO @Geom(shape,shapeType) VALUES('CURVEPOLYGON(CIRCULARSTRING(2 3, 4 1, 6 3, 4 5, 2 3))', 'Circle'),`
68-
69-
`('POLYGON((1 1, 4 1, 4 5, 1 5, 1 1))', 'Rectangle');`
70-
71-
`-- Perform CollectionAggregate on @Geom.shape column`
72-
73-
`SELECT geometry::CollectionAggregate(shape).ToString()`
74-
75-
`FROM @Geom;`
55+
`
56+
```
57+
-- Setup table variable for CollectionAggregate example`
58+
DECLARE @Geom TABLE
59+
(
60+
shape geometry,
61+
shapeType nvarchar(50)
62+
)
63+
INSERT INTO @Geom(shape,shapeType) VALUES('CURVEPOLYGON(CIRCULARSTRING(2 3, 4 1, 6 3, 4 5, 2 3))', 'Circle'),
64+
('POLYGON((1 1, 4 1, 4 5, 1 5, 1 1))', 'Rectangle');
65+
-- Perform CollectionAggregate on @Geom.shape column
66+
SELECT geometry::CollectionAggregate(shape).ToString()
67+
FROM @Geom;
68+
```
7669

7770
## See Also
7871
[Extended Static Geometry Methods](../../t-sql/spatial-geometry/extended-static-geometry-methods.md)

docs/t-sql/spatial-geometry/convexhullaggregate-geometry-data-type.md

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,19 @@ ConvexHullAggregate ( geometry_operand )
5252
## Examples
5353
The following example returns a convex hull of the set of geometry objects in a table variable column.
5454

55-
`-- Setup table variable for ConvexHullAggregate example`
56-
57-
`DECLARE @Geom TABLE`
58-
59-
`(`
60-
61-
`shape geometry,`
62-
63-
`shapeType nvarchar(50)`
64-
65-
`)`
66-
67-
`INSERT INTO @Geom(shape,shapeType) VALUES('CURVEPOLYGON(CIRCULARSTRING(2 3, 4 1, 6 3, 4 5, 2 3))', 'Circle'),`
68-
69-
`('POLYGON((1 1, 4 1, 4 5, 1 5, 1 1))', 'Rectangle');`
70-
71-
`-- Perform ConvexHullAggregate on @Geom.shape column`
72-
73-
`SELECT geometry::ConvexHullAggregate(shape).ToString()`
74-
75-
`FROM @Geom;`
55+
```
56+
-- Setup table variable for ConvexHullAggregate example
57+
DECLARE @Geom TABLE
58+
(
59+
shape geometry,
60+
shapeType nvarchar(50)
61+
)
62+
INSERT INTO @Geom(shape,shapeType) VALUES('CURVEPOLYGON(CIRCULARSTRING(2 3, 4 1, 6 3, 4 5, 2 3))', 'Circle'),
63+
('POLYGON((1 1, 4 1, 4 5, 1 5, 1 1))', 'Rectangle');
64+
-- Perform ConvexHullAggregate on @Geom.shape column
65+
SELECT geometry::ConvexHullAggregate(shape).ToString()
66+
FROM @Geom;
67+
```
7668

7769
## See Also
7870
[Extended Static Geometry Methods](../../t-sql/spatial-geometry/extended-static-geometry-methods.md)

docs/t-sql/spatial-geometry/curvetolinewithtolerance-geometry-data-type.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,45 +72,46 @@ Returns a polygonal approximation of a **geometry** instance that contains circu
7272
### A. Using different tolerance values on a CircularString instance
7373
The following example shows how setting the tolerance affects the `LineString`instance returned from a `CircularString` instance:
7474

75-
`DECLARE @g geometry;`
76-
77-
`SET @g = geometry::Parse('CIRCULARSTRING(0 0, 1 2.1082, 3 6.3246, 0 7, -3 6.3246, -1 2.1082, 0 0)');`
78-
79-
`SELECT @g.CurveToLineWithTolerance(0.1,0).STNumPoints(), @g.CurveToLineWithTolerance(0.01, 0).STNumPoints();`
75+
```
76+
DECLARE @g geometry;
77+
SET @g = geometry::Parse('CIRCULARSTRING(0 0, 1 2.1082, 3 6.3246, 0 7, -3 6.3246, -1 2.1082, 0 0)');
78+
SELECT @g.CurveToLineWithTolerance(0.1,0).STNumPoints(), @g.CurveToLineWithTolerance(0.01, 0).STNumPoints();
79+
```
8080

8181
### B. Using the method on a MultiLineString instance containing one LineString
8282
The following example shows what is returned from a `MultiLineString` instance that only contains one `LineString` instance:
8383

84-
`DECLARE @g geometry;`
85-
86-
`SET @g = geometry::Parse('MULTILINESTRING((1 3, 4 8, 6 9))');`
87-
88-
`SELECT @g.CurveToLineWithTolerance(0.1,0).ToString();`
84+
```
85+
DECLARE @g geometry;
86+
SET @g = geometry::Parse('MULTILINESTRING((1 3, 4 8, 6 9))');
87+
SELECT @g.CurveToLineWithTolerance(0.1,0).ToString();
88+
```
8989

9090
### C. Using the method on a MultiLineString instance containing multiple LineStrings
9191
The following example shows what is returned from a `MultiLineString` instance that contains more than one `LineString` instance:
9292

93-
`DECLARE @g geometry;`
94-
95-
`SET @g = geometry::Parse('MULTILINESTRING((1 3, 4 8, 6 9),(4 4, 9 18))');`
96-
97-
`SELECT @g.CurveToLineWithTolerance(0.1,0).ToString();`
93+
```
94+
DECLARE @g geometry;
95+
SET @g = geometry::Parse('MULTILINESTRING((1 3, 4 8, 6 9),(4 4, 9 18))');
96+
SELECT @g.CurveToLineWithTolerance(0.1,0).ToString();
97+
```
9898

9999
### D. Setting relative to true for an invoking CurvePolygon instance
100100
The following example uses a `CurvePolygon` instance to call `CurveToLineWithTolerance()` with *relative* set to true:
101101

102-
`DECLARE @g geometry = 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 4, 4 0, 8 4), (8 4, 0 4)))';`
103-
104-
`SELECT @g.CurveToLineWithTolerance(.5,1).ToString();`
102+
```
103+
DECLARE @g geometry = 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 4, 4 0, 8 4), (8 4, 0 4)))';
104+
SELECT @g.CurveToLineWithTolerance(.5,1).ToString();
105+
```
105106

106107
### E. Using the method on a GeometryCollection instance
107108
The following example calls `CurveToLineWithTolerance()` on a `GeometryCollection` that contains a two-dimensional `CurvePolygon` instance and a one-dimensional `CircularString` instance. `CurveToLineWithTolerance()` converts both circular arc segment types to line segment types and returns them in a `GeometryCollection` type.
108109

109-
`DECLARE @g geometry;`
110-
111-
`SET @g = geometry::Parse('GEOMETRYCOLLECTION(CURVEPOLYGON( COMPOUNDCURVE(CIRCULARSTRING(0 2, 2 0, 4 2), (4 2, 0 2))), CIRCULARSTRING(4 4, 8 6, 9 5))');`
112-
113-
`SELECT @g.CurveToLineWithTolerance(0.1,0).STNumPoints(), @g.CurveToLineWithTolerance(0.1, 0).ToString();`
110+
```
111+
DECLARE @g geometry;
112+
SET @g = geometry::Parse('GEOMETRYCOLLECTION(CURVEPOLYGON( COMPOUNDCURVE(CIRCULARSTRING(0 2, 2 0, 4 2), (4 2, 0 2))), CIRCULARSTRING(4 4, 8 6, 9 5))');
113+
SELECT @g.CurveToLineWithTolerance(0.1,0).STNumPoints(), @g.CurveToLineWithTolerance(0.1, 0).ToString();
114+
```
114115

115116
## See Also
116117
[CurveToLineWithTolerance &#40;geography Data Type&#41;](../../t-sql/spatial-geography/curvetolinewithtolerance-geography-data-type.md)

docs/t-sql/spatial-geometry/envelopeaggregate-geometry-data-type.md

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,19 @@ EnvelopeAggregate ( geometry_operand )
5252
## Examples
5353
The following example returns a bounding box for a set of objects in a table variable column.
5454

55-
`-- Setup table variable for EnvelopeAggregate example`
56-
57-
`DECLARE @Geom TABLE`
58-
59-
`(`
60-
61-
`shape geometry,`
62-
63-
`shapeType nvarchar(50)`
64-
65-
`)`
66-
67-
`INSERT INTO @Geom(shape,shapeType) VALUES('CURVEPOLYGON(CIRCULARSTRING(2 3, 4 1, 6 3, 4 5, 2 3))', 'Circle'),`
68-
69-
`('POLYGON((1 1, 4 1, 4 5, 1 5, 1 1))', 'Rectangle');`
70-
71-
`-- Perform EnvelopeAggregate on @Geom.shape column`
72-
73-
`SELECT geometry::EnvelopeAggregate(shape).ToString()`
74-
75-
`FROM @Geom;`
55+
```
56+
-- Setup table variable for EnvelopeAggregate example
57+
DECLARE @Geom TABLE
58+
(
59+
shape geometry,
60+
shapeType nvarchar(50)
61+
)
62+
INSERT INTO @Geom(shape,shapeType) VALUES('CURVEPOLYGON(CIRCULARSTRING(2 3, 4 1, 6 3, 4 5, 2 3))', 'Circle'),
63+
('POLYGON((1 1, 4 1, 4 5, 1 5, 1 1))', 'Rectangle');
64+
-- Perform EnvelopeAggregate on @Geom.shape column
65+
SELECT geometry::EnvelopeAggregate(shape).ToString()
66+
FROM @Geom;
67+
```
7668

7769
## See Also
7870
[Extended Static Geometry Methods](../../t-sql/spatial-geometry/extended-static-geometry-methods.md)

docs/t-sql/spatial-geometry/mindbcompatibilitylevel-geometry-data-type.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,24 @@ Returns the minimum database compatibility level that recognizes the **geometry*
4444
### A. Testing CircularString type for compatibility with compatibility level 110
4545
The following example tests a `CircularString` instance for compatibility with an earlier version of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]:
4646

47-
`DECLARE @g geometry = 'CIRCULARSTRING(3 4, 8 9, 5 6)';`
48-
49-
`IF @g.MinDbCompatibilityLevel() <= 110`
50-
51-
`BEGIN`
52-
53-
`SELECT @g.ToString();`
54-
55-
`END`
47+
```
48+
DECLARE @g geometry = 'CIRCULARSTRING(3 4, 8 9, 5 6)';
49+
IF @g.MinDbCompatibilityLevel() <= 110
50+
BEGIN
51+
SELECT @g.ToString();
52+
END
53+
```
5654

5755
### B. Testing LineString type for compatibility with compatibility level 100
5856
The following example tests a `LineString` instance for compatibility with [!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)]:
5957

60-
`DECLARE @g geometry = 'LINESTRING(3 4, 8 9, 5 6)';`
61-
62-
`IF @g.MinDbCompatibilityLevel() <= 100`
63-
64-
`BEGIN`
65-
66-
`SELECT @g.ToString();`
67-
68-
`END`
58+
```
59+
DECLARE @g geometry = 'LINESTRING(3 4, 8 9, 5 6)';
60+
IF @g.MinDbCompatibilityLevel() <= 100
61+
BEGIN
62+
SELECT @g.ToString();
63+
END
64+
```
6965

7066
## See Also
7167
[ALTER DATABASE Compatibility Level &#40;Transact-SQL&#41;](../../t-sql/statements/alter-database-transact-sql-compatibility-level.md)

0 commit comments

Comments
 (0)