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

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
fgregg
  • 378
  • 1
  • 2
  • 11
  • 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 Aug 28 '13 at 21:25
  • Agree with @Spacedman but either way without data in the form of an example shapefile it's difficult to help. – SlowLearner Sep 02 '13 at 13:02

1 Answers1

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
Micha
  • 15,555
  • 23
  • 29
  • 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. – Nikos Alexandris May 04 '18 at 15:11