Traffic congestion happens when emergencies occur. Traditional congestion algorithms evaluate traffic congestion only according to real-time vehicle speed, instead of comprehensive aspects. To address this shortcoming, we provide a new algorithm for congestion evaluation based on WSNs and GPS, which provide many sensor nodes to monitor and transmit traffic message in time. This paper takes more aspects for traffic into consideration, including congestion situation, danger condition and sudden road peak flow, and turns them into weights, which help to measure congestion intensity. According to congestion intensity, congestion field is established to navigate for the vehicles. Furthermore, we propose future prediction mechanism for vehicles. Finally, we do simulation with Matlab to evaluate the performance of the prediction mechanism, and results show that the performance of prediction mechanism is better than greedy algorithm. Moreover, a route will be recommended after a comprehensive evaluation about the distance, time, congestion and traffic lights number. In a word, the prediction mechanism for traffic can not only ensure the effectiveness of the navigation, but also protect drivers from the sudden peak flow, which brings convenience and comfortableness to drivers. © ICST Institute for Computer Sciences, Social Informatics and Telecommunications Engineering 2018.