[postgis-tickets] [PostGIS] #3205: missing output for TopoGeo_AddLineString

PostGIS trac at osgeo.org
Sat Jul 18 01:29:22 PDT 2015


#3205: missing output for TopoGeo_AddLineString
-----------------------+---------------------------
  Reporter:  remic     |      Owner:  strk
      Type:  defect    |     Status:  new
  Priority:  medium    |  Milestone:  PostGIS 2.1.9
 Component:  topology  |    Version:  2.1.x
Resolution:            |   Keywords:
-----------------------+---------------------------
Description changed by robe:

Old description:

> 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

New description:

 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

 }}}

--

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3205#comment:2>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list