# Constructing geometry Instances

You can construct instances of the geometry spatial data type by inputting data either in Well-Known Text (WKT) or Well-Known Binary (WKB) format.

The geometry data type provides several built-in methods that generate a geometry from the Open Geospatial Consortium (OGC) WKT representation. The WKT standard is a text string that allows geometry data to be exchanged in textual form.

#### To construct any type of geometry instance from WKT input

#### To construct a geometry Point instance from WKT input

#### To construct a geometry MultiPoint instance from WKT input

#### To construct a geometry LineString instance from WKT input

#### To construct a geometry MultiLineString instance from WKT input

#### To construct a geometry Polygon instance from WKT input

#### To construct a geometry MultiPolygon instance from WKT input

#### To construct a geometry GeometryCollection instance from WKT input

WKB is a binary format specified by the Open Geospatial Consortium (OGC) that permits geometry data to be exchanged between a client application and an SQL database. The following functions accept WKB input to construct geometries:

#### To construct any type of geometry instance from WKB input

#### To construct a geometry Point instance from WKB input

#### To construct a geometry MultiPoint instance from WKB input

#### To construct a geometry LineString instance from WKB input

#### To construct a geometry MultiLineString instance from WKB input

#### To construct a geometry Polygon instance from WKB input

#### To construct a geometry MultiPolygon instance from WKB input

#### To construct a geometry GeometryCollection instance from WKB input

You can use the following methods to return either the WKT or WKB format of a geometry instance:

To return the WKT representation of a geometry instance

To return the WKT representation of a geometry instance including any Z and M values

To return the WKB representation of a geometry instance

To return a GML representation of a geometry instance

Once a geometry instance is constructed, you can use the following methods to determine if it is well-formed, return the instance type, or, if it is a collection instance, return a specific geometry instance.

To return the instance type of a geometry

To determine if a geometry is a given instance type

To determine if a geometry instance is well-formed for its instance type

To convert a geometry instance to a well-formed geometry instance with an instance type

To return the number of geometries in a geometry collection instance

To return a specific geometry in a geometry collection instance