The invention discloses a ship path planning method based on a ship trajectory and an ant colony algorithm, a clustering object is changed from a point to a track segment, information of the track segment relative to a trajectory point, a ship course, a ship speed and the like is reserved, and a clustering result is more accurate during clustering. In similarity measurement, similarity measurement calculation is carried out by adopting more multi-dimensional angles, and four dimensions of a horizontal distance, a vertical distance, a steering angle and a speed are considered. Thus, the overall clustering result is more accurate. According to the method, an improved DBSCAN algorithm is used, information such as the speed and the direction contained in a ship track is reserved, and meanwhile the clustering speed is increased. According to the improved ant colony algorithm provided by the invention, experiments show that compared with the previous ant colony algorithm, the ant colony algorithm suitable for ship route planning provided by the invention improves the convergence speed when solving the problem of ship route planning.