Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.