Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In SQL Server spatial data, a Point is a 0-dimensional object representing a single location and may contain Z (elevation) and M (measure) values.
The Point type for geography data type represents a single location where x and y represent longitud and latitude values respectively. The values for longitud and latitude are measured in degrees. Values for longitud always lie in the interval (-180, 180] and values inputted outside this range are wrapped around to fit in this range. For example, if 190 is inputted for longitude then it will be wrapped to the value -170. Values for latitude always lie in the interval [-90, 90] and values that are inputted outside this range will throw an exception.
The following example creates a geometry Point instance representing the point (3, 4) with an SRID of 0.
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POINT (3 4)', 0);
The next example creates a geometryPoint instance representing the point (3, 4) with a Z (elevation) value of 7, an M (measure) value of 2.5, and the default SRID of 0.
DECLARE @g geometry;
SET @g = geometry::Parse('POINT(3 4 7 2.5)');
The final example returns the X, Y, Z, and M values for the geometryPoint instance.
SELECT @g.STX;
SELECT @g.STY;
SELECT @g.Z;
SELECT @g.M;
Z and M values may be explicitly specified as NULL, as shown in the following example.
DECLARE @g geometry;
SET @g = geometry::Parse('POINT(3 4 NULL NULL)');
Please sign in to use this experience.
Sign in