Why? Where do I have to look if not at the nodes???<br><br>K.<br><br><div class="gmail_quote">2011/4/9 Jochen Topf <span dir="ltr"><<a href="mailto:jochen@remote.org">jochen@remote.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
You can have several nodes on the same position which could also lead to a<br>
broken geometry but will not be caught be looking just at the nodes.<br>
<br>
Jochen<br>
<br>
On Sat, Apr 09, 2011 at 02:22:58PM +0400, Kirill Bestoujev wrote:<br>
> Date: Sat, 9 Apr 2011 14:22:58 +0400<br>
<div class="im">> From: Kirill Bestoujev <<a href="mailto:bestoujev@gmail.com">bestoujev@gmail.com</a>><br>
</div>> To: <a href="mailto:osmosis-dev@openstreetmap.org">osmosis-dev@openstreetmap.org</a><br>
<div class="im">> Subject: Re: [osmosis-dev] one node ways<br>
><br>
</div><div class="im">> And in works!<br>
><br>
> and (select count(1) from (select n.geom as geom, count(1) as node_count<br>
> 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 =<br>
</div>> w.idgroup by 1) n_group) > 1<br>
<div class="im">><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,<br>
> 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>
> 2011/4/9 Kirill Bestoujev <<a href="mailto:bestoujev@gmail.com">bestoujev@gmail.com</a>><br>
><br>
> > Sure, I know this. But if I create an indes with, for example, a st_within<br>
> > 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<br>
> > linesting update sql-command the following line:<br>
> ><br>
> > and (select count(1) from (select n.geom as geom, count(1) as node_count<br>
</div>> > 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 = w.idgroup by 1) n_group) > 1<br>
<div><div></div><div class="h5">> ><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.<br>
> > UncategorizedSQLException: PreparedStatementCallback; uncategorized<br>
> > SQLException for SQL [UPDATE ways w SET linestring = ( SELECT<br>
> > MakeLine(c.geom) AS way_line FROM ( SELECT n.geom AS geom FROM nodes n INNER<br>
> > 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<br>
> > array_length(nodes, 1) > 1 ORDER BY wn.sequence_id ) c ) WHERE <a href="http://w.id" target="_blank">w.id</a>  = ?];<br>
> > SQL state [XX000]; error code [0]; ERROR: Exception in LWGEOM2GEOS; nested<br>
> > exception is org.postgresql.util.PSQLException: ERROR: Exception in<br>
> > LWGEOM2GEOS<br>
> ><br>
> > the added code - and array_length(nodes, 1) > 1 - which I thought was<br>
> > solving the problem does not work OR there is an other problem - not one<br>
> > node ways.<br>
> ><br>
> > Kirill<br>
> ><br>
> ><br>
> > 2011/4/9 Jochen Topf <<a href="mailto:jochen@remote.org">jochen@remote.org</a>><br>
> ><br>
> >> Hi!<br>
> >><br>
> >> This has worked for me: I use the ST_isvalid() function in Postgis to find<br>
> >> out<br>
> >> if a geometry is valid. If not, I either delete the way or set the<br>
> >> geometry to<br>
> >> NULL and then do all further processing only on ways with geometry !=<br>
> >> 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">bestoujev@gmail.com</a>><br>
> >> > To: Igor Podolskiy <<a href="mailto:igor.podolskiy@vwi-stuttgart.de">igor.podolskiy@vwi-stuttgart.de</a>><br>
> >> > Cc: osmosis-dev <<a href="mailto:osmosis-dev@openstreetmap.org">osmosis-dev@openstreetmap.org</a>><br>
> >> > Subject: Re: [osmosis-dev] one node ways<br>
> >> ><br>
> >> > Igor,<br>
> >> ><br>
> >> > the context is simple - we have a mirror of the planet, we update if<br>
> >> with<br>
> >> > replication with minute diffs.<br>
> >> ><br>
> >> > You may have a look at way 35966868 to see the problem by yourself.<br>
> >> 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">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<br>
> >> 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<br>
> >> you're<br>
> >> > > using, the kind of data you're trying to put in the database - that<br>
> >> would be<br>
> >> > > very helpful.<br>
> >> > ><br>
> >> > > Regards<br>
> >> > > Igor<br>
> >> > ><br>
> >><br>
> >> > _______________________________________________<br>
> >> > osmosis-dev mailing list<br>
> >> > <a href="mailto:osmosis-dev@openstreetmap.org">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>
> >> --<br>
> >> Jochen Topf  <a href="mailto:jochen@remote.org">jochen@remote.org</a>  <a href="http://www.remote.org/jochen/" target="_blank">http://www.remote.org/jochen/</a> +49-721-388298<br>
> >><br>
> >><br>
> ><br>
<br>
> _______________________________________________<br>
> osmosis-dev mailing list<br>
> <a href="mailto:osmosis-dev@openstreetmap.org">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>
--<br>
Jochen Topf  <a href="mailto:jochen@remote.org">jochen@remote.org</a>  <a href="http://www.remote.org/jochen/" target="_blank">http://www.remote.org/jochen/</a>  +49-721-388298<br>
<br>
</div></div></blockquote></div><br>