SqlGeometry Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before itâ€™s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The SqlGeometry type represents data in a Euclidean (flat) coordinate system.
[Microsoft.SqlServer.Server.SqlUserDefinedType(Microsoft.SqlServer.Server.Format.UserDefined, IsByteOrdered=false, IsFixedLength=false, MaxByteSize=1)]
[System.CLSCompliant(true)]
[System.Serializable]
public sealed class SqlGeometry : Microsoft.SqlServer.Server.IBinarySerialize, Microsoft.SqlServer.Types.ISqlSpatialGridIndexable, System.Data.SqlTypes.INullable
type SqlGeometry = class
interface INullable
interface IBinarySerialize
interface ISqlSpatialGridIndexable
Public NotInheritable Class SqlGeometry
Implements IBinarySerialize, INullable, ISqlSpatialGridIndexable
 Inheritance

SqlGeometry
 Attributes
 Implements
Constructors
SqlGeometry() 
Initializes a new instance of the SqlGeometry class. 
Properties
HasM 
Returns true if at least one point in a spatial object contains value M; otherwise returns false. This property is readonly. 
HasZ 
Returns true if at least one point in a spatial object contains value Z; otherwise returns false. This property is readonly. 
IsNull 
Gets a value that indicates whether the SqlGeometry object is null. 
M 
Gets the M (measure) value of the SqlGeometry instance. The semantics of the measure value are userdefined. 
Null 
Gets a readonly property providing a null instance of the SqlGeometry type. 
STSrid 
Gets or sets an integer that represents the Spatial Reference Identifier (SRID) of the instance. 
STX 
Gets the Xcoordinate property of a Point instance. 
STY 
Gets the Ycoordinate property of a Point instance. 
Z 
Gets the Z (elevation) value of the instance. The semantics of the elevation value are userdefined. 
Methods
AsBinaryZM() 
Returns the Elevation and Measure as a binary. 
AsGml() 
Returns the Geography Markup Language (GML) representation of a SqlGeometry instance. 
AsTextZM() 
Returns the Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation of a SqlGeometry instance, augmented with any Z (elevation) and M (measure) values carried by the instance. 
BufferWithCurves(Double) 
Buffers the geometry objects with curves. 
BufferWithTolerance(Double, Double, Boolean) 
Returns a geometric object that represents the union of all point values whose distance from a SqlGeometry instance is less than or equal to a specified value, allowing for a specified tolerance. 
CurveToLineWithTolerance(Double, Boolean) 
Returns a polygonal approximation of a SqlGeometry instance that contains circular arc segments. 
Deserialize(SqlBytes) 
Returns a constructed SqlGeometry from an internal SQL Server format for spatial data. 
Filter(SqlGeometry) 
Offers a fast, indexonly intersection method to determine if a SqlGeometry instance intersects another SqlGeometry instance, assuming an index is available. 
GeomFromGml(SqlXml, Int32) 
Constructs a SqlGeometry instance given a representation in the SQL Server subset of the Geography Markup Language (GML). 
InstanceOf(String) 
Tests if the SqlGeometry instance is the same as the specified type. 
IsValidDetailed() 
Returns a message to help identify validity issues with a spatial object. 
MakeValid() 
Converts an invalid SqlGeometry instance into a SqlGeometry instance with a valid Open Geospatial Consortium (OGC) type. 
MinDbCompatibilityLevel() 
Returns the minimum database compatibility that accepts the SqlGeometry type. 
Parse(SqlString) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation. 
Point(Double, Double, Int32) 
Constructs a SqlGeometry instance that represents a Point instance from its X and Y values and an SRID. 
Populate(IGeometrySink) 
Obsolete.
Applies a geometry type call sequence to an IGeometrySink object. The call sequence is a sequential set of figures, lines, and points. SqlGeometry 
Populate(IGeometrySink110) 
Applies a geometry type call sequence to IGeometrySink object. 
Read(BinaryReader) 
Reads a binary representation of a geometry type into a SqlGeometry object. SqlGeometry 
Reduce(Double) 
Returns an approximation of the given SqlGeometry instance produced by running the DouglasPeucker algorithm on the instance with the given tolerance. 
Serialize() 
Returns the bytes that represent an internal SQL Server format of SqlGeometry type. 
ShortestLineTo(SqlGeometry) 
Returns the shortest distance between the two SqlGeometryinstances. 
STArea() 
Returns the total surface area of a SqlGeometry instance. 
STAsBinary() 
Returns the Open Geospatial Consortium (OGC) WellKnown Binary (WKB) representation of a SqlGeometry instance. This value will not contain any Z or M values carried by the instance. 
STAsText() 
Returns the Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation of a SqlGeometry instance. This text will not contain any Z (elevation) or M (measure) values carried by the instance. 
STBoundary() 
Returns the boundary of a SqlGeometry instance. 
STBuffer(Double) 
Returns a geometric object that represents the union of all points whose distance from a SqlGeometry instance is less than or equal to a specified value. 
STCentroid() 
Returns the geometric center of a SqlGeometry instance consisting of one or more polygons. 
STContains(SqlGeometry) 
Specifies whether the calling SqlGeometry instance completely contains another SqlGeometry. 
STConvexHull() 
Returns an object that represents the convex hull of a SqlGeometry instance. 
STCrosses(SqlGeometry) 
Determines whether the calling SqlGeometry instance crosses the specified SqlGeometry instance. 
STCurveN(Int32) 
Returns the curve specified from a SqlGeometry instance that is a LineString, CircularString, or CompoundCurve. 
STCurveToLine() 
Returns a polygonal approximation of a SqlGeometry instance that contains circular arc segments. 
STDifference(SqlGeometry) 
Returns an object that represents the points from one SqlGeometry instance that do not lie within another SqlGeometry instance. 
STDimension() 
Returns the maximum dimension of a SqlGeometry instance. 
STDisjoint(SqlGeometry) 
Determines whether the calling SqlGeometry instance is disjointed when compared against the specified SqlGeometry. 
STDistance(SqlGeometry) 
Returns the shortest distance between a point in a SqlGeometry instance and a point in the specified SqlGeometry instance. 
STEndPoint() 
Returns the end point of a SqlGeometry instance. 
STEnvelope() 
Returns the minimum axisaligned bounding rectangle of the instance. 
STEquals(SqlGeometry) 
Determines whether the specified SqlGeometry has a point set identical to the calling SqlGeometry. 
STExteriorRing() 
Returns the exterior ring of a SqlGeometry instance that is a polygon. 
STGeomCollFromText(SqlChars, Int32) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance. 
STGeomCollFromWKB(SqlBytes, Int32) 
Returns a SqlGeometry collection instance from an Open Geospatial Consortium (OGC) WellKnown Binary (WKB) representation. 
STGeometryN(Int32) 
Returns the specified SqlGeometry in a SqlGeometry collection. 
STGeometryType() 
Returns the Open Geospatial Consortium (OGC) type name represented by a geometry instance. SqlGeometry 
STGeomFromText(SqlChars, Int32) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance. 
STGeomFromWKB(SqlBytes, Int32) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Binary (WKB) representation. 
STInteriorRingN(Int32) 
Returns the specified interior ring of a Polygon SqlGeometry instance. 
STIntersection(SqlGeometry) 
Returns an object that represents the points where a SqlGeometry instance intersects another SqlGeometry instance. 
STIntersects(SqlGeometry) 
Determines whether the calling SqlGeometry instance intersects another SqlGeometry. 
STIsClosed() 
Determines whether the start and end points of the calling SqlGeometry are the same. 
STIsEmpty() 
Indicates whether the calling SqlGeometry instance is empty. 
STIsRing() 
Determines whether the calling SqlGeometry instance is a ring. 
STIsSimple() 
Determines whether the calling SqlGeometry instance is simple. 
STIsValid() 
Determines whether the SqlGeometry instance is wellformed. 
STLength() 
Returns the total length of the elements in a SqlGeometry instance. 
STLineFromText(SqlChars, Int32) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance. 
STLineFromWKB(SqlBytes, Int32) 
Returns a SqlGeometry LineString instance from an Open Geospatial Consortium (OGC) WellKnown Binary (WKB) representation. 
STMLineFromText(SqlChars, Int32) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance. 
STMLineFromWKB(SqlBytes, Int32) 
Returns a SqlGeometry MultiLineString instance from an Open Geospatial Consortium (OGC) WellKnown Binary (WKB) representation. 
STMPointFromText(SqlChars, Int32) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance. 
STMPointFromWKB(SqlBytes, Int32) 
Returns a SqlGeometry Point instance from an Open Geospatial Consortium (OGC) WellKnown Binary (WKB) representation. 
STMPolyFromText(SqlChars, Int32) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation with any Z (elevation) and M (measure) values carried by the instance. 
STMPolyFromWKB(SqlBytes, Int32) 
Returns a SqlGeometry MultiPolygon instance from an Open Geospatial Consortium (OGC) WellKnown Binary (WKB) representation. 
STNumCurves() 
Returns the number of curves in a onedimensional SqlGeometry instance. 
STNumGeometries() 
Returns the number of SqlGeometry that comprise a SqlGeometry instance. 
STNumInteriorRing() 
Returns the number of interior rings of a Polygon SqlGeometry instance. 
STNumPoints() 
Returns the sum of the number of points in each of the figures in a SqlGeometry instance. 
STOverlaps(SqlGeometry) 
Determines whether the specified SqlGeometry overlaps the current SqlGeometry. 
STPointFromText(SqlChars, Int32) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance. 
STPointFromWKB(SqlBytes, Int32) 
Returns a SqlGeometry Point instance from an Open Geospatial Consortium (OGC) WellKnown Binary (WKB) representation. 
STPointN(Int32) 
Returns a specified point in a SqlGeometry instance. 
STPointOnSurface() 
Returns an arbitrary point located within the interior of a SqlGeometry instance. 
STPolyFromText(SqlChars, Int32) 
Returns a SqlGeometry instance from an Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance. 
STPolyFromWKB(SqlBytes, Int32) 
Returns a SqlGeometry Polygon instance from an Open Geospatial Consortium (OGC) WellKnown Binary (WKB) representation. 
STRelate(SqlGeometry, String) 
Determines whether the calling SqlGeometry is related to the specified SqlGeometry. 
STStartPoint() 
Returns the start point of a SqlGeometry instance. 
STSymDifference(SqlGeometry) 
Returns an object that represents all points that are either in one SqlGeometry instance or another SqlGeometry instance, but not those points that lie in both instances. 
STTouches(SqlGeometry) 
Determines whether the specified SqlGeometry touches the current SqlGeometry. 
STUnion(SqlGeometry) 
Returns an object that represents the union of a SqlGeometry instance with another SqlGeometry instance. 
STWithin(SqlGeometry) 
Determines whether the current SqlGeometry is completely within the specified SqlGeometry instance. 
ToString() 
Returns the Open Geospatial Consortium (OGC) WellKnown Text (WKT) representation of a SqlGeometry instance augmented with any Z (elevation) and M (measure) values carried by the instance. 
Write(BinaryWriter) 
Writes a SqlGeometry instance to a binary stream. SqlGeometry 
Explicit Interface Implementations
ISqlSpatialGridIndexable.BufferForDistanceQuery(Double, Boolean) 
Returns the buffer for distance query for the SQL Geometry. 
ISqlSpatialGridIndexable.GetBoundingBoxCorners(Double, Double, Double, Double) 
Returns a value for the bounding box corners for the SQL Geometry. 
ISqlSpatialGridIndexable.GetGridCoverage(Boolean, Double, Double, Double, Double, Double, Double, Int32, Int32, Boolean[,], Boolean[,], Int32, Int32, Boolean, Boolean) 
Returns the grid coverage of the SQL Geometry. 
ISqlSpatialGridIndexable.InteriorBufferForDistanceQuery(Double) 
Gets the interior buffer for distance query for the SQL Geometry. 