[postgis-users] Checking Road Network Topology

Miller, Stephan smille12 at harris.com
Thu Jan 22 07:35:42 PST 2015


Here is the code as it now stands.  I was using 4326 and topology will not work for geography coordinates.  Can you share your code so that I can compare?  I am trying to do an on-the-fly transform to 32648 for each record in the line 26.  Is that how you approached this problem?


[cid:image001.png at 01D0362C.CE47B050]
From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of toni hernández
Sent: Thursday, January 22, 2015 10:14 AM
To: postgis-users at lists.osgeo.org
Subject: Re: [postgis-users] Checking Road Network Topology


I had the same issue when working with geometries using srid=4326 . I was also following the same link (http://blog.mathieu-leplatre.info/use-postgis-topologies-to-clean-up-road-networks.html)
Then I tried with some projected geometries (units = meters) and the problem was gone. I am not sure why. Maybe it was just a coincidence.


On 20/01/2015 20:45, Miller, Stephan wrote:
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.



postgis-users mailing list

postgis-users at lists.osgeo.org<mailto:postgis-users at lists.osgeo.org>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150122/2e7d95b1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 158900 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150122/2e7d95b1/attachment.png>

More information about the postgis-users mailing list