Looking for migration documentation for CmdArgs

Hey everyone, I want to know if there is somewhere I can find some migration documentation for the CmdArgs which was used in older versions of graphhopper (my server is still using version 0.6.0).
If there is none could you guys maybe help me with the new configuration I have to do to use the newest version of graphhopper.

Code:

  fun setupGraphhopper(graph: String): GraphHopper? {
        val cmdArgs = getDefaultArguments(graph)
        val graphHopper: GraphHopper = try {
            GraphHopper().init(cmdArgs)
        } catch (t: Throwable) {
            return null
        }

        graphHopper.encodingManager = EncodingManager("CAR")
        graphHopper.importOrLoad()
        return graphHopper
    }

    private fun getDefaultArguments(graph: String): CmdArgs {
        val cmdArgs = CmdArgs()
        cmdArgs.put("osmreader.osm", graph)
        cmdArgs.put("osmreader.acceptWay", "CAR")
        cmdArgs.put("prepare.chShortcuts", "yes")
        cmdArgs.put("index.highResolution", "1000")
        cmdArgs.put("graph.dataaccess", "RAM")
        cmdArgs.put("routing.defaultAlgorithm", "astarbi")
        return cmdArgs
    }

There is no migration guide but there was a script for 1.0: https://github.com/karussell/snake_case

Still if you want to use directly the latest version it won’t work as there are too many other changes e.g. regarding profiles. So you’ll have to look into the current config example and the changelog: graphhopper/CHANGELOG.md at master · graphhopper/graphhopper · GitHub

1 Like

I have been able to make almost everything work except I have 2 routes which are now out of bounds which wasn’t a issue before on the older version:

com.graphhopper.util.exceptions.PointOutOfBoundsException: Point 1 is out of bounds: 51.531437,-0.126136, the bounds are: -0.12548435759881937,16.43211356771246,47.26059207157624,53.45848247688597

Is there a option to disable this check or is there a solution for it? We editted the OSM file with the JOSM edittor to add certain lines so if a change in the OSM file can fix it please also say

Just for the record: You need to replace CmdArgs with PMap. But like @karussell said the different configuration options almost all have changed.

Regarding the PointsOutOfBoundsException: If the point is outside the bounds of your map GraphHopper cannot really do much about it, so just disabling the check probably would not help. The obvious solution would be to use a bigger map extract that covers the area around the point you like to use. But a smaller value for prepare.min_network_size could also help.

off-topic: It’s interesting to see there once was an osmreader.acceptWay=CAR option. We probably bring this back soon, something like osmreader.accept_way=motorway,primary,secondary,tertiary... when we remove the flag encoders.

My map contains railway lines and my coordinates are of the stations. This one station is outside of the bounds but only by a small margin and would like graphhopper to give the closest route inbounds

Oh, ok I see. Note that the map bounds are not taken from some OSM element or meta data, but they just represent the extent of all the points included in the graph. So if you’d like to extend this maybe the easiest to do is include a few more roads so your railway station is not right at the border of the map.

Powered by Discourse