I'm trying to convert a shapefile containing 3D Vector Polylines (with Z values) to 3D Vector Polygons with the tool "Line to Polygon" from QGis. The problem is that the Z values are lost during the process. The polygons that I get after transformation have no Z value.

Is there a way to fix this?

1 Answer 1


After hours of research I find a very derivated way to do that. First you have to "save as" the shapefile containing the 3D Vector polylines in csv file. Make sure that the type of geometry is LineString, Z value is included and in Geometry Option it is set on "AS_WKT" save as

After saving, open the csv with notepad or wordpad. Replace "LINESTRING Z by "POLYGON Z and add a second bracket at the beginning and at the end, see below:

"LINESTRING Z (1321474.10328 6243180.409122 7.42,....)

"POLYGON Z ((1321474.10328 6243180.409122 7.42,....))

Save the csv file and open it through Qgis with the tool "add layer from csv file". Make sure that the options below are right setenter image description here

Then press OK. You have to set the CRS because it is not saved in the csv file.

It's a tedious method, but it still faster than retype all the Z values of the polygon corners. If anybody knows a fastest way, I'm still interested.

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.