In order to better mine information from the data of automatic identification system (AIS) and scientifically perceive the water traffic situation, several common clustering algorithms, such as K-means algorithm and DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm, are studied and analyzed, and the advantages and disadvantages of each algorithm and applicable scenarios are compared. Taking the actual ship's AIS trajectory data as an example, each algorithm is used to verify its characteristics, which provides convenience for further information mining of trajectory data.