Custom Profile Spec Format

Continuing the discussion from Different edge weighing depending on incline? @easbar:

Yes, with a separate elevation_influence root entry this would work. Unfortunately there are many more use cases that require at least two conditions like “primary roads only in area1” or this. And fixing all use cases via introducing more root entries does not seem to be a good solution, when the “only thing” we need is two conditions instead of one.

Where/why do you think this is ugly? The biggest advantage of YAML compared to JSON are comments imo.

Currently my biggest issue is that whitespace is significant for YAML and e.g. this does not work:

priority:
  blup: ...
speed_factor:
  # use a slightly different indention
    blup: ...

which is harder the bigger the YAML gets. Basically I agree with several points what wikipedia says :). Also e.g. no is converted to false causing trouble for Norway and caused us problems already elsewhere. Or maybe we could look into StrictYaml, there are other alternatives like TomL but I do not like it much and it is not without problems and still not perfect for our use case.

My current favorite is to offer safe but powerful and fast expressions inside the custom profile definition. We could try to use the Janino compiler and enable the security manager. Or somehow reduce the power of it via utilize the compiler only for the expressions and convert this:

# already use our custom JSON that allows comments !?
"entry": {
  "<1> some conditions": value1
  "<2> some other conditions": value2
}

into Java expressions and compile it:

double entry = /*some default*/;
if(<1>) entry = value1
else if(<2>) entry = value2
...

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.