<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Hey,<br></div><div class="gmail_default" style="font-family:monospace,monospace">here is the script (bottom)<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">The error in TopoGeo_AddLineString seems to be ligne 90 94 <br>"start_node := topology.TopoGeo_AddPoint"<br></div><div class="gmail_default" style="font-family:monospace,monospace">From what I understood, topogeo_addpoint has the ability to split edges, but we don't have any way to get the edge_id of the split edge by addpoint.<br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">I don't see an easy workaround (would need to modify topogeo_addpoint to return edge_id, which is a big API change).<br></div><div class="gmail_default" style="font-family:monospace,monospace">The simplest would be to check before addpoint if the point is going to split, <br></div><div class="gmail_default" style="font-family:monospace,monospace">then if yes save edge_id already existing, addpoint, then look for thhe new edge_id resulting from the split.<br></div><div class="gmail_default" style="font-family:monospace,monospace">There would be worysome cornercase (what if addpoint is used on top of an existing node)<br></div><div class="gmail_default" style="font-family:monospace,monospace"><br>----------------<br><br>SELECT DropTopology('test_postgis_topology');<br>SELECT CreateTopology('test_postgis_topology',0,0.1,false); --2<br><br>DROP TABLE IF EXISTS  test_postgis_topology.test_topogeo_linestring ; <br>CREATE TABLE test_postgis_topology.test_topogeo_linestring AS<br>SELECT 1 AS gid, 'id1' AS id,ST_GeomFromtext('LINESTRING(0 0 , 10 10)',0) AS geom<br>UNION <br>SELECT 2 AS gid, 'id2' AS id, ST_GeomFromtext('LINESTRING(0 10 , 10 0)',0) ; <br><br>WITH result_addlinestring AS (<br>SELECT id,  topology.TopoGeo_AddLineString(<br>                'test_postgis_topology'<br>                , geom <br>                , 0.01) as edge_id<br>    FROM test_postgis_topology.test_topogeo_linestring<br>) <br>SELECT count(*) = 4 AS is_TopoGeo_AddLineString_working<br>FROM (SELECT DISTINCT * FROM result_addlinestring) AS sub ; <br><br>DROP TABLE IF EXISTS  test_postgis_topology.test_topogeo_linestring ; <br>SELECT DropTopology('test_postgis_topology');<br><br>----------------<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">The function should return 4 different edge_ids, which it does not.<br><br><br></div><div class="gmail_default" style="font-family:monospace,monospace">Hint for workaround : post processing, looking for edge_id that have not been returned,<br></div><div class="gmail_default" style="font-family:monospace,monospace">with surface distance<br><br>SELECT DISTINCT ON (pe.edge_id) edge_id, gid<br>    FROM problematic_edges AS pe, my_source_lines AS ul <br>    WHERE ST_DWithin(pe.geom,t,1) = TRUE <br>    ORDER BY pe.edge_id, ST_Area(ST_Intersection(ST_Buffer(pe.geom,1,'quad_segs=2'),ST_Buffer(ul,1,'quad_segs=2'))) DESC<br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Cheers,<br></div><div class="gmail_default" style="font-family:monospace,monospace">Rémi-C<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-07-17 13:01 GMT+02:00 Sandro Santilli <span dir="ltr"><<a href="mailto:strk@keybit.net" target="_blank">strk@keybit.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Jul 17, 2015 at 12:38:19PM +0200, Rémi Cura wrote:<br>
> Hey,<br>
> it seems like the return of TopoGeo_AddLineString<br>
> is missing something.<br>
><br>
><br>
> Using cross shaped linestring<br>
> 'LINESTRING(0 0 , 10 10)'<br>
> 'LINESTRING(0 10 , 10 0)'<br>
><br>
> I insert it into topology with TopoGeo_AddLineString<br>
> _The output topology is correct_<br>
><br>
> But, the function TopoGeo_AddLineString returns only 3 edge_id, rather than<br>
> the 4 that were created.<br>
<br>
</span>Could you turn this into a testcase to be added to our suite ?<br>
<br>
--strk;<br>
_______________________________________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel</a><br>
</blockquote></div><br></div>