[postgis-devel] When did ST_BuildArea change

Paul Ramsey pramsey at cleverelephant.ca
Mon Oct 5 13:35:05 PDT 2020


Doesn't feel wrong to me...

pramsey=# select st_astext(st_polygonize('MULTILINESTRING((0 0, 10 0, 10 10, 0 10, 0 0), (5 5, 5 6, 6 6, 6 5, 5 5))'::geometry));
                                                  st_astext                                                  
-------------------------------------------------------------------------------------------------------------
 GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0),(5 5,6 5,6 6,5 6,5 5)),POLYGON((5 5,5 6,6 6,6 5,5 5)))
(1 row)

pramsey=# select st_astext(st_buildarea('MULTILINESTRING((0 0, 10 0, 10 10, 0 10, 0 0), (5 5, 5 6, 6 6, 6 5, 5 5))'::geometry));
                        st_astext                         
----------------------------------------------------------
 POLYGON((0 0,0 10,10 10,10 0,0 0),(5 5,6 5,6 6,5 6,5 5))
(1 row)


BuildArea -- all these lines form *one* polygon, build the best polygon you can out of them
Polygonize -- all these lines form lots of polygons, build as many polygons as you can out of them


> On Oct 5, 2020, at 12:21 PM, Regina Obe <lr at pcorp.us> wrote:
> 
> I noticed this before but came across it again.
>  
> http://postgis.net/docs/manual-dev/ST_BuildArea.html
>  
> At the time I created this page which I am guessing was like circa 2008
>  
> This query created a gaping hole.  Now it doesn't so the docs are wrong
>  
> SELECT ST_BuildArea(ST_Collect(line,circle))
> FROM (SELECT
>     ST_Buffer(
>         ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(190, 190)),
>                 5)  As line,
>     ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) As circle) As foo;
>  
> --this creates the same gaping hole
> --but using linestrings instead of polygons
> SELECT ST_BuildArea(
>     ST_Collect(ST_ExteriorRing(line),ST_ExteriorRing(circle))
>     )
> FROM (SELECT ST_Buffer(
>     ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(190, 190))
>         ,5)  As line,
>     ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) As circle) As foo;
>  
> Docs say this:
>  
> <image001.png>
>  
> But when I run in pgAdmin4 I get this:
>  
>  
> <image002.png>
>  
> Does anyone know when this behavior changed and why?  I’m assuming it is a GEOS change, so cc’ing GEOS dev as well.
>  
> More depressing is my signature symmetric podded Bee Hive on this page (circa 2010(
>  
> http://postgis.net/docs/manual-dev/ST_LongestLine.html
>  
> Which looked like this (minus the longest line of course) – beautiful isn’t it?
>  
>  
> <image003.png>
>  
> Now looks like a shadow of its former self
>  
> <image004.png>
>  
>  
>  
>  
> Thanks,
> Regina
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list