8000 Buffer intersects line it should buffer? · Issue #660 · libgeos/geos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Buffer intersects line it should buffer? #660
Open
@zoeschindler

Description

@zoeschindler

I think I found abug in GEOS, but I am not 100% sure. I use the GEOS library via the R programming language using the terra, sf or geos packages which all rely on GEOS. With all of these three, I had issues with buffers around some lines. Starting from a certain buffer size, the buffer intersects the line it was supposed to buffer. These issues don't arise when the buffer is smaller, e.g. 1m instead of 2m.

I already opend two other issues for this in the respective packages: r-spatial/sf#1986, rspatial/terra#765. Someone suggested the issue would be at the GEOS package, so I wanted to let someone know although I use GEOS only via the R API.

Here is some example code and output in R:

# input data
ch_crd <- structure(
  c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3.50850510439515, 3.34156954142671, 
    2.87898194958676, 2.72374630132234, 2.2922345396554, 2.29312419890067, 
    2.32261681738335, 2.49720251348322, 3.19886481773371, 3.50850510439515, 
    1.62424111363924, 1.64507013529592, 1.71055495856562, 1.8867890234822, 
    2.38801074041958, 2.91005134572971, 3.22939872710867, 3.25684154033292, 
    2.97375702861173, 1.62424111363924), dim = c(10L, 3L), dimnames = list(
      NULL, c("id", "x", "y"))) 

# printed data frame with coordinates
> ch_crd
      id        x        y
 [1,]  1 3.508505 1.624241
 [2,]  1 3.341570 1.645070
 [3,]  1 2.878982 1.710555
 [4,]  1 2.723746 1.886789
 [5,]  1 2.292235 2.388011
 [6,]  1 2.293124 2.910051
 [7,]  1 2.322617 3.229399
 [8,]  1 2.497203 3.256842
 [9,]  1 3.198865 2.973757
[10,]  1 3.508505 1.624241
library(terra)

# create line object
ch_lin <- vect(ch_crd, "lines", crs = CRS("EPSG:25832")@projargs)

# create 2m buffer around object
ch_buff <- buffer(ch_lin, 2)

# plot buffer per section
plot(ch_buff, col = "lightblue")
plot(ch_lin, add = T)

grafik

library(sf)

# create line & buffer
ch_lin = st_linestring(ch_crd[, 2:3])
ch_lin = st_sfc(ch_lin, crs = "epsg:25832")
ch_buff = st_buffer(ch_lin, 2)

# plot line & buffer
plot(ch_buff, col = "lightblue")
plot(ch_lin, add = T)

grafik

Metadata

Metadata

Assignees

No one assigned

    Labels

    JTSIssue also appears in JTS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0