[postgis-users] Unexpected behaviour in ST_Buffer

Paul Ramsey pramsey at cleverelephant.ca
Thu Mar 16 13:33:16 PDT 2023


This is a know issue, and goes all the way up into JTS

https://github.com/locationtech/jts/issues/876

P

> On Mar 16, 2023, at 1:04 PM, Regina Obe <lr at pcorp.us> wrote:
> 
>> Hello, there is a behaviour that I didn't expect with ST_Buffer.
> 
>> Using ST_Buffer on any LINESTRING with a start point the same as the end
>> point, for on example this circle:
> 
>> In Postgis version 2.5, the result was an area encircling the input
> circle,
>> with a radius 7 meters bigger than the input. This is what I would expect.
> 
>> However, in Postgis version 3.3, the result is a ring that appears to be 7
>> meters wide and does not include the input polygon. I think this behaviour
>> only happens when the radius passed to ST_Buffer is bigger than the radius
>> of the input LINESTRING.
> 
> I see what you mean, and yes a positive buffer of a linestring should always
> contain the original geometry.
> I can't think of an instance when it shouldn't even if the buffer is longer
> than the length.
> 
> SELECT ST_Intersects(ST_Buffer(geog, 7.0), geog) ,
> ST_Distance(ST_Buffer(geog,7.0), geog)
> FROM (SELECT 'SRID=4326;LINESTRING(
>  15.209907 48.3882267,
>  15.2098971 48.3882238,
>  15.2098892 48.3882189,
>  15.2098842 48.3882126,
>  15.2098826 48.3882055,
>  15.2098846 48.3881985,
>  15.20989 48.3881923,
>  15.2098982 48.3881877,
>  15.2099082 48.3881851,
>  15.209919 48.3881848,
>  15.2099288 48.3881868,
>  15.2099372 48.3881907,
>  15.2099433 48.3881962,
>  15.2099465 48.3882026,
>  15.2099465 48.3882095,
>  15.2099432 48.3882159,
>  15.209937 48.3882214,
>  15.2099281 48.3882254,
>  15.2099177 48.3882272,
>  15.209907 48.3882267
> )'::geography AS geog) AS f;
> 
> Yields:
> st_intersects | st_distance
> ---------------+-------------
> f             |  2.06699802
> (1 row)
> The above returns false and visually it is clear it doesn't contain the
> input string.
> 
> This is running:
> 
> POSTGIS="3.3.2 3.3.2" [EXTENSION] PGSQL="150" GEOS="3.11.1-CAPI-1.17.1"
> SFCGAL="SFCGAL 1.4.1, CGAL 5.3, BOOST 1.78.0" PROJ="7.2.1" GDAL="GDAL 3.4.3,
> released 2022/04/22" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1"
> WAGYU="0.5.0 (Internal)" TOPOLOGY RASTER
> 
> Unfortunately I don't have a PostGIS 2.5 readily handy.  Can you provider
> the: 
> 
> SELECT postgis_full_version();
> 
> Of both your PostGIS 2.5 and PostGIS 3.3.  This could be a GEOS bug rather
> than a PostGIS one.
> Could also be a proj issue since ST_Buffer is one of those functions that
> transforms to geometry before doing buffer.
> 
> Thanks,
> Regina
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20230316/bbc69259/attachment.htm>


More information about the postgis-users mailing list