The concept of integrating information, communication, and some physical devices and being connected to a network to support the city operations and services efficiently is a part of building a smart city. In this research, IoT devices and GIS are utilized to predict the status of roads based on time to avoid traffic congestion. The GIS and IoT sensors are utilized to collect the required data to run the proposed research to control traffic lights. The info of each light is saved in a predefined list and equipped with three lights: red, orange, and green. These colours are used to indicate the status of the road in front of the drivers. The proposed method introduces a novel algorithm to avoid the traffic using GIS and IoT devices to avoid traffic congestion.