Skip to content

Destination on one-way feature not possible #63

Open
@andreasherzog

Description

@andreasherzog

First off, I really like this library, it works well and fast. Thanks for maintaining.

I am using it to calculate paths in a self-recorded network. After some adjustments to the network, it does what we need.

However, when I add one-way features, I cannot get a path if the destination is on that one-way feature. The start can be placed on it and it works. Also, the one-way feature is included for "through" paths that have a working destination.

I am using this weightFunction:

weightFunction = (a, b, props) => {
    const distance = turf.distance(turf.point(a), turf.point(b)) * 1000;
    let forward = distance;
    let backward = distance;
    if (props.oneway && props.oneway === true) {
      backward = 0;
    } else if (props.oneway && props.oneway === 'backward') {
      forward = 0;
    }
    return {
      forward: forward,
      backward: backward,
    };
  };

My features can have a "oneway" property that is set to true if the feature should be one-way. I do not use the "backward" value at the moment. If I remove the "oneway" property, I can place the destination on the feature with no issue.

Any guidance would be dearly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions