Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My problem: I have a single shapefile from a habitat-survey and need to select all hedge-features that are enclosed in meadows.The features that are to be selected were created by filling rings. Select by attribute does not work since not all hedges are within meadows. I've tried the Spatial Query Plugin's 'within' and 'contains' option after duplicating the layer, but since the features do not overlap, the plugin finds no result. The 'touches' option gets results, but unfortunately also selects neighbouring features which I don't need.

The question now is, how I can select only the enclosed objects without having to do it manually?

Grateful for any help, Gandalf

share|improve this question
up vote 0 down vote accepted

I was able to solve the problem with a workaround:

I duplicated the layer in question twice and removed all features but the hedges in one duplicate and all but the meadows in the other.

Then I used the 'Polygon to Line' tool on both and created layers with only the boundaries of the features.

I used 'intersect' on the line-layers and was left with the common boundaries of meadows and hedges. After calculating the lengths of all features in both the hedge-layer and the shared-boundary-layer I spatial-joined them using the 'sum'-option on the shared-layer and thus got a hedge-layer that contained both a column with the original length as well as the length it shares with a meadow.

Then I used the field calculator to create a new field with the ratio of shared length to overall length. All features with a ratio of 1 are completely enclosed by meadows.

If someone has a more elegant and/or easier solution, please share!

Greetings, Gandalf

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.