Opened 13 years ago

Closed 13 years ago

#1255 closed defect (fixed)

ST_Union Returns NULL on valid geometries

Reported by: glock Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: 1.5.X
Keywords: Cc: georgevl

Description

Tested on "POSTGIS="1.5.3" GEOS="3.3.1-CAPI-1.7.1" PROJ="Rel. 4.6.1, 21 August 2008" LIBXML="2.7.8" USE_STATS (procs from 1.5 r5976 need upgrade)" and "POSTGIS="1.5.2" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.6.1, 21 August 2008" LIBXML="2.7.6" USE_STATS"

This select returns NULL. If I remove any of elements it doesn't return NULL. If I add other element it returns NULL.

SELECT ST_Union(ARRAY[ '0103000020AD1000000100000006000000A0200889D4443C40CFB5810A85EE48401C936A44D5443C40ED1799AC84EE4840A8CF1C3AD5443C40136376AA84EE484022E010AAD4443C402D3C4DB484EE484099A0E128D4443C40E8E123BC84EE4840A0200889D4443C40CFB5810A85EE4840'::geometry, '0103000020AD1000000100000006000000FA10AF46D1443C4057A1556A85EE4840FA10AF46D1443C4020C6974C86EE4840A07DF66DD2443C4040E2A91886EE4840D3AA0689D2443C4099CB190B86EE48400072C284D1443C40F20AB66885EE4840FA10AF46D1443C4057A1556A85EE4840'::geometry, '0103000020AD1000000100000004000000A8CF1C3AD5443C40136376AA84EE48401C936A44D5443C40ED1799AC84EE484036762747D5443C404C5692A984EE4840A8CF1C3AD5443C40136376AA84EE4840'::geometry, '0103000020AD1000000100000004000000A8CF1C3AD5443C40136376AA84EE48401C936A44D5443C40ED1799AC84EE484036762747D5443C404C5692A984EE4840A8CF1C3AD5443C40136376AA84EE4840'::geometry, '0103000020AD1000000100000005000000D7251260CD443C40ABD8E2CF79EE4840E8875F1ECC443C40F34BDC0679EE4840B6EC5A8CCB443C4024D3AA1D79EE48405654B3BDCC443C40256648E979EE4840D7251260CD443C40ABD8E2CF79EE4840'::geometry, '0103000020AD1000000100000005000000752AE567CE463C408199BA8A46EE4840E65C8AABCA463C40008FC6EF46EE4840E65C8AABCA463C400B10E9A147EE4840CCACEF0DCF463C40137EF92347EE4840752AE567CE463C408199BA8A46EE4840'::geometry, '0103000020AD1000000100000005000000DD877258D0463C4064C0853847EE4840DD877258D0463C409B9B435646EE4840752AE567CE463C408199BA8A46EE4840CCACEF0DCF463C40137EF92347EE4840DD877258D0463C4064C0853847EE4840'::geometry, '0103000020AD1000000100000005000000E03495D0BE463C40BBFCCF973CEE484009168733BF463C40FFD7F6833CEE484009168733BF463C40F589413F3CEE484004594FADBE463C40CEE4F2923CEE4840E03495D0BE463C40BBFCCF973CEE4840'::geometry, '0103000020AD1000000100000008000000DA21591BBE463C408B435DE83BEE4840DA21591BBE463C40F3FB2ABC3CEE4840F6723054BE463C40E801C4B03CEE484004594FADBE463C40CEE4F2923CEE484009168733BF463C40F589413F3CEE484009168733BF463C40419C46CD3BEE4840ECE86E8DBE463C40FF6518D03BEE4840DA21591BBE463C408B435DE83BEE4840'::geometry, '0103000020AD10000001000000050000002810D143C8463C405538FAAC47EE4840187D0569C6463C406A116FEB47EE4840187D0569C6463C40F0E7451248EE48402810D143C8463C40AB6C4BE047EE48402810D143C8463C405538FAAC47EE4840'::geometry, '0103000020AD1000000100000006000000380FB7E5CB463C4025BFA87E47EE4840B0E76B96CB463C405EE3153D47EE48402810D143C8463C405538FAAC47EE48402810D143C8463C40AB6C4BE047EE4840645694B7C8463C403DE301DA47EE4840380FB7E5CB463C4025BFA87E47EE4840'::geometry, '0103000020AD100000010000000600000011F274C9CE463C402FB5C5E446EE484050DF32A7CB463C401B453D3B47EE4840B0E76B96CB463C405EE3153D47EE4840380FB7E5CB463C4025BFA87E47EE4840CCACEF0DCF463C40137EF92347EE484011F274C9CE463C402FB5C5E446EE4840'::geometry, '0103000020AD1000000100000005000000DD877258D0463C4046EEC4B946EE484011F274C9CE463C402FB5C5E446EE4840CCACEF0DCF463C40137EF92347EE4840DD877258D0463C4064C0853847EE4840DD877258D0463C4046EEC4B946EE4840'::geometry, '0103000020AD1000000100000005000000DD877258D0463C4046EEC4B946EE484011F274C9CE463C402FB5C5E446EE4840CCACEF0DCF463C40137EF92347EE4840DD877258D0463C4064C0853847EE4840DD877258D0463C4046EEC4B946EE4840'::geometry, '0103000020AD1000000100000006000000DD877258D0463C4046EEC4B946EE484050DF32A7CB463C401B453D3B47EE4840B0E76B96CB463C405EE3153D47EE48404AFE841BCC463C400B6C27AB47EE4840DD877258D0463C4064C0853847EE4840DD877258D0463C4046EEC4B946EE4840'::geometry ]);

