<div dir="ltr"><div>About sharp turns : you could use a small buffer then errosion or straight skeleton (out of the box with sfcgal).<br><br></div>For the flat encapt I suggest you to use st_split afterward.<br><br>Cheers,<br>
<br>Rémi-C<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/26 Mike Toews <span dir="ltr"><<a href="mailto:mwtoews@gmail.com" target="_blank">mwtoews@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 26 November 2013 06:04, James David Smith<br>
<div class="im"><<a href="mailto:james.david.smith@gmail.com">james.david.smith@gmail.com</a>> wrote:<br>
> 2) Now I buffer it:<br>
><br>
> SELECT ST_Buffer(<br>
>  ST_GeomFromText(<br>
>   'LINESTRING(555936.152 200920.582000002,555938.312000002<br>
> 200908.102000002,555943.112000001 200883.142000001,555953.192000001<br>
> 200839.702,555964.471999999 200798.181999998,555974.312<br>
> 200764.342000002,555983.912 200744.182000002,555990.554<br>
> 200733.721000003,555993.512 200729.062000005,555995.778000002<br>
> 200726.756000001,556006.952000001 200715.382000001,556024.232<br>
> 200698.822000002,556036.597999999 200687.931,556050.392000001<br>
> 200675.782000002,556055.914 200671.265000002,556071.512<br>
> 200658.502000002,556094.915000001 200640.537000002,556095.451000001<br>
> 200640.152000001,556113.992000001 200628.742000001,556138.472000001<br>
> 200616.502000004,556159.112000002 200605.942000002,556180.232000001<br>
> 200589.862000002,556207.592 200568.022000002,556217.912000002<br>
> 200558.182,556228.472000001 200545.702,556240.472<br>
> 200527.702000003,556251.992000001 200509.221999999,556253.237000001<br>
> 200506.732000003,556258.952 200495.302000001,556268.000000001<br>
> 200478.000000002,556279.592 200458.582000002,556300<br>
> 200431.000000002,556351.000000002 200364,556349.253<br>
> 200366.234000001)'), 1000, 'endcap=flat join=round');<br>
<br>
</div>Hi James,<br>
<br>
I just had a spin with this geometry in JTS TestBuilder, in Buffer ><br>
BufferWithParams. This graphical tool has similar controls as<br>
ST_Buffer, but is slightly more interactive. I get pretty much the<br>
same result, with anomalies on both ends of the linestring. GEOS (used<br>
by PostGIS) is a C++ port of JTS, so this is no surprise to see the<br>
same results. Only buffers less than 200 look normal.<br>
<br>
The oddness at the bottom is explained by a small J-shaped kink at the<br>
end of the linestring, which has a short and very sharp angle (nearly<br>
360 degrees or 0 degrees), which makes the last segment go upwards and<br>
nearly parallel to the second-to-last segment of the linestring.<br>
Removing the last coordinate fixes things on the lower part. This is<br>
most likely a digitization error.<br>
<br>
If you have heaps of these geometries that need cleaning up, you could<br>
write a function to return the maximum vertex angle in a linestring,<br>
and filter out the sharp ones, e.g. > 350 degrees or < 10 degrees,<br>
then check and fix these up manually.<br>
<br>
On the upper-right part of the buffer, the polygon is clearly buffered<br>
by the correct distance from the middle of the line, but the clip from<br>
the top cap carves it a bit funny. I've seen this before too, and I'm<br>
not sure if anything can be done about this part.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Mike<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br></div>