#5117 closed defect (invalid)
aggregate st_union ignores linestring of zero length
Reported by: | anneb | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.3.0 |
Component: | postgis | Version: | 3.2.x |
Keywords: | Cc: |
Description
The aggregate version of st_union ignores zero length linestrings while similar functions do not.
The following ignores the first linestring:
with lines as ( select st_geomfromewkt('srid=3857;LINESTRING(5 5,5 5)') as geom union all select st_geomfromewkt('srid=3857;LINESTRING(1 1, 2 2)') as geom ) select st_union(geom) from lines;
However, the following examples include the first linestring
-- non-aggregate version of st_union: select st_union(st_geomfromewkt('srid=3857;LINESTRING(5 5,5 5)'), st_geomfromewkt('srid=3857;LINESTRING(1 1, 2 2)')); -- aggregate versions of st_extent and st_collect: with lines as ( select st_geomfromewkt('srid=3857;LINESTRING(5 5,5 5)') as geom union all select st_geomfromewkt('srid=3857;LINESTRING(1 1, 2 2)') as geom ) select st_extent(geom) from lines; with lines as ( select st_geomfromewkt('srid=3857;LINESTRING(5 5,5 5)') as geom union all select st_geomfromewkt('srid=3857;LINESTRING(1 1, 2 2)') as geom ) select st_collect(geom) from lines;
Change History (2)
comment:1 by , 3 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 3 years ago
ST_ShortestLine(A, B) produces a zero length line if A and B intersect. As per the OGC spec ST_ShortestLine does not work correctly? Should the problem be reported there?
Note:
See TracTickets
for help on using tickets.
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.
You can get result you expect if you make sure your geom is valid.