[GIS] Creating polygon layer from polyline layer in QGIS

geometry-conversionlinepolygon-creationqgis

Our systems expect polygon shapefiles, representing a collection of non-intersecting and geometrically valid (Multi)Polygons. Specifically, farm fields. We often receive our representations of farms and their fields as polyline shapefiles containing the field boundary polylines, typically with some small geocoding errors like dangling ends.

Is there a reliable way to transform the polyline layer into a polygon layer, where the perimeters of the polygons are calculated as minimal loops around polylines in the shapefile? I understand I'll probably have to tidy up the polylines first.

I am primarily interested in solutions involving QGIS or other free tools since my company doesn't buy any of the professional packages.

Best Answer

Converting lines to polygons will be easy: (Vector > Geometry Tools > Lines to polygons)

To deal with dangling ends, you could create a buffer around the polylines (Vector > Geoprocessing Tools > Buffer) and set them to 'dissolve'. This would attach any dangling endpoints to eachother.

Then convert the buffer polygons into lines (Vector > Geometry Tools > Polygons to lines)

Then convert the lines into polygons (Vector > Geometry Tools > Lines to polygons)