Opened 4 years ago

Last modified 4 months ago

#3205 new defect

missing output for TopoGeo_AddLineString

Reported by: remic Owned by: strk
Priority: medium Milestone: PostGIS 2.5.4
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 (7)

comment:1 Changed 4 years ago by robe

Description: modified (diff)

comment:2 Changed 4 years ago by robe

Description: modified (diff)

comment:3 Changed 2 years ago by pramsey

Milestone: PostGIS 2.1.9PostGIS 2.2.6

comment:4 Changed 2 years ago by pramsey

Milestone: PostGIS 2.2.6PostGIS 2.2.7

comment:5 Changed 21 months ago by robe

Milestone: PostGIS 2.2.7PostGIS 2.2.8

comment:6 Changed 6 months ago by Algunenano

Milestone: PostGIS 2.2.8PostGIS 2.3.10

Moving to a non EOL release.

comment:7 Changed 4 months ago by robe

Milestone: PostGIS 2.3.10PostGIS 2.5.4
Note: See TracTickets for help on using tickets.