3

I would like to select the polygons of the layer below that do not intersect with any other polygon (within the same layer). How can I do this using QGIS, GRASS, SAGA or R?

Image

2

Here is an attempt to do this in R. I use gIntersect and compare the layer with itself. Every polygon intersects with itself, so I then use the row sums to determine if there is only one intersect and select those.

library (rgeos)
library(sp)

# make some polys
data (meuse)
coordinates(meuse) <- ~x+y
polys <- gBuffer(meuse, width=70, byid=T)
plot(polys)

intersects <-  gIntersects(polys, byid = TRUE) # check if polys intersect
polys$ints <- apply(intersects,2,sum)          # count how many TRUE intersects
polys.nooverlap <- polys[polys$ints == 1,]     # select polys with only one intersect
plot(polys.nooverlap, add=T, col="red")

(Note that the above does not take into account if polygons are completely contained within another, however those could be found with gContains.)

enter image description here

1

You may use v.select in GRASS GIS with "operator=disjoint" - features do not spatially intersect. Note that it requires GRASS GIS been compiled with GEOS support. Just check if "disjoint" is a supported parameter in v.select.

Edit: in case of one map only, check v.to.db and its parameter "sides". It extracts categories of areas on the left and right side of the boundary. Idea: isolated area will not have any common length. For an (un)related workflow, see http://grasswiki.osgeo.org/wiki/Vector_length_of_common_boundaries

  • Thanks @markusN. However v.select requires the user to work with two layers and I only want to select features that do not spatially intersect within the same layer. – Filipe Dias Apr 15 '14 at 9:01
  • Right - I have edited my answer for second suggestion. – markusN Apr 15 '14 at 22:11
  • Thanks markusN and cenge. I endend up changing my approach and solved the problem by working with the original polygons (those in the image are buffers) and then using gWhithinDistance to determine how many neighbour (whithin a search distance) each polygon had. – Filipe Dias Apr 20 '14 at 20:04

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.