0

After creating GHRequest with coordinates, details parameters, etc. and want to send it via GraphhopperWebClient to the server, I get an error that says:

The requested profile 'name=car|vehicle=car|weighting=fastest|turnCosts=false|hints={}' does not exist.
Available profiles: [foot, car, bike]]

I am creating GHRequest in this way:

(1) Here I will read parameters and insert informations such as point coordinates, details... in GHRequest:

GHRequest ghRequest = getGHRequest(
                param0,
                param1,
                param2
        );

(2) Then I will create Profile for the GHRequest:

Profile profile = new Profile("car")
            .setVehicle("car")
            .setWeighting("false")
            .setTurnCosts(false);

(3) At the end, I will set GHRequest's profile:

ghRequest.setProfile(ghProfile.toString());

My next step is to use GraphhopperWebClient to send the request on my server that has Graphhopper instance running on it:

(4) I will create GraphhopperWeb client instance with my server address:

GraphHopperWeb client = new GraphHopperWeb("http:baseURL/route");
client.setPostRequest(false);

(5) I am sending created GHRequest on the server and parseing the response in GHResponse:

GHResponse response = client.route(ghRequest);

I don't need to insert my key because Graphhopper is running on my server and I just need to send a GET request on it and parse the response.

Can someone help me to solve this problem?

Chuck Nuris
  • 71
  • 1
  • 6

1 Answers1

1

Profiles that can be used must be set up on the server. So I already have car, foot and bike profiles on my server. They already have weighting, turn description, etc parameters. What I needed to do is decide which of the profiles will be used by writing:

Profile profile = new Profile(profileName);

String profileName is the name of the profile I want to use that is already on the server. So in my case I just need to use:

Profile profile = new Profile("car");

GHRequest will use car profile that is already set up on the Graphhopper server instance.

Chuck Nuris
  • 71
  • 1
  • 6