TransWikia.com

Lat/Long data to shapefile with many values in CSV dataset

Geographic Information Systems Asked by mrakoplas on December 5, 2020

I have my polygon spatial data in a format of CSV with the column of lat/long delimited by comma. Is there any way to upload this csv and got polygon shapefiles (or any other visualisable format)? My primary GIS tool is QGIS.

There are several ways how to do it just for one WKT at the same time but I cannot find a way how to do it with data with several rows in data.

I have tried to Add delimited text layer with geometry definition of WKT but it does not work (as can be seen in the screenshot. Data are not in the readable WKT format.

I am up to some solution even outside QGIS environment

One Answer

Let's assume there is a .csv-file with your data, where lat/long delimited by comma, see image below

csv

  1. Drag&Drop your CSV into QGIS

    input

  2. Deploy Virtual Layers through Layer > Add Layer > Add/Edit Virtual Layer.... In the Query window just simply paste the following expression:

    SELECT *, ST_GeomFromText('POLYGON((' || "coord_values" || '))', #putyourSRIDcodehere) AS geom
    FROM "polygons"
    

    P.S. Mind the SRID code

  3. And get the output

    result


References:

Correct answer by Taras on December 5, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP