[postgis-devel] error in TopoGeo_AddLineString return?

Rémi Cura remi.cura at gmail.com
Fri Jul 17 05:50:39 PDT 2015


Hey,
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

Cheers,
Rémi-C

2015-07-17 13:01 GMT+02:00 Sandro Santilli <strk at keybit.net>:

> On Fri, Jul 17, 2015 at 12:38:19PM +0200, Rémi Cura wrote:
> > Hey,
> > it seems like the return of TopoGeo_AddLineString
> > is missing something.
> >
> >
> > Using cross shaped linestring
> > 'LINESTRING(0 0 , 10 10)'
> > 'LINESTRING(0 10 , 10 0)'
> >
> > I insert it into topology with TopoGeo_AddLineString
> > _The output topology is correct_
> >
> > But, the function TopoGeo_AddLineString returns only 3 edge_id, rather
> than
> > the 4 that were created.
>
> Could you turn this into a testcase to be added to our suite ?
>
> --strk;
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20150717/b4fcb15f/attachment.html>


More information about the postgis-devel mailing list