[postgis-users] totopogeom resulting in SQL/MM Spatial exception

Sandro Santilli strk at kbt.io
Wed Jan 16 09:37:24 PST 2019


On Wed, Jan 16, 2019 at 10:26:12AM -0700, Bo Guo wrote:
> strk,
> 
> Here is how it break up the topo geom conversion (l_tolerance is 0.0000001)
> 
>             LOOP
>                 WITH foo AS (SELECT grd_id FROM azgiv.roadcenterlines
>                                 WHERE grd_topo_geom IS NULL
>                                     LIMIT l_batch_size)
>                 UPDATE azgiv.roadcenterlines
>                                 SET grd_topo_geom =
> topology.totopogeom(grd_geom, 'azgiv_topo', l_topo_layer_id, l_tolerance)
>                                 FROM foo
>                                 WHERE foo.grd_id = roadcenterlines.grd_id;
> 
>                 GET DIAGNOSTICS l_rowcount = ROW_COUNT;
> 
>                 EXIT WHEN l_rowcount < l_batch_size;
> 
>             END LOOP;

The goal of chunking was to get partial results rather than an
all-or-nothing behavior. If you use that plpgsql loop you'll want
to catch exceptions and set those TopoGeometries to NULL instead.
Then you'll be able to see what the loop was able to convert and
what not, and get back to the still-to-be-converted geoms, maybe
after cleaning up some of what you got converted already.

--strk;


More information about the postgis-users mailing list