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.

  • Welcome to gis.stackexchange! I see many question marks in this long text. Please note that the Q&A format of this site requires one - and only one - question per thread which should be answerable in a few paragraphs. This thread, as it stands, is much too broad for this format. For more info, please check our faq. – underdark Jan 6 '15 at 20:54
  • As I understood you correctly you are looking for a Many-To-One query. Is this correct? Is it sufficient for you to omit intermediate vertices and only take real crossings into account? If so, you are looking for a Dijkstra which is able to route over reversed edges and that keeps results after one full traversal. – Carsten Jan 7 '15 at 9:04
  • By the way, my eu_2po.log reports more than 25 Million vertices. This will produce about 40x25M = 1 Billion Routes. – Carsten Jan 7 '15 at 9:39
  • You can use pgRouting with the results of osm2po. This results has the way table, the source and target field, the cost field and everything that you need to standard use of pgRouting. – pedro3102 Feb 10 '15 at 19:32
  • The poster said that the result is too large, and are looking for ways to simplify the network. This does not address the question. – alphabetasoup Feb 10 '15 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.