I have a .csv file containing bounding boxes of cities I want to study. I have NetCDF files I'd like to clip and I understood that, with Python, using shapefiles was the easiest way to go.

I added a column in my csv.file with the WKT column (to draw the bounding boxes as mentioned in this post) to but I can't get a visual representation of the bounding boxes on QGIS, how should I import it and create a shapefile with it? While trying to import the .csv data is written on QGIS that "X and Y must be chosen".

My goal is, at the end, to create a shapefile with all of the bounding boxes such that I can use it to filter my NetCDF files with Python.

EDIT (1)

The .csv file I want to import has the following form

Rennes;-1.72;48.08;-1.61;48.15;POLYGON ((-1.72 ,48.08, -1.61 ,48.08,-1.61,48.15, -1.72, 48.15,-1.72 ,48.08))
Bursa;29.01;40.17;29.15;40.23;POLYGON ((29.01 ,40.17, 29.15 ,40.17,29.15,40.23, 29.01, 40.23,29.01 ,40.17))
Copenhagen;12.45;55.61;12.67;55.73;POLYGON ((12.45 ,55.61, 12.67 ,55.61,12.67,55.73, 12.45, 55.73,12.45 ,55.61))
Porto;-8.69;41.14;-8.55;41.19;POLYGON ((-8.69 ,41.14, -8.55 ,41.14,-8.55,41.19, -8.69, 41.19,-8.69 ,41.14))
Delhi;77.05;28.48;77.35;28.80;POLYGON ((77.05 ,28.48, 77.35 ,28.48,77.35,28.80, 77.05, 28.80,77.05 ,28.48))

EDIT (2)

What I get when I go on add a PostGIS layer, pardon my french. QGIS interface in french

  • Can you post an example of the csv? Does a single line look something like x0,y0,x1,y1,x2,y2,x3,y3. I wrote a similar plugin.
    – Cary H
    Jul 8, 2022 at 21:02
  • 1
    I edited the post with some examples of the rows.
    – Galactus
    Jul 8, 2022 at 21:13
  • Please post example CSV data as ASCII, not image.
    – Vince
    Jul 8, 2022 at 22:37

1 Answer 1


I think your csv will work as is. You will not need to write any Python code. If you select Layer from the main menu and then select Add Delimited Text from the drop down menu. Add delimited Text Layer

You will have to select the column that contains the WKT geometry. Also, you can label the column WKT to make it easier. WKT Column

Also I found that the Longitude, Latitude pairs are separated by a space in WKT.

Rennes;-1.72;48.08;-1.61;48.15;POLYGON ((-1.72 48.08, -1.61 48.08,-1.61 48.15, -1.72 48.15,-1.72 48.08))
Bursa;29.01;40.17;29.15;40.23;POLYGON ((29.01 40.17, 29.15 40.17,29.1 40.23, 29.01 40.23,29.01 40.17))
  • In "Add PostGIS Layers" I do not have the same interface as you, I am new to QGIS. I am asked to build a connexion, I posted a picture in the edited post. For Python, I need to use it after I build the shapefile from QGIS to clip the NetCDF files I have. I try to use QGIS to build a shapefile from a csv file I am trying to import, in order to clip NetCDF files with Python. If you know a more direct way to clip a NetCDF file, I'd be glad to know, but we can't ask these type of questions on Stack exchange I believe...
    – Galactus
    Jul 8, 2022 at 23:09
  • Add Delimited Text
    – Cary H
    Jul 9, 2022 at 10:28
  • You should now be able to export a shapefile from QGIS. I have not worked with NetCDF data yet.
    – Cary H
    Jul 11, 2022 at 12:58

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.