KML to WKT Converter
When you've digitised features in Google Earth and need to bulk-INSERT them into a spatial database.
Common issues converting KML to WKT
- WKT has no styling — KML icon, line, and polygon styles are dropped silently.
- MultiGeometry KML containers expand to MULTIPOINT / MULTILINESTRING / MULTIPOLYGON in WKT. Mixed-type containers (point + polygon together) become GEOMETRYCOLLECTION.
- Output is one WKT statement per line. The line break is the delimiter — assume your downstream parser splits on newline before feeding to ST_GeomFromText.
- Attribute data from <ExtendedData> is not preserved — WKT encodes geometry only.
Frequently asked questions
Is the output 2D or 3D?
If the KML coordinates include an altitude triplet, the output uses POINT Z / LINESTRING Z / POLYGON Z. Otherwise plain 2D.
Can I paste the result into PostGIS?
Yes — `INSERT INTO geom_table (geom) VALUES (ST_GeomFromText('POLYGON ((...))', 4326));` works directly. Set the SRID explicitly to keep PostGIS happy.
What if my KML has thousands of features?
Output is one WKT per line — load into PostGIS via `COPY` from stdin or a bulk-insert in your client. The browser handles tens of thousands of features without slowdown.
Are placemark names preserved?
No — WKT has no metadata layer. If you need a `name` column, join the resulting WKT against a parallel CSV of placemark names by row index.