2

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

4
  • 3
    you must use semicolon or tab for importing gis.stackexchange.com/questions/82549/… – Mapperz Oct 14 '20 at 4:03
  • 2
    please don't post pictures of your data, it makes it very hard to read and parse – Ian Turton Oct 14 '20 at 8:02
  • @IanTurton data deleted. I just posted a screenshot to show and approximate how they might look – mrakoplas Oct 14 '20 at 16:17
  • the idea was good but a picture is not - so please add an actual sample of your data – Ian Turton Oct 14 '20 at 16:37
3

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:

1
  • 2
    The data that OP has seem to lack the duplicates of the first vertices as closing vertices and "coord_values" can't be just slipped inside WKT polygon. Perhaps they must be flipped inside linestring instead and converted into polygons with some other operation. – user30184 Oct 14 '20 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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