Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: st_buffer single-sided support via GEOSOffsetCurve #1001

Closed
jbacks opened this issue Mar 8, 2019 · 9 comments
Closed

Feature request: st_buffer single-sided support via GEOSOffsetCurve #1001

jbacks opened this issue Mar 8, 2019 · 9 comments
Labels
feature a feature request or enhancement

Comments

@jbacks
Copy link

jbacks commented Mar 8, 2019

I'd like to be able to make single-sided buffers of LINESTRING objects. Has this functionality been on anyone's radar?

It seems tricky to produce single-sided buffers in R using other methods, such as this or this, except for the special cases these examples describe. People make single-sided buffers with other spatial software, suggesting it's a function that would be useful.

The functionality to make single-sided buffers appears to be offered by GEOSOffsetCurve within geos_c.h and the interface looks similar to the functions already used by st_buffer. Would this be straightforward to incorporate?

Thanks very much for your work on this package.

@edzer edzer added feature a feature request or enhancement help wanted ❤️ we'd love your help! labels Mar 8, 2019
@edzer
Copy link
Member

edzer commented Mar 8, 2019

Sounds like a good plan, and relatively straightforward. PR's welcome!

@sriramab
Copy link

sriramab commented Feb 25, 2020

Hi

I am also interested in this feature or a similar feature. When I read the documentation of st_buffer, In the details section, it indicates that st_buffer functionality is based/inspired (?) on ST_Buffer of postgis.

And that postgis page shows a parameter side which seems to address this issue. So would it be easier to implement this into R sf package?

thank you.

@edzer
Copy link
Member

edzer commented Feb 25, 2020

It uses the same library (GEOS) that postgis uses. I can't really figure this out from reading geos_c.h. @dbaston do you have an idea?

@dbaston
Copy link
Contributor

dbaston commented Feb 25, 2020

You can see how PostGIS calls GEOS for a single-sided (polygonal) buffer here

But I think this ticket was about offsetting a line via GEOSOffsetCurve...which can be seen here

@edzer
Copy link
Member

edzer commented Feb 25, 2020

Thanks! I think this ticket was about the single-sided buffer, I don't see how GEOSOffsetCurve can give a buffer.

@dbaston
Copy link
Contributor

dbaston commented Feb 25, 2020

Yes, I misread the ticket and thought that a linestring output was desired. That not being the case, GEOSBufferWithParams would be the way to go.

edzer added a commit that referenced this issue Feb 25, 2020
@edzer edzer removed the help wanted ❤️ we'd love your help! label Feb 25, 2020
@edzer
Copy link
Member

edzer commented Feb 25, 2020

This now gives a single-sided buffer with

plot(st_buffer(st_linestring(rbind(c(0,0), c(10,0))), -2, singleSide=T), axes=T)

the direction being determined by the sign of the buffer size.

edzer added a commit that referenced this issue Feb 25, 2020
@sriramab
Copy link

Thank you, how long does it take to get into CRAN or do you advice via devtools?

@edzer
Copy link
Member

edzer commented Feb 26, 2020

I don't know; I merged this into master, so it's the next release - 1 month from now, or earlier since we see an error on one of the CRAN check machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants