I have a Shapefile layer with thousands of polygons.

I want to edit the vertices of just a few, but when I select them to try to modify them it becomes very slow. How can I isolate those few to make this work faster?

enter image description here

Here`s an image to make it easier to explain.

enter image description here

These two blue polygons belong to the same field/category. I need to edit them to unite them, the problem is that in my actual Shapefile they aren`t just two polygons but thousands belonging to the same Field and as I mention Qgis becomes really slow.

How can I cut just the red square area (image), edit it in a separate shapefile (unite them) then bring it back to the actual Shapefile.

  • You could use a filter: it identifies the polygons you have to modify (for example with their ID) then: Right button on the layer => filter As a clause where: "field name" in (1234,2345) QGIS slows down because you have the snap enabled !!!
    – pigreco
    Jul 1 '17 at 18:40
  • Welcome to gis-stackexchange @Alejandro S ! Just a quick question... have you created Spatial Index for your layer? If not, setting it may speed-up your tasks a bit.
    – Kazuhito
    Jul 2 '17 at 5:42

You could save your Shapefile as a Spatialite file, see end of this answer.

However to answer the question you have asked about isolating polygons, and if working with your data as a shapefile, then really the first thing to do, as Kazuhito commented above, is to create a spatial index on your shapefile layer.

Double click on the layer, or right-click > properties, then in the General tab. Click on Create spatial index

enter image description here

This will dramatically increase the performance of QGIS handling your shapefile layer.

Again, building upon one of the comments, if you know the polygons you want to edit you can Filter the shapefile to only show that polygon

Right-click the layer and select Filter to open up a query builder

enter image description here

enter image description here

Double click on the field you want to filter by to add it to the query window, or type it, and build up an expression as in the screenshot.

If you don't know any attributes of the polygon the zoom in and use the `Identify feature'

enter image description here

Another way to isolate a few polygons, as is the question, and again if you know some attributes of the polygons you want, is to Select by expression and the Zoom to selection.

enter image description here

Again build an expression to select the polygons you want

enter image description here

Then 'Zoom to selection'

enter image description here


You could save your Shapefile as a Spatialite file

Layer > Save as and select Spatialite in the drop down format. Browse to where to save it to, and name it. Make sure Add saved file to map is selected.

enter image description here

Spatialite is a database format, and so editing will be inherently quicker. With so many polygons it's not a bad idea anyway as it will give you database capabilities on your data. If you need to convert back to a shapefile you can do this by reversing the process and save as a shapefile.

After your recent edit I now think I better understand. I will add it to this answer for now, and then if this works I shall tidy up the answer so that it better reflects your edited question.

One method, which I don't think is actually what you want but I shall mention it first, is that you can use Vector > Geometry Tools > Multipart to singlepart, but this will separate all of them into separate individual polygons, so I suspect that this is not what you want?

To edit just two parts, as in your image...

In edit mode, with no polygons selected, use the split feature tool to cut each polygon part that you want to work with. This will make them separate polygons.

You can then edit those parts separately so that the nodes of each edge you want to join are over each other. You can snap the nodes over each other, by switching on snapping.

If the polygons are touching like this then you can select only those two polygons that you want to join using Vector > Geoprocessing Tools > Dissolve.

Browse to where you want to save the output as a temporary shapefile, and OK.

This will 'dissolve' the two polygons together into a separate layer. You can delete the original two polygons from your original layer, and then copy and paste the dissolved polygon into the original layer.

  • I try all the options mentioned and none seem to help. The problem is that even a single category (field) has too many polygons (My Shapefile layer has thousands of polygons classify into only 12 different fields). Is there a way to filter a few polygons inside a single field. Would it be easier to clip the polygons I wanna work with, and then paste them again? Jul 3 '17 at 17:09
  • You could copy and paste them into a new layer, yes, and then copy them back. That could be a good solution. Jul 3 '17 at 17:15
  • I edited the main question Jul 3 '17 at 19:31
  • I have added to my answer quickly as I am on my lunch break. If this works I'll add images later and tidy up my answer Jul 4 '17 at 11:57
  • Can the "multipart to singlepart" option be reverse? I ended up following this process: First I clipped the parts I wanted to edit to a new Shapefile and edited them. From the original Shapefile I use the "Difference" tool to cut the part of the polygons I clipped. Then I merged the edited polygons and the Difference Shapefile. Hope thats clear. Jul 4 '17 at 14:08

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.