Attachments (1)

tablesposmerged.backup (2.6 MB ) - added by georgevl 13 years ago.
Backup of table containing geometries to be merged

Change History (4)

comment:1 by pramsey, 13 years ago

Well, I don't get NULL, I get

ERROR:  GEOSUnionCascaded: TopologyException: Directed Edge visited twice during ring-building at 0.276593 0.861539

against GEOS 3.2.3. So there's something we can't handle, but we shouldn't be returning NULL.

by georgevl, 13 years ago

Attachment: tablesposmerged.backup added

Backup of table containing geometries to be merged

comment:2 by georgevl, 13 years ago

Cc: georgevl added

This is also the case for me.

A set of three (see attached backup from table) geometries, all returning true from isvalid fail during st_union with following message and null output:

SELECT ST_Union(__obj) FROM tablesposmerged

NOTICE:  TopologyException: found non-noded intersection between LINESTRING (23.7087 37.9605, 23.7088 37.9606) and LINESTRING (23.7087 37.9605, 23.7087 37.9605) at 23.7087 37.9605

comment:3 by strk, 13 years ago

Resolution: fixed
Status: newclosed

Works here:

strk=# SELECT st_summary(ST_Union(ARRAY[ '0103000020AD1000000100000006000000A0200889D4443C40CFB5810A85EE48401C936A44D5443C40ED1799AC84EE4840A8CF1C3AD5443C40136376AA84EE484022E010AAD4443C402D3C4DB484EE484099A0E128D4443C40E8E123BC84EE4840A0200889D4443C40CFB5810A85EE4840'::geometry, '0103000020AD1000000100000006000000FA10AF46D1443C4057A1556A85EE4840FA10AF46D1443C4020C6974C86EE4840A07DF66DD2443C4040E2A91886EE4840D3AA0689D2443C4099CB190B86EE48400072C284D1443C40F20AB66885EE4840FA10AF46D1443C4057A1556A85EE4840'::geometry, '0103000020AD1000000100000004000000A8CF1C3AD5443C40136376AA84EE48401C936A44D5443C40ED1799AC84EE484036762747D5443C404C5692A984EE4840A8CF1C3AD5443C40136376AA84EE4840'::geometry, '0103000020AD1000000100000004000000A8CF1C3AD5443C40136376AA84EE48401C936A44D5443C40ED1799AC84EE484036762747D5443C404C5692A984EE4840A8CF1C3AD5443C40136376AA84EE4840'::geometry, '0103000020AD1000000100000005000000D7251260CD443C40ABD8E2CF79EE4840E8875F1ECC443C40F34BDC0679EE4840B6EC5A8CCB443C4024D3AA1D79EE48405654B3BDCC443C40256648E979EE4840D7251260CD443C40ABD8E2CF79EE4840'::geometry, '0103000020AD1000000100000005000000752AE567CE463C408199BA8A46EE4840E65C8AABCA463C40008FC6EF46EE4840E65C8AABCA463C400B10E9A147EE4840CCACEF0DCF463C40137EF92347EE4840752AE567CE463C408199BA8A46EE4840'::geometry, '0103000020AD1000000100000005000000DD877258D0463C4064C0853847EE4840DD877258D0463C409B9B435646EE4840752AE567CE463C408199BA8A46EE4840CCACEF0DCF463C40137EF92347EE4840DD877258D0463C4064C0853847EE4840'::geometry, '0103000020AD1000000100000005000000E03495D0BE463C40BBFCCF973CEE484009168733BF463C40FFD7F6833CEE484009168733BF463C40F589413F3CEE484004594FADBE463C40CEE4F2923CEE4840E03495D0BE463C40BBFCCF973CEE4840'::geometry, '0103000020AD1000000100000008000000DA21591BBE463C408B435DE83BEE4840DA21591BBE463C40F3FB2ABC3CEE4840F6723054BE463C40E801C4B03CEE484004594FADBE463C40CEE4F2923CEE484009168733BF463C40F589413F3CEE484009168733BF463C40419C46CD3BEE4840ECE86E8DBE463C40FF6518D03BEE4840DA21591BBE463C408B435DE83BEE4840'::geometry, '0103000020AD10000001000000050000002810D143C8463C405538FAAC47EE4840187D0569C6463C406A116FEB47EE4840187D0569C6463C40F0E7451248EE48402810D143C8463C40AB6C4BE047EE48402810D143C8463C405538FAAC47EE4840'::geometry, '0103000020AD1000000100000006000000380FB7E5CB463C4025BFA87E47EE4840B0E76B96CB463C405EE3153D47EE48402810D143C8463C405538FAAC47EE48402810D143C8463C40AB6C4BE047EE4840645694B7C8463C403DE301DA47EE4840380FB7E5CB463C4025BFA87E47EE4840'::geometry, '0103000020AD100000010000000600000011F274C9CE463C402FB5C5E446EE484050DF32A7CB463C401B453D3B47EE4840B0E76B96CB463C405EE3153D47EE4840380FB7E5CB463C4025BFA87E47EE4840CCACEF0DCF463C40137EF92347EE484011F274C9CE463C402FB5C5E446EE4840'::geometry, '0103000020AD1000000100000005000000DD877258D0463C4046EEC4B946EE484011F274C9CE463C402FB5C5E446EE4840CCACEF0DCF463C40137EF92347EE4840DD877258D0463C4064C0853847EE4840DD877258D0463C4046EEC4B946EE4840'::geometry, '0103000020AD1000000100000005000000DD877258D0463C4046EEC4B946EE484011F274C9CE463C402FB5C5E446EE4840CCACEF0DCF463C40137EF92347EE4840DD877258D0463C4064C0853847EE4840DD877258D0463C4046EEC4B946EE4840'::geometry, '0103000020AD1000000100000006000000DD877258D0463C4046EEC4B946EE484050DF32A7CB463C401B453D3B47EE4840B0E76B96CB463C405EE3153D47EE48404AFE841BCC463C400B6C27AB47EE4840DD877258D0463C4064C0853847EE4840DD877258D0463C4046EEC4B946EE4840'::geometry ]));
           st_summary            
---------------------------------
 MultiPolygon[B] with 5 elements
   Polygon[] with 1 rings
    ring 0 has 10 points
   Polygon[] with 1 rings
    ring 0 has 5 points
   Polygon[] with 1 rings
    ring 0 has 6 points
   Polygon[] with 1 rings
    ring 0 has 7 points
   Polygon[] with 1 rings
    ring 0 has 16 points
 
(1 row)
strk=# select postgis_full_version();
                                                                postgis_full_version                                                                 
-----------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="2.0.0SVN" GEOS="3.3.2dev-CAPI-1.7.2" PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.9dev, released 2011/01/18" LIBXML="2.7.6" USE_STATS
(1 row)

Note: See TracTickets for help on using tickets.