I have two polygons that consist of two separate polygons/lines in QGIS). How can I make this into a multipart polygon, which consists of 1 line in QGIS?
Select your features.
- From Advanced Editing Toolbar, Click Merge Selected Features icon.
- A dialog would pop up. Now select the record that you want to accept as the common record for your selected features. Click OK.
Vector->Geometry Tools->Single parts to Multipart
However, you say that you only want a multipart polygon consisting of a single line. You are unlikely to get that ever because that would be a single polygon, because, by definition, any multipart geometry has multiple parts.
You could also dissolve your data and that will create a multipart if you dissolve polygons which do not intersect but will also combine polygons which do intersect into single units and perhaps this is what you meant (Vector->Geoprocessing Tools->Dissolve)
For anyone coming to this with newer versions of QGIS, the function to do it is now called "Collect Geometries" rather than "Single parts to Multipart" so it's now Vector > Geometry Tools > Collect Geometries. You can then choose a field (or fields) to use as your grouping variable (Unique ID Fields). I used it to fix up some statistical areas which included non-contiguous polygons (islands in fact) where I'd ended up with 1 record for each separate polygon, but wanted 1 record for each statistical area. The reason I needed THAT was because I'm joining it to data in Tableau and ended up with a whole bunch of duplication happening around the coast due to the islands.