And in works!<br><br>and (select count(1) from (select n.geom as geom, count(1) as node_count
from way_nodes wn join nodes n on <a href="http://n.id/" target="_blank">n.id</a> = wn.node_id where wn.way_id =
<a href="http://w.id/" target="_blank">w.id</a> group by 1) n_group) > 1<br><br>added to the request below works fine!<br><br>I will look at it for a couple of days to make sure it works in all cases, but looks like it is a solution.<br>
<br>What is the process of merging it into osmosis distro?<br><br>The pg_snapshot and pg_simple load scripts should also be updated!<br><br>Kirill<br><br><div class="gmail_quote">2011/4/9 Kirill Bestoujev <span dir="ltr"><<a href="mailto:bestoujev@gmail.com">bestoujev@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Sure, I know this. But if I create an indes with, for example, a st_within condition, than osmosis falls already while replicating diffs...<br>
<br>That's why I want to solve the problem in osmosis itself, not in the db.<br>
<br>Yesterday on Russian irc channel we found a solution to add to NodeDao.java linesting update sql-command the following line:<br><br>and (select count(1) from (select n.geom as geom, count(1) as node_count
from way_nodes wn join nodes n on <a href="http://n.id" target="_blank">n.id</a> = wn.node_id where wn.way_id =
<a href="http://w.id" target="_blank">w.id</a> group by 1) n_group) > 1<br><br>This solves the problem with ways having only duplicate nodes in them.<br><br>But the recompiled version of osmosis falls on the following command:<br>
<br>
org.springframework.jdbc.<div>UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [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 <a href="http://n.id/" target="_blank">n.id</a> = wn.node_id WHERE (wn.way_id = <a href="http://w.id/" target="_blank">w.id</a>) and array_length(nodes, 1) > 1 ORDER BY wn.sequence_id ) c ) WHERE <a href="http://w.id/" target="_blank">w.id</a> = ?]; SQL state [XX000]; error code [0]; ERROR: Exception in LWGEOM2GEOS; nested exception is org.postgresql.util.PSQLException: ERROR: Exception in LWGEOM2GEOS<br>
<br>the added code - and array_length(nodes, 1) > 1 - which I thought was solving the problem does not work OR there is an other problem - not one node ways.<br><font color="#888888"><br>Kirill <br></font></div><div><div>
</div><div class="h5"><br><br><div class="gmail_quote">2011/4/9 Jochen Topf <span dir="ltr"><<a href="mailto:jochen@remote.org" target="_blank">jochen@remote.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi!<br>
<br>
This has worked for me: I use the ST_isvalid() function in Postgis to find out<br>
if a geometry is valid. If not, I either delete the way or set the geometry to<br>
NULL and then do all further processing only on ways with geometry != NULL.<br>
<br>
Jochen<br>
<br>
On Fri, Apr 08, 2011 at 08:55:43PM +0400, Kirill Bestoujev wrote:<br>
> Date: Fri, 8 Apr 2011 20:55:43 +0400<br>
> From: Kirill Bestoujev <<a href="mailto:bestoujev@gmail.com" target="_blank">bestoujev@gmail.com</a>><br>
> To: Igor Podolskiy <<a href="mailto:igor.podolskiy@vwi-stuttgart.de" target="_blank">igor.podolskiy@vwi-stuttgart.de</a>><br>
> Cc: osmosis-dev <<a href="mailto:osmosis-dev@openstreetmap.org" target="_blank">osmosis-dev@openstreetmap.org</a>><br>
> Subject: Re: [osmosis-dev] one node ways<br>
<div><div></div><div>><br>
> Igor,<br>
><br>
> the context is simple - we have a mirror of the planet, we update if with<br>
> replication with minute diffs.<br>
><br>
> You may have a look at way 35966868 to see the problem by yourself. After<br>
> creation of geom by osmosis it looks like LINESTRING(2.2321042<br>
> 48.7767191,2.2321042 48.7767191) which is not good.<br>
><br>
><br>
><br>
> K.<br>
><br>
> 2011/4/8 Igor Podolskiy <<a href="mailto:igor.podolskiy@vwi-stuttgart.de" target="_blank">igor.podolskiy@vwi-stuttgart.de</a>><br>
><br>
> > Hi Kirill,<br>
> ><br>
> ><br>
> > When a one node way is present in the database and osmosis creates a<br>
> >> linestring geometry for it the resulting geometry is something like<br>
> >> LINESTRING(139.386972 37.095865)<br>
> >><br>
> >> When we process this linestring with any postgis function it gives us<br>
> >> an error - the linestring must contain 0 or > 1 nodes.<br>
> >><br>
> ><br>
> > I think I understand the problem but I'm having a hard time understanding<br>
> > the context :) Could you maybe provide a simple example and/or a<br>
> > step-by-step guide to reproduce this? Like the osmosis command line you're<br>
> > using, the kind of data you're trying to put in the database - that would be<br>
> > very helpful.<br>
> ><br>
> > Regards<br>
> > Igor<br>
> ><br>
<br>
</div></div><div><div></div><div>> _______________________________________________<br>
> osmosis-dev mailing list<br>
> <a href="mailto:osmosis-dev@openstreetmap.org" target="_blank">osmosis-dev@openstreetmap.org</a><br>
> <a href="http://lists.openstreetmap.org/listinfo/osmosis-dev" target="_blank">http://lists.openstreetmap.org/listinfo/osmosis-dev</a><br>
<br>
<br>
</div></div><font color="#888888">--<br>
Jochen Topf <a href="mailto:jochen@remote.org" target="_blank">jochen@remote.org</a> <a href="http://www.remote.org/jochen/" target="_blank">http://www.remote.org/jochen/</a> +49-721-388298<br>
<br>
</font></blockquote></div><br>
</div></div></blockquote></div><br>