[postgis-users] Checking Road Network Topology

Miller, Stephan smille12 at harris.com
Thu Jan 22 13:01:10 PST 2015


Thanks.

I think I am ensuring the geometries are both projected to 32648 (zone 48N  UTM).  The tolerance being sent to topology.toTopoGeom is 1.0, presumably this is in meters.  I will try the next run with 0.0000001 which is appropriate if the tolerance is being applied to 4326 coordinates for some reason.  A tolerance of 1.0 degree would certainly explain why every line would be reduced to a point or convolute the input.

I have not gotten around to using LIMIT and OFFSET as you suggested.  I keep thinking I have overlooked something important.

Here is the code I am running now.



-- Drop the existing topology
SELECT topology.DropTopology('roads_topo');

-- Create a new one
SELECT topology.CreateTopology('roads_topo',32648, 0.000001, true);

-- Add the new topo_shape column
select topology.AddTopoGeometryColumn('roads_topo', 'fgcm', 'transportationgroundcrv', 'topo_shape', 'LINESTRING');

SELECT TopologySummary('roads_topo');

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

Select * from ValidateTopology('roads_topo');



Let me know if you see something obvious.

Steve
 

-----Original Message-----
From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Sandro Santilli
Sent: Thursday, January 22, 2015 3:53 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Checking Road Network Topology

On Thu, Jan 22, 2015 at 04:13:44PM +0100, toni hernández wrote:
> Steve,
> 
> 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.

Can it be you're specifying a too large of a precision for your topologies in srid=4326 ?

--strk;
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



More information about the postgis-users mailing list