Live Online ConverterChannel: wktgeojson

WKT to GeoJSON Converter

Convert text-based spatial descriptions into web-ready GeoJSON.

WKT (Well-Known Text) is a standard representation of geographic features. This tool will parse WKT strings and format them into interactive GeoJSON structures, ready for use in web applications.

Drag file here to convert, or select file

Supported file extension: .wkt, .txt • Max 50MB

Channel: Direct Stream ModeGDAL Driver Operational

Specification Rules

  • Import shapes from SQL database exports into web maps
  • Verify text coordinates by visualizing them interactively
  • Incorporate vector database outputs into web applications
  • Strict syntax checks apply; invalid strings will fail to convert
  • Does not store non-spatial spreadsheet parameters unless formatted separately
  • Conversions flatten complex spatial datasets to coordinate maps

GDAL Direct Equivalent Terminal Command

sh — gdalready
$ogr2ogr -f GeoJSON output.geojson input.wkt

When to use this conversion

Convert when you have WKT geometry strings — exported from PostGIS, copy-pasted from a SQL editor, or generated by a script — and need to view them on a web map. Useful for debugging spatial SQL queries.

Technical Details

GDAL parses WKT geometry strings (one per line) and wraps them in a GeoJSON FeatureCollection. Each line becomes a Feature with an empty properties object. CRS must be assigned externally with -a_srs because WKT itself carries no projection (EWKT does via SRID prefix, but plain WKT does not).
Output file size

GeoJSON is typically 1.2–1.6× the size of the source WKT. GeoJSON adds structural JSON markup but its array coordinate notation is slightly more compact per coordinate.

Common Errors & Fixes

  • Unclosed polygon ring: first and last coordinate differ. Fix: ensure the polygon ring closes; tools like shapely.make_valid help.
  • EWKT prefix breaks parsing: SRID=4326;POINT(...) confuses strict WKT parsers. Fix: strip the SRID prefix and pass -a_srs EPSG:4326 instead.
  • Misspelled geometry keyword: POLYGONE instead of POLYGON. Fix: validate WKT with our WKT validator before conversion.
  • No CRS in output: GeoJSON should be in WGS 84 but the WKT was in a projected system. Fix: pass -s_srs and -t_srs together to reproject.

Alternative Tools

  • Online WKT viewers (wktmap.com) for immediate visualisation
  • PostGIS: ST_AsGeoJSON(ST_GeomFromText('<wkt>')) for one-off conversions
  • shapely (Python): shapely.wkt.loads then __geo_interface__
  • Custom JavaScript: use wellknown.js to parse WKT directly in the browser

Frequently Asked Questions

What types of geometry boundaries are parsed?

The tool supports POINT, LINESTRING, POLYGON, MULTIPOLYGON, and GEOMETRYCOLLECTION definitions.

Can I associate variables with the geometry lines?

Attributes are not natively supported in raw WKT text lines. Future updates will support imports from CSV tables with accompanying attribute columns.

How do of projection settings apply?

Calculations default to standard systems, but you can assign target projections using parameter arguments.

Related Transformations Map