[postgis-tickets] [PostGIS] #4991: st_union of single row should keep the row intact

PostGIS trac at osgeo.org
Tue Sep 14 05:15:34 PDT 2021


#4991: st_union of single row should keep the row intact
---------------------+---------------------------
 Reporter:  michal   |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 3.1.5
Component:  postgis  |    Version:  3.1.x
 Keywords:           |
---------------------+---------------------------
 when using st_union as aggregate and applied only to a single row, the
 result should be identical to the original row. (eg grouping by user_id,
 the users with just one geometry should by returned the original geometry)

 the following query:

 `select st_astext(st_union(st_geomfromtext('LINESTRING(17.1043382
 48.1402074,17.1042455 48.1401187,17.1041991 48.1400716,17.1042055
 48.1398829,17.1042068 48.139845,17.1036456 48.139859,17.1027185
 48.1398876,17.1025576 48.139914,17.1024604 48.1399439,17.1024039
 48.1399764,17.1023737 48.1400056,17.1023571 48.1400384,17.1023541
 48.1400711,17.1023659 48.1401087,17.1023811 48.1401357,17.1024202
 48.1401652,17.1025061 48.1402134,17.1026764 48.1402846,17.1036586
 48.1405359,17.1037086 48.1405476,17.1037503 48.1405545,17.1038012
 48.140559,17.1038458 48.14056,17.1038913 48.1405606,17.1039475
 48.1405575,17.1039949 48.1405504,17.104034 48.1405409,17.1040669
 48.1405298,17.104091 48.1405186,17.1041205 48.140503,17.1041562
 48.140481,17.1041879 48.1404584,17.1042111 48.140438,17.1042332
 48.1404161,17.1042533 48.1403897,17.1042754 48.1403494,17.1042942
 48.140305,17.1043882 48.1400244)')));`

 returns multilinestring, instead of a linestring:
 `MULTILINESTRING((17.104329639610913 48.14019920899124,17.1042455
 48.1401187,17.1041991 48.1400716,17.1042055 48.1398829,17.1042068
 48.139845,17.1036456 48.139859,17.1027185 48.1398876,17.1025576
 48.139914,17.1024604 48.1399439,17.1024039 48.1399764,17.1023737
 48.1400056,17.1023571 48.1400384,17.1023541 48.1400711,17.1023659
 48.1401087,17.1023811 48.1401357,17.1024202 48.1401652,17.1025061
 48.1402134,17.1026764 48.1402846,17.1036586 48.1405359,17.1037086
 48.1405476,17.1037503 48.1405545,17.1038012 48.140559,17.1038458
 48.14056,17.1038913 48.1405606,17.1039475 48.1405575,17.1039949
 48.1405504,17.104034 48.1405409,17.1040669 48.1405298,17.104091
 48.1405186,17.1041205 48.140503,17.1041562 48.140481,17.1041879
 48.1404584,17.1042111 48.140438,17.1042332 48.1404161,17.1042533
 48.1403897,17.1042754 48.1403494,17.1042942 48.140305,17.104329639610913
 48.14019920899124),(17.1043382 48.1402074,17.104329639610913
 48.14019920899124),(17.104329639610913 48.14019920899124,17.1043882
 48.1400244))`

 removing the first or the last point in the original query, returns
 linestring

 I assume there are issues with precision, but imho st_union should do
 nothing on single row entries.

 `POSTGIS="3.1.1 aaf4c79" [EXTENSION] PGSQL="130" GEOS="3.9.0-CAPI-1.16.2"
 PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3"
 WAGYU="0.5.0 (Internal)" TOPOLOGY`

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4991>
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