[postgis-users] Checking Road Network Topology

Miller, Stephan smille12 at harris.com
Tue Jan 20 11:45:47 PST 2015

All -

I am attempting to validate the topology of a dense road network ( 1.2 Million roads) modeled after http://blog.mathieu-leplatre.info/use-postgis-topologies-to-clean-up-road-networks.html from July 2013<http://blog.mathieu-leplatre.info/use-postgis-topologies-to-clean-up-road-networks.html%20from%20July%202013>.  The code is given below:

-- HC_RoadTopologicalCheck
-- Drop the existing topology

SELECT topology.DropTopology('roads_topo');

SELECT topology.CreateTopology('roads_topo',4326, 0.000001, true);

SELECT topology.AddTopoGeometryColumn('roads_topo', 'fgcm', 'transportationgroundcrv', 'topo_shape', 'LINESTRING');
--UPDATE transportationgroundcrv SET topo_shape = topology.toTopoGeom(transportationgroundcrv.shape, 'roads_topo', 1, 1.0);

-- Encapsulate the UPDATE inside code that checks for errors
DO $$ DECLARE r record;
    FOR r IN SELECT * FROM transportationgroundcrv loop
            UPDATE transportationgroundcrv SET topo_shape = topology.toTopoGeom(transportationgroundcrv.shape, 'roads_topo', 1, 1.0)
            WHERE r.objectid = r.objectid;
                WHEN OTHERS THEN
                RAISE WARNING 'Loading of record % failed: %', r.objectid, SQLERRM;


Select * from ValidateTopology('roads_topo');

I am getting everything passing to the exception statement and all the records are being flagged with

WARNING:  Loading of record 791456 failed: SQL/MM Spatial exception - curve not simple

Intermittently, I am getting the following error also.

WARNING:  Loading of record 792591 failed: Spatial exception - geometry intersects edge 69612

Everything appears to be flagged as an error; the ValidateTopology call returns nothing.

Any insights or suggestions would be appreciated.


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

More information about the postgis-users mailing list