Hi, I’m connecting to graphhopper using the java client located here
I’m trying to use polygon-based vehicle profiles as described here
I’ve built a CustomModel and I’m passing it in to request.setCustomModel, but I’m getting an error telling me I have to set the profile. Is there a special token that means “go use the custom model”? Or do I somehow associate a name with the model?
When I was routing client side, I could associate it by building a CustomProfile, but I don’t seem to have access to that class in the client library.
Yes, every custom model is based on some profile. Currently, you can use
bike. For example if you use
profile: car and setup a rule in your custom model that does
multiply_by: 0.8 for
speed, 80% of the normal car speed will be used for the affected roads.
So if I set it to “car” I get the following error:
“The requested profile ‘car’ cannot be used with
custom_model, because it has weighting=fastest”
Do I have to do something to override the default weighting of “car”?
This is my profile btw, which is copied straight off the examples link
“if”: “road_class == MOTORWAY && in_near_cottbus == false”,
[ 13.84826, 51.6137 ],
[ 13.9746, 51.61375 ],
[ 13.97323, 51.82983 ],
[ 13.84963, 51.83323 ],
[ 13.84826, 51.6137 ]
This is your custom model. What does your request look like? And are you querying against graphhopper.com/api/1/route or do you run your own GraphHopper server?
I’m running my own server (it’s 4.0 with no changes). My request looks like this (I’m using the java client)
GHRequest request = new GHRequest(start.getLatitude(), start.getLongitude(),
To use custom models you need to set up at least one custom profile. In your
- name: abc
And then use
profile=abc in your request. This is all written here. Did you not read this or was it not clear?
Yes, that is quite clear, thank you.
I read several guides, but apparently I didn’t read that one to the end.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.