<div dir="ltr">Hi Paul,<div><br></div><div>I merged in Stephen's patch for this, which uses the "side=left/right" syntax. He made some nice examples for the docs:</div><div><br></div><div><a href="https://postgis.net/docs/manual-dev/ST_Buffer.html">https://postgis.net/docs/manual-dev/ST_Buffer.html</a></div><div><br></div><div>The "sign" and "side" are two ways to refer to the same thing, i.e., a negative left buffer is the same as a positive right buffer:</div><div><br></div><div><a href="https://trac.osgeo.org/postgis/browser/trunk/postgis/lwgeom_geos.c#L966">https://trac.osgeo.org/postgis/browser/trunk/postgis/lwgeom_geos.c#L966</a></div><div><br></div><div>Dan </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 26, 2018 at 12:37 PM, Paul Ramsey <span dir="ltr"><<a href="mailto:pramsey@cleverelephant.ca" target="_blank">pramsey@cleverelephant.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes, left/right seems reasonable to me.<br>
It's not an east/west thing though, it's a line direction thing, so<br>
"left in the direction of digitization". I haven't experimented what<br>
that would mean for a polygon... in particular, if you asked for a<br>
right-side buffer on a CW ring, with a negative buffer distance...<br>
what do you get? The right/left side and positive/negative distance<br>
would appear to be interacting somewhat.<br>
P.<br>
<br>
On Fri, Jan 19, 2018 at 1:23 AM, Darafei "Komяpa" Praliaskouski<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:me@komzpa.net">me@komzpa.net</a>> wrote:<br>
> Hi,<br>
><br>
> I like the idea of changing 1/-1 to left/right, it's more humane.<br>
> How about side=left/right/both for less presses of shift key? :)<br>
><br>
> As a person who mixes left and right I would also like have a setting that<br>
> doesn't mention "left" and "right" at all.<br>
> It's visually tricky sometimes, to convert the screen's "east" to "right"<br>
> for a line that goes "southwards/down", and then write that into query from<br>
> first attempt.<br>
><br>
> I'll quote again a property I expect to hold true without mentioning "left"<br>
> and "right":<br>
>>> I expect ST_Buffer(ST_Boundary(ST_<wbr>ForceRHR(polygon)), 10, 'single_side')<br>
>>> to be buffered "outside".<br>
><br>
> Or at least a highlight in docs that will tell me whether it's left or right<br>
> each time I forget :)<br>
><br>
> пт, 19 янв. 2018 г. в 3:30, Stephen Knox <<a href="mailto:stephenknox73@gmail.com">stephenknox73@gmail.com</a>>:<br>
>><br>
>> Hi Darafei,<br>
>><br>
>> Thanks for that good feedback.<br>
>><br>
>> Actually I think thinking it through I wonder if it would be better to<br>
>> have the option as single_side=left or single_side=right as I think that is<br>
>> much more intuitive. All the tests I've done on geometries indicate that<br>
>> geos honours the distance parameter as expected (positive is left hand side<br>
>> of the line and negative right - see<br>
>> <a href="https://geos.osgeo.org/doxygen/classgeos_1_1operation_1_1buffer_1_1BufferParameters.html#adc2afac5dacc613a39a72542bdb8bf21" rel="noreferrer" target="_blank">https://geos.osgeo.org/<wbr>doxygen/classgeos_1_<wbr>1operation_1_1buffer_1_<wbr>1BufferParameters.html#<wbr>adc2afac5dacc613a39a72542bdb8b<wbr>f21</a>).<br>
>> The only issue is by default it gives right hand buffers round joins and<br>
>> left hand buffers mitre joins, but this can be overridden.<br>
>><br>
>> Really this seems to be of greatest use for linestrings, as the buffer<br>
>> function already had a negative distance parameter for polygons, and whether<br>
>> single_side is true or not does not make any difference. With points again<br>
>> it ignores the parameter and undertakes a normal buffer, which is the only<br>
>> sensible thing to do.<br>
>><br>
>> I'll work on that basis and add in the code, tests and docs for the<br>
>> revised function and also submit a pull request from Github.<br>
>><br>
>> Thanks again<br>
>><br>
>> Stephen<br>
>><br>
>> On Thu, Jan 18, 2018 at 10:23 AM, Darafei "Komяpa" Praliaskouski<br>
>> <<a href="mailto:me@komzpa.net">me@komzpa.net</a>> wrote:<br>
>>><br>
>>> Hi,<br>
>>><br>
>>> Thoughts that I have:<br>
>>><br>
>>>  - this is a cool thing that I've needed multiple times. I worked around<br>
>>> its absence by fiddling with ST_MakeLine(ST_Collect(line,<br>
>>> ST_OffsetCurve(line, 1))) and then trying to make result valid, which<br>
>>> sometimes worked;<br>
>>>  - how do I remember which way is it being offset? I expect<br>
>>> ST_Buffer(ST_Boundary(ST_<wbr>ForceRHR(polygon)), 10, 'single_side') to be<br>
>>> buffered "outside". Does it hold true?<br>
>>>  - if there are no better ideas on ST_Buffer signature I'd say your<br>
>>> option is good enough for me;<br>
>>>  - there's no error reporting mentioning `single_side` as valid option;<br>
>>>  - can `single_side=1` also work for `single_sided=1` and just<br>
>>> `single_side`/`single_sided`?<br>
>>>  - what does it do for line and for point?<br>
>>>  - does it work on EMPTY, LINESTRING(0 0, 0 0), MULTILINESTRING, and<br>
>>> self-intersecting one?<br>
>>>  - how do I reverse the direction of buffering? I understand there's<br>
>>> negative buffer parameter, does it work? I see you parse parameter to be<br>
>>> single_side=1/0, maybe -1 will also make sense?<br>
>>>  - out of curiosity, will ST_Buffer(geom,0,'single_side'<wbr>) fix invalid<br>
>>> geometries? :)<br>
>>><br>
>>> As someone responsible for github in PostGIS, I encourage you to put it<br>
>>> to GitHub as a PR: that'll get you test coverage report, travis CI<br>
>>> greenlight, a way to comment on your patch inline, and usual PR merge time<br>
>>> on it recently improved. :)<br>
>>><br>
>>> чт, 18 янв. 2018 г. в 12:56, Stephen Knox <<a href="mailto:stephenknox73@gmail.com">stephenknox73@gmail.com</a>>:<br>
>>>><br>
>>>> Hi List,<br>
>>>><br>
>>>> I noticed that PostGIS didn't implement the single-sided buffer<br>
>>>> functionality of Geos (NB. not the Offset Curve functionality, but a<br>
>>>> polygon), so have submitted a patch to implement that:<br>
>>>> <a href="https://trac.osgeo.org/postgis/ticket/3989" rel="noreferrer" target="_blank">https://trac.osgeo.org/<wbr>postgis/ticket/3989</a><br>
>>>><br>
>>>> I have refrained from adding tests and documentation until I get some<br>
>>>> agreement that the function signature is acceptable, as I am a new<br>
>>>> contributor, and I think the ST_Buffer signature is already quit "unusual"<br>
>>>> in that it implements text parameters.<br>
>>>><br>
>>>> I was hoping that post the recent patch releases, a more experienced<br>
>>>> contributor might be able to look at my (small) patch and give some<br>
>>>> feedback.<br>
>>>><br>
>>>> I can put it up on Github as well if that would help.<br>
>>>><br>
>>>> Many thanks<br>
>>>><br>
>>>> Stephen<br>
>>>> ______________________________<wbr>_________________<br>
>>>> postgis-devel mailing list<br>
>>>> <a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
>>>> <a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a><br>
>>><br>
>>><br>
>>> ______________________________<wbr>_________________<br>
>>> postgis-devel mailing list<br>
>>> <a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
>>> <a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a><br>
>><br>
>><br>
>> ______________________________<wbr>_________________<br>
>> postgis-devel mailing list<br>
>> <a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
>> <a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> postgis-devel mailing list<br>
> <a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
> <a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a><br>
______________________________<wbr>_________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a></div></div></blockquote></div><br></div>