Opened 9 years ago

Last modified 3 years ago

#3205 closed defect

missing output for TopoGeo_AddLineString — at Version 1

Reported by: remic Owned by: strk
Priority: medium Milestone: PostGIS 3.0.3
Component: topology Version: 2.1.x
Keywords: Cc:

Description (last modified by robe)

it seems like the return of TopoGeo_AddLineString is missing something.

here is the script (bottom)

The error in TopoGeo_AddLineString seems to be ligne 90 94 "start_node := topology.TopoGeo_AddPoint" 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.

I don't see an easy workaround (would need to modify topogeo_addpoint to return edge_id, which is a big API change). The simplest would be to check before addpoint if the point is going to split, then if yes save edge_id already existing, addpoint, then look for thhe new edge_id resulting from the split. There would be worysome cornercase (what if addpoint is used on top of an existing node)


SELECT DropTopology('test_postgis_topology');
SELECT CreateTopology('test_postgis_topology',0,0.1,false); --2

DROP TABLE IF EXISTS  test_postgis_topology.test_topogeo_linestring ;
CREATE TABLE test_postgis_topology.test_topogeo_linestring AS
SELECT 1 AS gid, 'id1' AS id,ST_GeomFromtext('LINESTRING(0 0 , 10 10)',0) AS geom
UNION
SELECT 2 AS gid, 'id2' AS id, ST_GeomFromtext('LINESTRING(0 10 , 10 0)',0) ;

WITH result_addlinestring AS (
SELECT id,  topology.TopoGeo_AddLineString(
                'test_postgis_topology'
                , geom
                , 0.01) as edge_id
    FROM test_postgis_topology.test_topogeo_linestring
)
SELECT count(*) = 4 AS is_TopoGeo_AddLineString_working
FROM (SELECT DISTINCT * FROM result_addlinestring) AS sub ;

DROP TABLE IF EXISTS  test_postgis_topology.test_topogeo_linestring ;
SELECT DropTopology('test_postgis_topology');

The function should return 4 different edge_ids, which it does not.

Hint for workaround : post processing, looking for edge_id that have not been returned, with surface distance

SELECT DISTINCT ON (pe.edge_id) edge_id, gid

FROM problematic_edges AS pe, my_source_lines AS ul WHERE ST_DWithin(pe.geom,t,1) = TRUE 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

Change History (1)

comment:1 by robe, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.