How to convert WKT to Shapefile in Excel

Published on Wednesday, June 6, 2018 by Milos Gregor

In this post we look at how to convert spatial data from WKT format to Shapefile directly in Excel.

Well-known text (WKT) is a text markup language for representing vector geometry objects on a map, spatial reference systems of spatial objects and transformations between spatial reference systems. A binary equivalent, known as well-known binary (WKB), is used to transfer and store the same information on databases.

The formats were originally defined by the Open Geospatial Consortium (OGC) and described in their Simple Feature Access and Coordinate Transformation Service specifications. The current standard definition is in the ISO/IEC 13249-3:2016 standard, "Information technology – Database languages – SQL multimedia and application packages – Part 3: Spatial" (SQL/MM) and ISO 19162:2015, "Geographic information – Well-known text representation of coordinate reference systems".

Coordinates for geometries may be 2D (x, y), 3D (x, y, z), 4D (x, y, z, m) with an m value that is part of a linear referencing system or 2D with an m value (x, y, m). Three-dimensional geometries are designated by a "Z" after the geometry type and geometries with a linear referencing system have an "M" after the geometry type.

Add-in GIS.XL allows you to work with four basic 2D geometry primitives:

Point POINT (30 10)
Line < LINESTRING (30 10, 10 30, 40 40)
Polygon POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))
Polygon with holes POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))

The great advantage of spatial data encoded in the WKT format is that the entire geometry can be encoded within a single cell. Other cells in row can be used to store attribute data related with the geometry feature.

Spatial data may be defined in a simple table form. You can work with this dataset in Excel in the same way as with other data types. After finishing, you can (for example) import them into a database.

The following video shows an example of how to create a ShapeFile layer from WKT data in Excel spreadsheet and how you can visualize it in the GIS.XL map panel.

The conversion from WKT to ShapeFile is relatively simple:

  1. select the data in the spreadsheet
  2. click on Excel to GIS - Create Layer (WKT) item
  3. select column containing the geometry definition
  4. press the Apply button

The add-in create new ShapeFile layer in the Map Panel. If the column contains multiple types of geometry (point, linestring or polygon), a separate layers will be created for each geometry type. After the conversion, you can visualize, use and export created map layer from add-in in several formats.