I'm working with data containing multiple lat/long entries within a single row. I am using PostGreSQL to process the data. Is there a way to take the WKT lat/long field and convert it into a line geom field to then bring into ArcMap/QGIS?

Field example:

enter image description here


1 Answer 1


Assuming you're using Postgresql with the PostGIS extension (and assuming all your geometries are linestrings, and that they are in WGS84 coordinate system), it's easy to load this into a QGIS layer using the database manager (from the menu: "Database/DB manager") and the PostGIS function ST_GeomFromText(). Connect to your database, open an SQL window, and run something like this:

SELECT myfield1, myfield2, ST_GeomFromText(geowkt, 4326) AS geom from mytable;

You can then load this as a layer into your QGIS project, selecting geom as the geometry field.

(If you don't have PostGIS installed, you could select the data you want, including your linestring field, and export it as CSV, then import the CSV file into QGIS.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.