3

I have a shapefile with polygons with an associated variable that can take different values. I would like to extract the borders between polygons of differing value (red and blue) as a polyline (dark black line).

I would prefer solutions in R but will accept other open source solutions.

enter image description here

2
  • 1
    Suspect its two steps - first dissolve polygons of the same colour, then do an intersect. Can be done with the rGEOS package. No time for a full answer right now, sorry.
    – Spacedman
    Commented Aug 28, 2013 at 21:25
  • Agree with @Spacedman but either way without data in the form of an example shapefile it's difficult to help. Commented Sep 2, 2013 at 13:02

1 Answer 1

3

Using GRASS it would be a simple two step process. After importing the polygon vector into an appropriate GRASS location, you would run:

v.dissolve <your polygon vector> output=<output polygon dissolved> column=<your variable>

then, to get just the boundaries:

v.extract <output polygon dissolved> output=<polygon boundaries> type=boundary
1
  • This is an old answer. However, I came to have difficulties in extracting boundaries too. Posted in the grass-dev list, as I thought it could be a potentially special case with my data. The answer and the NOTES in the manual of v.extract hint to features that have a category. Boundaries usually don't have a category. So, either adding category numbers or extracting all layers via layer=-1 is the way to go. Commented May 4, 2018 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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