What Is WKT?
WKT (Well-Known Text) is a compact text format for representing geometry objects. It is the standard geometry format used by spatial databases like PostGIS, Oracle Spatial, and SQL Server. WKT represents only geometry — it does not include properties or feature metadata like GeoJSON does.
How the Conversion Works
Each geometry in your GeoJSON is converted to its WKT equivalent. For FeatureCollections with multiple features, each geometry is output on its own line. Properties are not included since WKT is a geometry-only format.
WKT geometry type mapping:
WKTPoint → POINT (lon lat)
LineString → LINESTRING (lon lat, lon lat, ...)
Polygon → POLYGON ((lon lat, lon lat, ...))
MultiPoint → MULTIPOINT ((lon lat), (lon lat), ...)Common Use Cases
- Inserting geometries into PostGIS using SQL INSERT statements
- Passing geometries to spatial SQL functions like
ST_IntersectsorST_Buffer - Sharing geometries in contexts where JSON is not supported
- Debugging spatial queries by inspecting geometry text
SQLINSERT INTO locations (name, geom)
VALUES ('Empire State', ST_GeomFromText('POINT (-73.9857 40.7484)', 4326));To convert in the other direction, use the WKT to GeoJSON converter.
Try It
Paste this GeoJSON LineString representing a segment of the Las Vegas Strip. The converter outputs the equivalent WKT string:
GeoJSON{
"type": "Feature",
"properties": { "name": "Las Vegas Strip" },
"geometry": {
"type": "LineString",
"coordinates": [
[-115.1728, 36.1147],
[-115.1726, 36.1192],
[-115.1722, 36.1251]
]
}
}The resulting WKT output:
WKTLINESTRING (-115.1728 36.1147, -115.1726 36.1192, -115.1722 36.1251)Properties like name are discarded because WKT is a geometry-only format. If your FeatureCollection contains multiple features, each geometry is output on a separate line.
How the Conversion Algorithm Works
The converter reads each geometry from the GeoJSON input and serializes it to WKT syntax. Coordinate arrays are joined with spaces between longitude and latitude, and commas between coordinate pairs. Polygon rings are wrapped in double parentheses per the WKT standard. Multi-type geometries produce their corresponding WKT Multi-type keywords.
WKT is the format expected by spatial SQL functions such as ST_GeomFromText() in PostGIS. For a full reference on how GeoJSON structures map to database formats, see the PostGIS GeoJSON Guide.