Skip to main content

I tried to use osm2po as a library and to write a simple routing program based on the sample code listed inat (http://osm2po.de/)

However, when I try to load the .pbf file into the data structure "Graph". The eclipse, the IDE that I used, shows the error message as following: "Exception in thread "main" java.lang.RuntimeException: No osm2po-GraphFile"

Can anyone tellstell me what's going wrong when I tryiedtry to load "C:\taiwan-latest.osm.pbf"?

//=========== the full codescode of the simple routing program areis listed below: public static void main(String[] args){

public static void main(String[] args){

    File graphFile = new File("C:\\taiwan-latest.osm.pbf");
    Graph graph = new Graph(graphFile);
    DefaultRouter router = new DefaultRouter();

    // Somewhere in Hamburg
    int sourceId = graph.findClosestVertexId(25.033839f, 121.565064f);
    int targetId = graph.findClosestVertexId(25.040135f, 121.560328f);

    // Possible additional params for DefaultRouter
    Properties params = new Properties();
    params.setProperty("findShortestPath", "false");
    params.setProperty("ignoreRestrictions", "false");
    params.setProperty("ignoreOneWays", "false");
    params.setProperty("heuristicFactor", "1.0"); // 0.0 Dijkstra, 1.0 good A*

    int[] path = router.findPath(
            graph, sourceId, targetId, Float.MAX_VALUE, params);

    if (path != null) { // Found!
        for (int i = 0; i < path.length; i++) {
            RoutingResultSegment rrs = graph.lookupSegment(path[i]);
            int segId = rrs.getId();
            int from = rrs.getSourceId();
            int to = rrs.getTargetId();
            String segName = rrs.getName().toString();
            System.out.println(from + "-" + to + "  " + segId + "/" + path[i] + " " + segName);
        }
    }

    graph.close();
}

I tried to use osm2po as library and to write a simple routing program based on the sample code listed in (http://osm2po.de/)

However, when I try to load the .pbf file into the data structure "Graph". The eclipse, the IDE that I used, shows the error message as following: "Exception in thread "main" java.lang.RuntimeException: No osm2po-GraphFile"

Can anyone tells me what's going wrong when I tryied to load "C:\taiwan-latest.osm.pbf"?

//=========== the full codes of the simple routing program are listed below: public static void main(String[] args){

    File graphFile = new File("C:\\taiwan-latest.osm.pbf");
    Graph graph = new Graph(graphFile);
    DefaultRouter router = new DefaultRouter();

    // Somewhere in Hamburg
    int sourceId = graph.findClosestVertexId(25.033839f, 121.565064f);
    int targetId = graph.findClosestVertexId(25.040135f, 121.560328f);

    // Possible additional params for DefaultRouter
    Properties params = new Properties();
    params.setProperty("findShortestPath", "false");
    params.setProperty("ignoreRestrictions", "false");
    params.setProperty("ignoreOneWays", "false");
    params.setProperty("heuristicFactor", "1.0"); // 0.0 Dijkstra, 1.0 good A*

    int[] path = router.findPath(
            graph, sourceId, targetId, Float.MAX_VALUE, params);

    if (path != null) { // Found!
        for (int i = 0; i < path.length; i++) {
            RoutingResultSegment rrs = graph.lookupSegment(path[i]);
            int segId = rrs.getId();
            int from = rrs.getSourceId();
            int to = rrs.getTargetId();
            String segName = rrs.getName().toString();
            System.out.println(from + "-" + to + "  " + segId + "/" + path[i] + " " + segName);
        }
    }

    graph.close();
}

I tried to use osm2po as a library and write a simple routing program based on the sample code at (http://osm2po.de/)

However, when I try to load the .pbf file into the data structure "Graph". The eclipse, the IDE that I used, shows the error message as following: "Exception in thread "main" java.lang.RuntimeException: No osm2po-GraphFile"

Can anyone tell me what's going wrong when I try to load "C:\taiwan-latest.osm.pbf"?

//=========== the full code of the simple routing program is listed below:

public static void main(String[] args){

    File graphFile = new File("C:\\taiwan-latest.osm.pbf");
    Graph graph = new Graph(graphFile);
    DefaultRouter router = new DefaultRouter();

    // Somewhere in Hamburg
    int sourceId = graph.findClosestVertexId(25.033839f, 121.565064f);
    int targetId = graph.findClosestVertexId(25.040135f, 121.560328f);

    // Possible additional params for DefaultRouter
    Properties params = new Properties();
    params.setProperty("findShortestPath", "false");
    params.setProperty("ignoreRestrictions", "false");
    params.setProperty("ignoreOneWays", "false");
    params.setProperty("heuristicFactor", "1.0"); // 0.0 Dijkstra, 1.0 good A*

    int[] path = router.findPath(
            graph, sourceId, targetId, Float.MAX_VALUE, params);

    if (path != null) { // Found!
        for (int i = 0; i < path.length; i++) {
            RoutingResultSegment rrs = graph.lookupSegment(path[i]);
            int segId = rrs.getId();
            int from = rrs.getSourceId();
            int to = rrs.getTargetId();
            String segName = rrs.getName().toString();
            System.out.println(from + "-" + to + "  " + segId + "/" + path[i] + " " + segName);
        }
    }

    graph.close();
}
deleted 9 characters in body; edited title
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

please help to solve Solving java.lang.RuntimeException: No osm2po-GraphFile?

I tried to use osm2po as library and to write a simple routing program based on the sample code listed in (http://osm2po.de/)

However, when I try to load the .pbf file into the data structure "Graph". The eclipse, the IDE that I used, shows the error message as following: "Exception in thread "main" java.lang.RuntimeException: No osm2po-GraphFile"

Can anyone tells me what's going wrong when I tryied to load "C:\taiwan-latest.osm.pbf"?

thanks! //=========== the full codes of the simple routing program are listed below: public static void main(String[] args){

    File graphFile = new File("C:\\taiwan-latest.osm.pbf");
    Graph graph = new Graph(graphFile);
    DefaultRouter router = new DefaultRouter();

    // Somewhere in Hamburg
    int sourceId = graph.findClosestVertexId(25.033839f, 121.565064f);
    int targetId = graph.findClosestVertexId(25.040135f, 121.560328f);

    // Possible additional params for DefaultRouter
    Properties params = new Properties();
    params.setProperty("findShortestPath", "false");
    params.setProperty("ignoreRestrictions", "false");
    params.setProperty("ignoreOneWays", "false");
    params.setProperty("heuristicFactor", "1.0"); // 0.0 Dijkstra, 1.0 good A*

    int[] path = router.findPath(
            graph, sourceId, targetId, Float.MAX_VALUE, params);

    if (path != null) { // Found!
        for (int i = 0; i < path.length; i++) {
            RoutingResultSegment rrs = graph.lookupSegment(path[i]);
            int segId = rrs.getId();
            int from = rrs.getSourceId();
            int to = rrs.getTargetId();
            String segName = rrs.getName().toString();
            System.out.println(from + "-" + to + "  " + segId + "/" + path[i] + " " + segName);
        }
    }

    graph.close();
}

please help to solve java.lang.RuntimeException: No osm2po-GraphFile

I tried to use osm2po as library and to write a simple routing program based on the sample code listed in (http://osm2po.de/)

However, when I try to load the .pbf file into the data structure "Graph". The eclipse, the IDE that I used, shows the error message as following: "Exception in thread "main" java.lang.RuntimeException: No osm2po-GraphFile"

Can anyone tells me what's going wrong when I tryied to load "C:\taiwan-latest.osm.pbf"?

thanks! //=========== the full codes of the simple routing program are listed below: public static void main(String[] args){

    File graphFile = new File("C:\\taiwan-latest.osm.pbf");
    Graph graph = new Graph(graphFile);
    DefaultRouter router = new DefaultRouter();

    // Somewhere in Hamburg
    int sourceId = graph.findClosestVertexId(25.033839f, 121.565064f);
    int targetId = graph.findClosestVertexId(25.040135f, 121.560328f);

    // Possible additional params for DefaultRouter
    Properties params = new Properties();
    params.setProperty("findShortestPath", "false");
    params.setProperty("ignoreRestrictions", "false");
    params.setProperty("ignoreOneWays", "false");
    params.setProperty("heuristicFactor", "1.0"); // 0.0 Dijkstra, 1.0 good A*

    int[] path = router.findPath(
            graph, sourceId, targetId, Float.MAX_VALUE, params);

    if (path != null) { // Found!
        for (int i = 0; i < path.length; i++) {
            RoutingResultSegment rrs = graph.lookupSegment(path[i]);
            int segId = rrs.getId();
            int from = rrs.getSourceId();
            int to = rrs.getTargetId();
            String segName = rrs.getName().toString();
            System.out.println(from + "-" + to + "  " + segId + "/" + path[i] + " " + segName);
        }
    }

    graph.close();
}

Solving java.lang.RuntimeException: No osm2po-GraphFile?

I tried to use osm2po as library and to write a simple routing program based on the sample code listed in (http://osm2po.de/)

However, when I try to load the .pbf file into the data structure "Graph". The eclipse, the IDE that I used, shows the error message as following: "Exception in thread "main" java.lang.RuntimeException: No osm2po-GraphFile"

Can anyone tells me what's going wrong when I tryied to load "C:\taiwan-latest.osm.pbf"?

//=========== the full codes of the simple routing program are listed below: public static void main(String[] args){

    File graphFile = new File("C:\\taiwan-latest.osm.pbf");
    Graph graph = new Graph(graphFile);
    DefaultRouter router = new DefaultRouter();

    // Somewhere in Hamburg
    int sourceId = graph.findClosestVertexId(25.033839f, 121.565064f);
    int targetId = graph.findClosestVertexId(25.040135f, 121.560328f);

    // Possible additional params for DefaultRouter
    Properties params = new Properties();
    params.setProperty("findShortestPath", "false");
    params.setProperty("ignoreRestrictions", "false");
    params.setProperty("ignoreOneWays", "false");
    params.setProperty("heuristicFactor", "1.0"); // 0.0 Dijkstra, 1.0 good A*

    int[] path = router.findPath(
            graph, sourceId, targetId, Float.MAX_VALUE, params);

    if (path != null) { // Found!
        for (int i = 0; i < path.length; i++) {
            RoutingResultSegment rrs = graph.lookupSegment(path[i]);
            int segId = rrs.getId();
            int from = rrs.getSourceId();
            int to = rrs.getTargetId();
            String segName = rrs.getName().toString();
            System.out.println(from + "-" + to + "  " + segId + "/" + path[i] + " " + segName);
        }
    }

    graph.close();
}
Source Link

please help to solve java.lang.RuntimeException: No osm2po-GraphFile

I tried to use osm2po as library and to write a simple routing program based on the sample code listed in (http://osm2po.de/)

However, when I try to load the .pbf file into the data structure "Graph". The eclipse, the IDE that I used, shows the error message as following: "Exception in thread "main" java.lang.RuntimeException: No osm2po-GraphFile"

Can anyone tells me what's going wrong when I tryied to load "C:\taiwan-latest.osm.pbf"?

thanks! //=========== the full codes of the simple routing program are listed below: public static void main(String[] args){

    File graphFile = new File("C:\\taiwan-latest.osm.pbf");
    Graph graph = new Graph(graphFile);
    DefaultRouter router = new DefaultRouter();

    // Somewhere in Hamburg
    int sourceId = graph.findClosestVertexId(25.033839f, 121.565064f);
    int targetId = graph.findClosestVertexId(25.040135f, 121.560328f);

    // Possible additional params for DefaultRouter
    Properties params = new Properties();
    params.setProperty("findShortestPath", "false");
    params.setProperty("ignoreRestrictions", "false");
    params.setProperty("ignoreOneWays", "false");
    params.setProperty("heuristicFactor", "1.0"); // 0.0 Dijkstra, 1.0 good A*

    int[] path = router.findPath(
            graph, sourceId, targetId, Float.MAX_VALUE, params);

    if (path != null) { // Found!
        for (int i = 0; i < path.length; i++) {
            RoutingResultSegment rrs = graph.lookupSegment(path[i]);
            int segId = rrs.getId();
            int from = rrs.getSourceId();
            int to = rrs.getTargetId();
            String segName = rrs.getName().toString();
            System.out.println(from + "-" + to + "  " + segId + "/" + path[i] + " " + segName);
        }
    }

    graph.close();
}