I have used osm2po (5.0.0) and its autogenerated SQL file to load some 25% of Europe.osm.pbf as a network table into my PostGIS database. I have also created an associated nodes table with select pgr_createTopology('network', 0.00001, 'geom_way', 'id');
Since it takes literally days to calculate anything on this dataset with no apparent results, I have simplified it, removing all edges that were of inferior road class (osm2po's attribute clazz > 30), so that my network is largely simplified. This however results in more than 800k nodes (of 1m total in database) that are pseudo nodes (degree = 2), that is, they connect two segments of the same road of the same class and max speed allowed and now are merely unwanted residue from original, more complex topology.
In order to delete those nodes I have been trying to use ST_ModEdgeHeal() as suggested in How to simplify a routable network? and I intend to use code like the one below.
select ST_ModEdgeHeal('network', ns.id, nt.id) from pseudonodes p
left outer join network ns on ns.source=p.id
left outer join network nt on nt.target=p.id
where ns.clazz=nt.clazz and ns.kmh = nt.kmh;
It appears, however, that my network is not the network ST_ModEdgeHeal() expects. After I queried SELECT CreateTopology('network', 4326);
it created a new blank schema network, whereas I am using schema public where network and nodes tables are stored. I do not know how to combine those two schemas so that ST_ModEdgeHeal() would work. So right now I have an error SQL/MM Spatial exception - non-existent edge 2629192
. Understandable, as network schema is filled with empty tables.
Therefore the question is: do I have to do any additional coding, apart from that done automatically with osm2po generated SQL, to set up my network and nodes tables as topology and make ST_ModEdgeHeal() work?
To remove pseudo nodes I have also attempted a solution from this question (Find pseudo nodes in free GIS software), but it did not get any result after 2 days of calculations.