Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#575 closed defect (fixed)

ST_Union fails on a group of linestrings.

Reported by: jeffadams78 Owned by: pramsey
Priority: medium Milestone: PostGIS 1.5.3
Component: postgis Version: 1.5.X
Keywords: Cc: jadams


When I attempt to union these 16 linestrings (quite long, so I attached as a file), I get the following error:

NOTICE:  TopologyException: found non-noded intersection between LINESTRING (-118.323 33.7869, -118.323 33.7869) and LINESTRING (-118.323 33.7869, -118.323 33.7869) at -118.323 33.7869

ERROR:  GEOS union() threw an error!

********** Error **********

ERROR: GEOS union() threw an error!
SQL state: XX000

This seems like a bug. Isn't it supposed to be adding the node it complains is missing? This same union works fine in JTS.

NOTE: The linestrings printed in the error message are not in fact zero-length, they appear that way due to the truncation of significant digits in the error output. I tried reprojecting my data (the original data, not this particular tiny set) into 3310 and got the same error, but then the error message printed enough significant digits to make it clear they are very short, but not zero-length.

Attachments (1)

brokenunion.sql (16.7 KB ) - added by jeffadams78 14 years ago.
SQL statement that generates the error.

Download all attachments as: .zip

Change History (6)

by jeffadams78, 14 years ago

Attachment: brokenunion.sql added

SQL statement that generates the error.

comment:1 by jeffadams78, 14 years ago

Sorry, forgot to include version info:

POSTGIS="1.5.1" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.6.1, 21 August 2008" LIBXML="2.7.6" USE_STATS

comment:2 by dmkaplan2000, 13 years ago

I am having similar problems with a union of linestrings. Looking around on the web, it seems like this is a known problem. Proposed solutions seem to direct towards using another program, such as JTS.

Jeffadams78 - Did you ever find a postgis solution to this problem?

Thanks, David

comment:3 by strk, 13 years ago

Resolution: fixed
Status: newclosed

The sql runs fine here:

POSTGIS="2.0.0SVN" GEOS="3.3.0-CAPI-1.7.0" PROJ="Rel. 4.7.1, 23 September 2009"


Try upgrading your GEOS to current trunk (keeping the existing postgis should be fine)

comment:4 by jadams, 13 years ago

Cc: jadams added

strk: Yes upgrading to the GEOS trunk fixes it.

For others who want to try this:

  1. Download the trunk from
  2. tar -xvfj the file
  3. configure, make, sudo make install
  4. Remove the existing,, files from /usr/lib, replace with,, and files from /usr/local/lib.
  5. Restart postgresql.
  6. Verify you now are using GEOS 3.3.0 by running "SELECT postgis_full_version()".

comment:5 by jadams, 13 years ago

Step 5 should say remove existing libgeos* from /usr/lib since the file names aren't exactly the same.

Note: See TracTickets for help on using tickets.