11

I have a map made up of multiple polygons, with a few hundred thousand points very small polygons on within it.

I need the larger polygons, but not the points small polygons. How do I select and remove all the points small polygons, while preserving the larger polygons? (I obviously do not want to do this manually - there are a few too many points for that!)

I'm totally new to QGIS, and I've Googled extensivey with no luck. Probably because I'm unsure what the correct terminology to use in a Google search is!

The files I am using are a .dbf, .prj, .qpj, .shp and .shx. I'm simply dragging the .shp file on to QGIS, and the map appears as one layer. Basically a map of the UK divided into regions (which I want) and covered in points (which do not want).

map view table view

This is what it looks like up close. I did a dissolve to see if they'd go in to the surrounding layer, with no luck:

close-up view of polygons

  • 4
    It looks like you're using shapefiles (.shp). Each shapefile can only contain one of points, lines or polygons. So one (or more) of your shapefiles will contain the UK regions as polygons, and 1 (or more) of your shapefiles will contain only points. If you turn the shapefiles on/off in the table of contents (the tick box next to them) you will see which data is held in each file. You can then just remove the files that contain the points. – Dan_h_b Oct 7 '13 at 10:26
  • 1
    Who created the data, or where did you get it from? It looks like (based on the picture) you have polygons with holes in them. – HeikkiVesanto Oct 7 '13 at 10:54
  • 1
    I agree with Vesanto that if that is just one layer it might be a polygon layer with holes in them or very small polygons. In this case you could merge them with the larger polygons. E.g. select the polygons that are within the big one then merge. Could you zoom in and provide a closeup screen shot of the "points" on your map? – Chris P Oct 7 '13 at 11:09
  • 1
    Any chance you could attach the shp file? – Dan_h_b Oct 7 '13 at 12:48
  • 1
    Ok, so at a guess, I will say that you have multi-part polygons (based on the fact there's only 17 rows in your attribute table). If you explode your data into single part polygons you will end up with 100's of polygons. (Vector > Geometry tools > Multipart to singleparts). You should then be able to make a selection based on area (i.e. select the really small areas) and delete them to get rid of all these tiny polygons, or in a similar way you should be able to dissolve them into whichever large polygon they fall within. – Dan_h_b Oct 7 '13 at 13:10
22

It seems like you're working with Ordnance Survey Code-Point data, which is a dataset of the postal code areas in Great Britain and Northern Ireland.

The "points" you're referring to are small square polygons that represent so-called "vertical streets": stacks of more than one post code, which can't be represented using "conventional" polygons (see Andy Harfoot's comment for more details). You might want to think twice about removing these polygons if you need the affected postal codes for your analysis.

That said, here's how you can remove these polygons:

  1. Select all vertical street polygons by clicking "Select Features Using an Expression" and entering "POSTCODE" LIKE 'V%'. This will select all features that have a postal code starting with V, which are the vertical streets.

  2. Simply deleting the features won't help, since the polygons will leave holes behind, as you have already noticed. Instead, you can merge the vertical streets with a neighbouring large polygon using "Vector / Geoprocessing tools / Eliminate sliver polygons", saving the result to a new file.

  3. You may get the warning message that some features could not be dissolved, together with a list of feature ID's. If you also want to get rid of these features, select the vertical streets in the new layer using the expression from before, and then do one of the following:

    1. If you want an automatic solution, you can dissolve the vertical streets togehter with all neighbouring polygons. Save the selection to a new layer using "Layer / Save selection as vector file", and then use "Vector / Research Tools / Select by location" to select features in the merged layer that intersect with the offending vertical streets, creating a new selection. Then dissolve this selection using "Vector / Geoprocessing Tools / Dissolve", choosing --- Dissolve all --- in the "Dissolve field". Note that this approach can lead to the undesired dissolution of "proper" polygons if the offending vertical street is on the boundary of two other polygons, or if there are offending vertical streets within two neighbouring polygons.

    2. If you want to avoid dissolving other polygons, you can manually select the vertical streets and one adjacent polygon, taking care not to select two neighbouring polygons, and then dissolving them as above.

  • 3
    Excellent walk-through of the source, risks, options, and process the OP originally asked for! – RyanDalton Oct 7 '13 at 20:00
  • 1
    Minor point - vertical streets exist where there is a vertical stack of more than one postcode, preventing their representation as a 'conventional' polygon in the dataset. This commonly occurs in residential tower blocks or office buildings. A list is provided as a companion to the main codepoint polygon dataset that expands the vertical street code (beginning with V) into the multiple postcodes that comprise it. – Andy Harfoot Oct 16 '13 at 15:09
  • @AndyHarfoot: Ah yes, thanks for the clarification! I've edited my answer – Jake Oct 16 '13 at 15:25
  • That is brilliant - thank you. Just one thing - I cannot find Select Features Using an Expression or Vector / Geoprocessing tools / Eliminate sliver polygons. I'm on 1.8.0 Lisboa. Do I need to upgrade? – Dazed and Confused Oct 29 '13 at 13:05
2

Try to reverse your methodology. Instead of trying to select and delete thousands of points, Have you tried to select the polygons and create a new layer from that selection? This wouldn't be too tedious if you had a method down for manually deleting all the points, just select the polygon features instead and either create a layer or export them. If these points are small polygons, as others have commented, you can still select only the polygons you want to keep and export.

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.