Package com.microsoft.sqlserver.jdbc
Class Geography
java.lang.Object
com.microsoft.sqlserver.jdbc.Geography
Geography datatype represents data in a round-earth coordinate system. This class will stay in this current package
for backwards compatibility.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Geography
(byte[] clr) Private constructor used for creating a Geography object from internal SQL Server format. -
Method Summary
Modifier and TypeMethodDescriptionasTextZM()
Returns the Well-Known Text (WKT) representation of the Geography object.static Geography
deserialize
(byte[] clr) Constructor for a Geography instance from an internal SQL Server format for spatial data.Get figure listReturns the latitude value.Returns the longitude value.getM()
Returns the M (measure) value of the object.Get point listGet segment listGet shape listint
getSrid()
Returns the Spatial Reference Identifier (SRID) value.getZ()
Returns the Z (elevation) value of the object.boolean
hasM()
Returns if the object contains a M (measure) value.boolean
hasZ()
Returns if the object contains a Z (elevation) value.boolean
isNull()
Returns if the Geography object is null.static Geography
Constructor for a Geography instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation.static Geography
point
(double lat, double lon, int srid) Constructor for a Geography instance that represents a Point instance from its latitude and longitude values and a Spatial Reference Identifier.byte[]
Returns the bytes that represent an internal SQL Server format of Geography type.byte[]
Returns the Open Geospatial Consortium (OGC) Well-Known Binary (WKB) representation of a Geography instance.STAsText()
Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a Geography instance.Returns the Open Geospatial Consortium (OGC) type name represented by a Geography instance.static Geography
STGeomFromText
(String wkt, int srid) Constructor for a Geography instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance.static Geography
STGeomFromWKB
(byte[] wkb) Constructor for a Geography instance from an Open Geospatial Consortium (OGC) Well-Known Binary (WKB) representation.int
Returns the number of points in the Geography object.toString()
Returns the String representation of the Geography object.
-
Constructor Details
-
Geography
Private constructor used for creating a Geography object from internal SQL Server format.- Parameters:
clr
- Internal SQL Server format provided by the user.- Throws:
SQLServerException
- if an exception occurs
-
-
Method Details
-
STGeomFromText
Constructor for a Geography instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance.- Parameters:
wkt
- Well-Known Text (WKT) provided by the user.srid
- Spatial Reference Identifier (SRID) provided by the user.- Returns:
- Geography Geography instance created from WKT and SRID
- Throws:
SQLServerException
- if an exception occurs
-
STGeomFromWKB
Constructor for a Geography instance from an Open Geospatial Consortium (OGC) Well-Known Binary (WKB) representation. Note: This method currently uses internal SQL Server format (CLR) to create a Geography instance, but in the future this will be changed to accept WKB data instead, as the SQL Server counterpart of this method (STGeomFromWKB) uses WKB. For existing users who are already using this method, consider switching to deserialize(byte) instead.- Parameters:
wkb
- Well-Known Binary (WKB) provided by the user.- Returns:
- Geography Geography instance created from WKB
- Throws:
SQLServerException
- if an exception occurs
-
deserialize
Constructor for a Geography instance from an internal SQL Server format for spatial data.- Parameters:
clr
- Internal SQL Server format provided by the user.- Returns:
- Geography Geography instance created from clr
- Throws:
SQLServerException
- if an exception occurs
-
parse
Constructor for a Geography instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation. Spatial Reference Identifier is defaulted to 4326.- Parameters:
wkt
- Well-Known Text (WKT) provided by the user.- Returns:
- Geography Geography instance created from WKT
- Throws:
SQLServerException
- if an exception occurs
-
point
Constructor for a Geography instance that represents a Point instance from its latitude and longitude values and a Spatial Reference Identifier.- Parameters:
lat
- latitudelon
- longitudesrid
- Spatial Reference Identifier value- Returns:
- Geography Geography instance
- Throws:
SQLServerException
- if an exception occurs
-
STAsText
Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a Geography instance. This text will not contain any Z (elevation) or M (measure) values carried by the instance.- Returns:
- the WKT representation without the Z and M values.
- Throws:
SQLServerException
- if an exception occurs
-
STAsBinary
public byte[] STAsBinary()Returns the Open Geospatial Consortium (OGC) Well-Known Binary (WKB) representation of a Geography instance. This value will not contain any Z or M values carried by the instance.- Returns:
- byte array representation of the Geography object.
-
serialize
public byte[] serialize()Returns the bytes that represent an internal SQL Server format of Geography type.- Returns:
- byte array representation of the Geography object.
-
hasM
public boolean hasM()Returns if the object contains a M (measure) value.- Returns:
- boolean that indicates if the object contains M value.
-
hasZ
public boolean hasZ()Returns if the object contains a Z (elevation) value.- Returns:
- boolean that indicates if the object contains Z value.
-
getLatitude
Returns the latitude value.- Returns:
- double value that represents the latitude.
-
getLongitude
Returns the longitude value.- Returns:
- double value that represents the longitude.
-
getM
Returns the M (measure) value of the object.- Returns:
- double value that represents the M value.
-
getZ
Returns the Z (elevation) value of the object.- Returns:
- double value that represents the Z value.
-
getSrid
public int getSrid()Returns the Spatial Reference Identifier (SRID) value.- Returns:
- int value of SRID.
-
isNull
public boolean isNull()Returns if the Geography object is null.- Returns:
- boolean that indicates if the object is null.
-
STNumPoints
public int STNumPoints()Returns the number of points in the Geography object.- Returns:
- int that indicates the number of points in the Geography object.
-
STGeographyType
Returns the Open Geospatial Consortium (OGC) type name represented by a Geography instance.- Returns:
- String that contains the Geography object's type name
-
asTextZM
Returns the Well-Known Text (WKT) representation of the Geography object.- Returns:
- String that contains the WKT representation of the Geography object.
-
toString
Returns the String representation of the Geography object. -
getPointList
Get point list- Returns:
- point list
-
getFigureList
Get figure list- Returns:
- figure list
-
getShapeList
Get shape list- Returns:
- shape list
-
getSegmentList
Get segment list- Returns:
- segment list
-