[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] ST_UNION - Exception in LWGEOM2GEOS
From:       "Paragon Corporation" <lr () pcorp ! us>
Date:       2009-10-27 19:17:29
Message-ID: 8184719CB0FD4FF9B9581ECF2F47B662 () b
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@postgis.refractions.net
[mailto:postgis-users-bounces@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@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@postgis.refractions.net
[mailto:postgis-users-bounces@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@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18828"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>Mehmet,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>One point does not make a linestring :)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>I suppose what you could do is change these to points with 
something of the form</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>UPDATE ways</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>SET linestring = ST_PointN(linestring,1)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>WHERE ST_NPoints(linestring) = 1</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>though you'll need to drop your geometry type constraint on 
your table first to do that.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>Alternatively you could just delete these records&nbsp; sine 
they are cases where ST_MakeLine had only one point in the 
result).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920491419-27102009><FONT color=#0000ff 
size=2 face=Arial>Regina</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> 
postgis-users-bounces@postgis.refractions.net 
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of 
</B>Mehmet Sirin<BR><B>Sent:</B> Tuesday, October 27, 2009 3:13 PM<BR><B>To:</B> 
PostGIS Users Discussion<BR><B>Subject:</B> Re: [postgis-users] ST_UNION - 
Exception in LWGEOM2GEOS<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Hi,&nbsp;<BR></DIV>
<DIV>indeed there are some linestrings with only 1 Point.</DIV>
<DIV>But I don't know how come.. after checking these points I saw that they are 
nothing but normal </DIV>
<DIV>points on the way ,that means nothing special that should cause a 
problem.</DIV>
<DIV></DIV>
<DIV>one of then is on the way 'Ahlde' -&gt; "LINESTRING(7.3402594 
52.3361277)"</DIV>
<DIV></DIV>
<DIV>maybe you should know, that I imported data via osmosis and then created 
linestringsby using :</DIV>
<DIV></DIV>
<DIV>&nbsp; UPDATE ways w SET linestring = (<BR>&nbsp; SELECT MakeLine(c.geom) 
AS way_line FROM (<BR>&nbsp; SELECT n.geom AS geom FROM nodes n INNER JOIN 
way_nodes&nbsp;<BR>wn ON <A href="http://n.id">n.id</A> = wn.node_id<BR>&nbsp; 
WHERE (wn.way_id = <A href="http://w.id">w.id</A>) ORDER BY 
wn.sequence_id<BR>&nbsp; ) c<BR>&nbsp; );<BR><BR></DIV>
<DIV></DIV><BR>
<DIV class=gmail_quote>2009/10/27 Paragon Corporation <SPAN dir=ltr>&lt;<A 
href="mailto:lr@pcorp.us">lr@pcorp.us</A>&gt;</SPAN><BR>
<BLOCKQUOTE 
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" 
class=gmail_quote>
  <DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2 
  face=Arial>Mehmet,</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2 face=Arial>It sounds 
  like your line string might have 0 or 1 points.</FONT></SPAN></DIV>
  <DIV dir=ltr align=left>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2 
  face=Arial>Use</FONT></SPAN></DIV>
  <DIV dir=ltr align=left>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2 
  face=Arial>ST_NPoints(linestring) &lt; 2&nbsp; to find all linestrings with 
  fewer than 2 points</FONT></SPAN></DIV>
  <DIV dir=ltr align=left>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2 
  face=Arial>Leo</FONT></SPAN></DIV><BR>
  <DIV dir=ltr lang=en-us align=left>
  <HR>
  <FONT size=2 face=Tahoma><B>From:</B> <A 
  href="mailto:postgis-users-bounces@postgis.refractions.net" 
  target=_blank>postgis-users-bounces@postgis.refractions.net</A> [mailto:<A 
  href="mailto:postgis-users-bounces@postgis.refractions.net" 
  target=_blank>postgis-users-bounces@postgis.refractions.net</A>] <B>On Behalf 
  Of </B>Mehmet Sirin<BR><B>Sent:</B> Monday, October 26, 2009 7:24 
  PM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> [postgis-users] 
  ST_UNION - Exception in LWGEOM2GEOS<BR></FONT><BR></DIV>
  <DIV>
  <DIV class=h5>
  <DIV>Hi,<BR></DIV>
  <DIV>I just tried to create a mutlilinestring out of a set of linestrings 
  via&nbsp;</DIV>
  <DIV>SELECT AsText( ST_UNION(linestring) )<BR><BR>FROM ways w, way_tags wt 
  WHERE <A href="http://w.id" target=_blank>w.id</A>=wt.way_id&nbsp;<BR>AND 
  wt.v='Dörnter Weg'<BR><BR></DIV>
  <DIV>(it lies in Osnabrück, lower saxony)</DIV>
  <DIV>but I'm getting this strange error:&nbsp;</DIV>
  <DIV>HINWEIS: IllegalArgumentException: point array must contain 0 or &gt;1 
  elements<BR><BR><BR>FEHLER: Exception in LWGEOM2GEOS<BR><BR>********** Fehler 
  **********<BR><BR>FEHLER: Exception in LWGEOM2GEOS<BR>SQL 
  Status:XX000<BR><BR><BR></DIV>
  <DIV>Replacing&nbsp;wt.v='Dörnter Weg' with&nbsp;wt.v='Some other Streets' it 
  works properly.&nbsp;</DIV>
  <DIV>So it is because of this street 'Dörnter Weg' (i got a few other ones of 
  this kind in my database). </DIV>
  <DIV>Anybody can tell me why these sort of ways leads to a problem?</DIV>
  <DIV>thank you</DIV>
  <DIV>kind regards</DIV>
  <DIV>mehmet 
  sirin</DIV></DIV></DIV></DIV><BR>_______________________________________________<BR>postgis-users \
  mailing list<BR><A 
  href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR><A \
  href="http://postgis.refractions.net/mailman/listinfo/postgis-users" 
  target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR><BR></BLOCKQUOTE></DIV><BR></BODY></HTML>




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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic