How to set the values of "green" in extra info

I am trying to set the value for “green” when using the geoJson directions. In the documentation, it mentions you can set the value between 0 and 10 for “green”. However, in the API playground when i select green in extra_info i dont have the option to select the value.

The API playground displays this: “extra_info”:[“green”]

Hey,

this is indeed a bit hidden inside the options-parameter. Here’s an example:

"options":{"profile_params":{"weightings":{"green":0.5,"quiet":0.2}}}

Note that this is only available for foot-*-profiles.
Best regards

Hi,

when i set the values for “green” to 0.5 and quiet to “0.2” this should return a route with “green” as 5 and “noise” as 2. However, when i calculate the route the console displays

properties.extras.green.summary where it returns amount, distance, value. Value returns 10, shouldn’t this be 5 since i set “green” to 0.5. The value for “noise” is 7 shouldn’t this also be 2?

Hi William,

The inputs are factors that influence route generation, a preference. (higher green more likely to use ways within green spaces etc.).
The outputs are the values for the actual route that is generated in the end, so an average of the green and quiet index data of the way segments, the route uses (0 not green, 10 very green).

So, if you set green to 1 (prefer green routes to a maximum over shorter routes), you still might get a 0 summary if you are routing between two points in the middle of a city on built up area, if there are no green spaces.
Or it would take you to the city outskirts where the green index is 10 and come back to the second point within the city. You still wouldn’t get a summary of 10 because parts of the route is in areas with a very low green index.

Best regards

1 Like