Get tag Node and Identify nodes when passing

Hi, I am newbie
I am working on a project that involves the fastest directions and traffic lights. My ideal, when going through a node with the tag “Highway = Traffic_signals”, the weight will add a value as time. In FastestWeighting.java, I’m try add code:

    @Override
    public double calcWeight(EdgeIteratorState edge, boolean reverse, int prevOrNextEdgeId) {
        double speed = reverse ? edge.getReverse(avSpeedEnc) : edge.get(avSpeedEnc);
        if (speed == 0)
            return Double.POSITIVE_INFINITY;

        double time = edge.getDistance() / speed * SPEED_CONV;

        // add direction penalties at start/stop/via points
        boolean unfavoredEdge = edge.get(EdgeIteratorState.UNFAVORED_EDGE);
        if (unfavoredEdge)
            time += headingPenalty;

        if(node.hasTag("highway","traffic_signal")){
            time += 50;
        }    
        
        return time;
    }

GH Version: 13.0

Maybe my code wrong, but I tried many ways, it doesn’t get node with tag (“highway”,“traffic_signal”). Everyone please help me how to get tag and Identify nodes when passing.
Thanks,
Huy

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