[postgis-users] error: by topology.topogeometry

paul.malm at lfv.se paul.malm at lfv.se
Tue Mar 26 07:07:55 PDT 2019

Hi, when I run this sql queries

SELECT fname, the_geom FROM public."RST_1813_UTM31N_WE_D_R_Line"
SELECT fname, the_geom FROM public."CTR_1813_UTM31N_WE_line");

UPDATE merged set the_geom = st_makevalid(the_geom);

CREATE INDEX gid ON merged USING GIST ( the_geom );

SELECT Populate_Geometry_Columns('merged'::regclass);

SELECT topology.CreateTopology('roads_topo', 32631, 1.001);

SELECT topology.AddTopoGeometryColumn('roads_topo', 'public', 'merged', 'topo_geom', 'LINESTRING');

UPDATE merged SET topo_geom = topology.toTopoGeom(the_geom, 'roads_topo',  1,  0.001);

CREATE TABLE public."roads_clean" AS (
    SELECT  fname, topo_geom::geometry FROM merged);

SELECT topology.DropTopoGeometryColumn('public', 'merged', 'topo_geom');
SELECT topology.DropTopology('roads_topo');

I get the following error:
ERROR: Error: SQL/MM Spatial exception - geometry crosses edge 8618 CONTEXT: PL/pgSQL-function topology.totopogeom(geometry,topology.topogeometry,double precision) line 112 at FOR over SELECT-rows PL/pgSQL-function topology.totopogeom(geometry,character varying,integer,double precision) line 88 at assignment

The error appears at different edges  when changing the tolerance on CreateTopology and toTopoGeom.
I added the ST_makeValid function call on the input data without any success.
Does anyone know what I can do?
Kind regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190326/cd8fe2c8/attachment.html>

More information about the postgis-users mailing list