[postgis-users] ST_UNION - Exception in LWGEOM2GEOS

Paragon Corporation lr at pcorp.us
Tue Oct 27 12:17:29 PDT 2009


Mehmet,
 
One point does not make a linestring :)
 
I suppose what you could do is change these to points with something of the
form
 
UPDATE ways
SET linestring = ST_PointN(linestring,1)
WHERE ST_NPoints(linestring) = 1
 
though you'll need to drop your geometry type constraint on your table first
to do that.
 
Alternatively you could just delete these records  sine they are cases where
ST_MakeLine had only one point in the result).
 
Hope that helps,
Regina

  _____  

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Mehmet
Sirin
Sent: Tuesday, October 27, 2009 3:13 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] ST_UNION - Exception in LWGEOM2GEOS


Hi, 

indeed there are some linestrings with only 1 Point.
But I don't know how come.. after checking these points I saw that they are
nothing but normal 
points on the way ,that means nothing special that should cause a problem.
one of then is on the way 'Ahlde' -> "LINESTRING(7.3402594 52.3361277)"
maybe you should know, that I imported data via osmosis and then created
linestringsby using :
  UPDATE ways w SET linestring = (
  SELECT MakeLine(c.geom) AS way_line FROM (
  SELECT n.geom AS geom FROM nodes n INNER JOIN way_nodes 
wn ON n.id = wn.node_id
  WHERE (wn.way_id = w.id) ORDER BY wn.sequence_id
  ) c
  );



2009/10/27 Paragon Corporation <lr at pcorp.us>


Mehmet,
It sounds like your line string might have 0 or 1 points.
 
Use
 
ST_NPoints(linestring) < 2  to find all linestrings with fewer than 2 points
 
Leo

  _____  

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Mehmet
Sirin
Sent: Monday, October 26, 2009 7:24 PM
To: PostGIS Users Discussion
Subject: [postgis-users] ST_UNION - Exception in LWGEOM2GEOS


Hi,

I just tried to create a mutlilinestring out of a set of linestrings via 
SELECT AsText( ST_UNION(linestring) )

FROM ways w, way_tags wt WHERE w.id=wt.way_id 
AND wt.v='Dörnter Weg'


(it lies in Osnabrück, lower saxony)
but I'm getting this strange error: 
HINWEIS: IllegalArgumentException: point array must contain 0 or >1 elements


FEHLER: Exception in LWGEOM2GEOS

********** Fehler **********

FEHLER: Exception in LWGEOM2GEOS
SQL Status:XX000



Replacing wt.v='Dörnter Weg' with wt.v='Some other Streets' it works
properly. 
So it is because of this street 'Dörnter Weg' (i got a few other ones of
this kind in my database). 
Anybody can tell me why these sort of ways leads to a problem?
thank you
kind regards
mehmet sirin

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20091027/47b05761/attachment.html>


More information about the postgis-users mailing list