[GRASS-user] Retaining holes in buffers
markus.metz.giswork at googlemail.com
Mon Jan 25 10:33:47 EST 2010
When exporting areas with v.out.ogr, you need to set the -c flag if
holes should stay holes. That changed in GRASS7, there the meaning of
the -c flag is reversed and must be set to export features without
category (because you are not the only one having this problem with
Roger Bivand wrote:
> This problem arose in comparing vector and raster buffering on a
> recent course. Using 6.4.0RC5 v.to.rast for a line, then buffering
> with r.buffer gave a plausible outcome, but we wished to look at the
> vector equivalent. In addition, we wanted to cookie-cut a raster with
> the vector buffer, to match using r.mapcalc on the raster workflow, in
> R taking the cell centres as representative points.
> The problem is that while the internal vector representation of the
> buffer has a hole, the hole is filled with an island on export (using
> either shapefile or GML OGR drivers). The setup in R for a test
> dataset is:
> L1 <- Line(cbind(c(1, 2, 3, 5), c(1, 3, 5, 10)))
> L2 <- Line(cbind(c(2, 1.5, 3), c(3, 4, 5)))
> LA <- Lines(list(L1, L2), ID="A")
> LB <- Lines(list(Line(cbind(c(4, 6), c(3, 1)))), ID="B")
> SL <- SpatialLines(list(LA, LB))
> SLDF <- SpatialLinesDataFrame(SL, data=data.frame(ID=c("A", "B"),
> row.names=c("", "B"))))
> writeOGR(SLDF, ".", "buff_island", driver="ESRI Shapefile")
> (also on: http://spatial.nhh.no/misc/buff_island.zip).
> then in GRASS (using wx) v.in.ogr to a new location, v.buffer with
> distance 0.25, display (OK, 2 centroids), export as area as shapefile
> or GML (visual inspection of the GML shows that the hole gets filled
> on export), import back, and the hole is filled (three centroids). I'm
> sure I'm missing something, but my cookie-cutter was cutting the
> island too, and should have avoided the hole.
> I'd be very grateful for leads.
> PS. Where is v.to.rast on the wx menu system?
More information about the grass-user