Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use parameters instead of custom profile upload #666

Open
zod opened this issue Oct 27, 2022 · 5 comments
Open

Use parameters instead of custom profile upload #666

zod opened this issue Oct 27, 2022 · 5 comments

Comments

@zod
Copy link
Contributor

zod commented Oct 27, 2022

Currently changing profile parameters using brouter-web causes a new custom profile to be uploaded to BRouter. Because custom profiles are only cached and not stored persistently the brouter-web URL doesn't contain a reference of the profile. I sometimes store routes as bookmarks, but this doesn't work for profiles with adapted parameters.

BRouter provides an undocumented way to pass profile parameters as parameters of the request which would offer the possibility for persistent urls even with adapted parameters.

@nrenner
Copy link
Owner

nrenner commented Oct 27, 2022

Yes, that would be one of the tasks with some higher priority.

@abrensch mentioned a while ago that those are only a hack:

So that' currently only a hack and profile:xxx does not overwrite params of the "StdModel", and there are other hacks, e.g. does profile:vmax at the same time requests the speed-limit-profile.
But if that should become a feature I could of course remove the hacks and make it more consistent.

What is the current state there?

@zod
Copy link
Contributor Author

zod commented Oct 28, 2022

It seems like it hasn't changed much. The special handling for profile:vmax was removed, but as it seems overwriting parameters of StdModel isn't possible. I'm not sure if we need to overwrite those parameters or it's sufficient to overwrite parameters which are provided by the profiles.

@abrensch
Copy link
Contributor

or it's sufficient to overwrite parameters which are provided by the profiles

subtile difference between "provided by/to the profiles"

The way I did it in KinematicModel is to inject the url-parameter when the Model queries a parameter from the profile (If you look at https://github.com/abrensch/brouter/blob/master/brouter-core/src/main/java/btools/router/StdModel.java here the parameter keyValues of the init method is ignored)

But that means it does not work for parameters which are used BY the profile.

So we would need to inject the parameter before the profile is parsed, same way/same syntax as BRouter-Web already does it.

And be careful with profile caching to invalid a cached profile when a url-param changes, , but that should be o.k. already ( rc.getKeyValueChecksum() is part of the cache-key in https://github.com/abrensch/brouter/blob/master/brouter-core/src/main/java/btools/router/ProfileCache.java )

@afischerdev
Copy link

So we would need to inject the parameter before the profile is parsed

This is done in lib 1.6.4.
In RoutingContext the routine readGlobalConfig() calls the setVariableValue with true (means create variable) and this is done in BExpressionContext

@AntoineLu
Copy link

Best would actually be to be able to upload a profile from a URL. This way, we could store our profile on our personal github for example and then just upload it from a "raw" url to the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants