Live Online ConverterChannel: geojsonwkt

GeoJSON to WKT Converter

Convert dynamic spatial JSON datasets into flat coordinate text.

Extract vector coordinates from GeoJSON files and translate them into standardized text-based WKT shapes. This is useful for importing geographic shapes directly into spatial databases like MS SQL or PostGIS.

Drag file here to convert, or select file

Supported file extension: .geojson, .json • Max 50MB

Channel: Direct Stream ModeGDAL Driver Operational

Specification Rules

  • Generate text queries to import spatial shapes into SQL databases
  • Format spatial data for database schemas that store geography objects as text strings
  • Export geometric structures for technical planning reports
  • Drops coordinate attributes, outputting only raw text geometries
  • Multi-part coordinates generate long text strings that are difficult to scan
  • Web projections must translate accurately to coordinates

GDAL Direct Equivalent Terminal Command

sh — gdalready
$ogr2ogr -f CSV output.csv input.geojson -lco GEOMETRY=AS_WKT

When to use this conversion

Convert when you need to push geometry into a SQL database as a literal value — a one-off INSERT, a stored procedure parameter, a test fixture for spatial unit tests. WKT is the human-readable transport format that every spatial database understands.

Technical Details

GDAL parses the GeoJSON FeatureCollection and emits one WKT string per feature, typically alongside attribute columns in a CSV. The output is configured with -lco GEOMETRY=AS_WKT, which adds a WKT column to the CSV. Coordinates are preserved at full precision; no CRS is included unless you specifically generate EWKT.
Output file size

WKT (within CSV) is typically 60–80% the size of the source GeoJSON. The savings come from dropping repeated property keys and bracket structure, even though WKT is more verbose per-coordinate.

Common Errors & Fixes

  • Coordinate precision floods output: 15-digit decimals make WKT enormous. Fix: pre-round coordinates with mapshaper or a custom script.
  • EWKT vs WKT confusion: downstream database expects EWKT with SRID prefix. Fix: prepend SRID=<n>; in a post-processing step.
  • GeometryCollection unsupported: some databases don't accept GEOMETRYCOLLECTION. Fix: explode collections before converting.
  • Mixed geometry types in one output: the CSV column needs a single type. Fix: split per geometry type and produce one WKT file each.

Alternative Tools

  • PostGIS: ST_AsText(ST_GeomFromGeoJSON('<geojson>')) for one-off conversions
  • shapely (Python): geometry.wkt for direct conversion
  • wellknown (npm) for browser-side conversion
  • ogr2ogr CLI: ogr2ogr -f CSV output.csv input.geojson -lco GEOMETRY=AS_WKT

Frequently Asked Questions

Why does the command export to a CSV file?

GDAL processes WKT mappings by outputting database streams or CSV rows containing text geometries.

Are complex geospatial shapes fully mapped?

Yes, boundaries and segments map precisely to standard geometric syntax representations.

Does this tool support 3D geographic coordinates?

Yes. Coordinates containing Z-axis values map to elevation fields in standard WKT structures.

Related Transformations Map