This paper proposes a data-driven approach to the calculation of ship overtaking boundary conditions in narrow channels based on ship overtaking characteristics by the Automatic Identification System (AIS) data. First, we collect the ship tracking process data in a narrow channel by processing the original AIS data, followed by a normality test and correlation analysis, and finally, the boundary conditions are obtained using a weighted K-means clustering algorithm. to identify the relevant data. We applied the proposed approach to estimate the overtaking boundary conditions of ships in the straight channel section of Shanghai South Passage. The method yields boundary conditions that significantly reduce collision risk when a ship engages in pursuit behavior in narrow waterways, providing a scientific basis for the overtaking of Marine Autonomous Surface Ships (MASS) in autonomous navigation within such environments, further promoting the automation level of USVs and autonomous vessels.