[postgis-tickets] [PostGIS] #5117: aggregate st_union ignores linestring of zero length
PostGIS
trac at osgeo.org
Tue Mar 22 21:05:55 PDT 2022
#5117: aggregate st_union ignores linestring of zero length
----------------------+---------------------------
Reporter: anneb | Owner: pramsey
Type: defect | Status: closed
Priority: medium | Milestone: PostGIS 3.3.0
Component: postgis | Version: 3.2.x
Resolution: invalid | Keywords:
----------------------+---------------------------
Changes (by komzpa):
* status: new => closed
* resolution: => invalid
Comment:
Zero-length lines are not a valid geometry per OGC spec, the end points of
line are its boundary and boundary isn't inside the geometry. Some
interpretations of it will mean "there are no points in line". Any is
correct as the geometry is not valid.
{{{
07:01:59 [kom] > select ST_IsValid(st_geomfromewkt('srid=3857;LINESTRING(5
5,5 5)'));
NOTICE: 00000: Too few points in geometry component at or near point 5 5
LOCATION: pg_notice, lwgeom_pg.c:364
┌────────────┐
│ st_isvalid │
├────────────┤
│ f │
└────────────┘
(1 row)
}}}
You can get result you expect if you make sure your geom is valid.
{{{
07:03:22 [kom] > with lines as (
select ST_MakeValid(st_geomfromewkt('srid=3857;LINESTRING(5 5,5 5)')) as
geom
union all
select ST_MakeValid(st_geomfromewkt('srid=3857;LINESTRING(1 1, 2 2)'))
as geom
)
select ST_AsText(st_union(geom)) from lines;
┌────────────────────────────────────────────────────┐
│ st_astext │
├────────────────────────────────────────────────────┤
│ GEOMETRYCOLLECTION(POINT(5 5),LINESTRING(1 1,2 2)) │
└────────────────────────────────────────────────────┘
(1 row)
Time: 2,638 ms
}}}
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5117#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list