[postgis-users] Checking Road Network Topology

toni hernández toni at sigte.udg.edu
Fri Jan 23 01:46:43 PST 2015


Sandro,

At this point I am not sure. :-(

I tried again using srid=4326 and a tolerance of 0.0001 which for my 
latitud (Girona, Spain) is about 1 meter.
This time everything worked just fine.

This are the SQL statements adapted from 
http://blog.mathieu-leplatre.info/use-postgis-topologies-to-clean-up-road-networks.html

SELECT topology.DropTopoGeometryColumn('public', 'streets_4326', 
'topogeom'); --Topology created with 0 tolerance by default
SELECT topology.droptopology('streets_4326_topo');


-- Exercici de topologia amb coordenadas geogràfiques.

SELECT topology.CreateTopology('streets_4326_topo', 4326);
SELECT topology.AddTopoGeometryColumn('streets_4326_topo', 'public', 
'streets_4326', 'topogeom', 'MULTILINESTRING');

SELECT streets_4326_geomTotopo();

Where streets_4326_geomTotopo() is not a very good function but good 
enough for testing :

CREATE OR REPLACE FUNCTION streets_4326_geomTotopo()
   RETURNS void AS
$BODY$
DECLARE r record;
BEGIN
   FOR r IN SELECT * FROM streets_4326 LOOP
     BEGIN
       UPDATE streets_4326 SET topogeom = topology.toTopoGeom(geom, 
'streets_4326_topo', 1, 0.0001) -- 0.0001º around 1 meter)
       WHERE id = r.id;
     EXCEPTION
       WHEN OTHERS THEN
         RAISE WARNING 'Loading of record % failed: %', r.id, SQLERRM;
     END;
   END LOOP;
END;
$BODY$ LANGUAGE plpgsql volatile;


On 22/01/2015 21:53, Sandro Santilli wrote:
> 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