Opened 9 years ago

Closed 9 years ago

#1232 closed defect (fixed)

Exception when calling isValid on multilinestring with only 1 point

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

Description

On the attached table, the story goes like this:

select isvalid(the_geom) from geosbug

NOTICE: IllegalArgumentException?: point array must contain 0 or >1 elements

ERROR: Exception in LWGEOM2GEOS

Error

ERROR: Exception in LWGEOM2GEOS SQL state: XX000

Attachments (1)

geosbug.sql (803 bytes) - added by hopfgartner 9 years ago.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by hopfgartner

Attachment: geosbug.sql added

comment:1 Changed 9 years ago by hopfgartner

I've forgot the software version:

"POSTGIS="1.5.3" GEOS="3.3.1-CAPI-1.7.1" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.6.26" USE_STATS (procs from 1.5 r5385 need upgrade)"

The data was probably imported by shp2pgsql and originates from some proprietary system, probably ESRI.

Regards,

Peter

comment:2 Changed 9 years ago by strk

Milestone: PostGIS 2.0.0PostGIS 1.5.4

This bug was supposedly fixed with 1.5.3, as long as built against GEOS-3.3.0+ or 3.2.3+. I suggest you rebuild postgis from scratch and don't miss to source the postgis_upgrade_minor.sql or however it's called (see the procs..need upgrade message)

comment:3 Changed 9 years ago by hopfgartner

I've compiled and installed GEOS 3.3.1:

[root@rpm-devel x86_64]# rpm -qa | grep geos geos-3.3.1-2.el5 geos-php-3.3.1-2.el5 geos-devel-3.3.1-2.el5

I compiled PostgreSQL 1.5.3 and installed the postgis packages:

bash-3.2$ rpm -qa | grep postgis postgis-1.5.3-3.el5 postgis-docs-1.5.3-1.el5.elgis postgis-utils-1.5.3-3.el5

test1232=# select postgis_full_version();

postgis_full_version


POSTGIS="1.5.3" GEOS="3.3.1-CAPI-1.7.1" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.6.26" USE_STATS

I've loaded the data from the attached dump, but: test1232=# select isvalid(the_geom) from geosbug; NOTICE: IllegalArgumentException?: point array must contain 0 or >1 elements

ERROR: Exception in LWGEOM2GEOS

Peter

comment:4 Changed 9 years ago by strk

I was wrong about the new ST_IsValid support being available in 1.5.3. It is in 2.0, togheter with ST_MakeValid:

strk=# select postgis_full_version();
                       postgis_full_version                                             
-------------------------------------------------------------------------------------------------------------
 POSTGIS="2.0.0SVN" GEOS="3.4.0dev-CAPI-1.8.0" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.6" USE_STATS
(1 row)

strk=# select gid, st_isvalid(the_geom) from geosbug;
  gid  | st_isvalid 
-------+------------
 12202 | f
(1 row)

strk=# select gid, st_isvalidreason(the_geom) from geosbug;
  gid  |                          st_isvalidreason                           
-------+---------------------------------------------------------------------
 12202 | IllegalArgumentException: point array must contain 0 or >1 elements
       : 
(1 row)

strk=# select gid, st_astext(st_makevalid(the_geom)) from geosbug;
  gid  |             st_astext             
-------+-----------------------------------
 12202 | MULTIPOINT(1737689.37 5082819.07)
(1 row)

I don't know if this is worth backporting to 1.5 (the ST_IsValid part)

comment:5 Changed 9 years ago by hopfgartner

I, personally, can live without backport.

comment:6 Changed 9 years ago by strk

Milestone: PostGIS 1.5.4PostGIS 2.0.0
Resolution: fixed
Status: newclosed

Let's all be happy with 2.0 introducing this then.

Note: See TracTickets for help on using tickets.