Ship line passing behavior analysis method and system
By drawing detection lines on electronic nautical charts and combining them with historical ship trajectory data, the system automatically identifies and judges ship crossing behavior, solving the problem that traditional methods cannot accurately identify the direction of crossing. This achieves low-cost, high-precision ship crossing analysis and enhances the intelligence of maritime supervision and waterway analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-30
- Publication Date
- 2026-04-14
AI Technical Summary
Existing methods for counting ship traffic cannot accurately identify whether a ship has crossed a certain line or distinguish the direction of travel, resulting in coarse statistical granularity that fails to meet the needs of refined management.
By receiving the detection line configuration information drawn by the user on the electronic nautical chart, the system obtains the ship's historical trajectory data, determines whether the trajectory line intersects with the detection line, and determines the direction in which the ship passes through the detection line based on the direction of the trajectory line, generating directional statistics of the line crossing.
It enables automatic identification and direction determination of vessel crossing behavior, improves the intelligence level of maritime supervision and waterway analysis, reduces costs, and improves analysis accuracy.
Smart Images

Figure CN121861933A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ship line crossing behavior analysis technology, and in particular to a method and system for analyzing ship line crossing behavior. Background Technology
[0002] With the booming development of the shipping industry, higher demands are being placed on the perception and management of maritime traffic. Port scheduling, waterway planning, and maritime supervision all require accurate statistics and analysis of vessel traffic flow and behavior patterns in specific waters.
[0003] Currently, common methods for counting ship traffic include fixed-area counting methods, which use electronic fence technology to count the number of ships entering or leaving a pre-defined polygonal area (such as a port area or anchorage). The disadvantage of this method is that it cannot accurately identify whether a ship has "crossed" a certain line (such as the center line of a waterway) or distinguish the direction of ship travel (such as import or export, upstream or downstream). The statistical granularity is coarse and cannot meet the needs of refined management. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method and system for analyzing ship line crossing behavior, which can realize the automatic identification and direction determination of ship line crossing behavior.
[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0006] A method for analyzing ship line crossing behavior includes the following steps: S1. Receive and store the configuration information of the detection line segments drawn by the user on the electronic nautical chart; S2. Obtain historical trajectory data of the ship within the target time period, wherein the historical trajectory data includes multiple trajectory points arranged in a time sequence; S3. Traverse the historical trajectory data and determine whether the trajectory line segment formed by two adjacent trajectory points intersects with the detection line segment; S4. If the trajectory line segment intersects with the detection line segment, the direction in which the ship passes through the detection line segment is determined based on the direction of the trajectory line segment. S5. Based on the direction in which the ship passes through the detection line segment, generate and output the directional crossing statistics for the detection line segment.
[0007] The beneficial effects of this invention are as follows: This method receives and stores the configuration information of at least one detection line segment drawn by the user on an electronic nautical chart, providing a flexible and customizable detection benchmark for subsequent analysis. It then lays the data foundation for accurate analysis by acquiring historical trajectory data of at least one vessel within a target time period, containing multiple trajectory points arranged in a time sequence. The subsequent step of traversing the historical trajectory data and determining whether the trajectory line segment formed by adjacent trajectory points intersects with the detection line segment automatically identifies the vessel's crossing behavior. Furthermore, the step of determining the direction of the vessel's crossing of the detection line segment based on the direction of the trajectory line segment when an intersection occurs further completes the determination of the crossing direction based on the automatic identification of crossing behavior. The system accurately judges the direction of ship crossings and then generates and outputs directional crossing statistics for the detected line segments based on the judgment results, forming a complete closed loop. Each step is closely linked and works in concert. This not only achieves automatic identification of ship crossing behavior without human intervention, but also accurately judges the crossing direction through correlation analysis between the trajectory line segment direction and the detected line segment. This effectively solves the shortcomings of traditional methods that cannot automatically identify crossing behavior or distinguish crossing direction. At the same time, relying on custom detection line segment configurations and existing trajectory data, it does not rely on physical hardware and achieves low-cost, high-precision ship crossing behavior analysis, significantly improving the level of intelligence in maritime supervision and waterway analysis. Attached Figure Description
[0008] Figure 1 This is a flowchart of the steps in the ship line crossing behavior analysis method of the present invention; Figure 2 This is a connection block diagram of the ship line crossing behavior analysis system of the present invention; Label Explanation: 1. Processor; 2. Memory. Detailed Implementation
[0009] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0010] Please refer to Figure 1 A method for analyzing ship crossing behavior includes the following steps: S1. Receive and store the configuration information of the detection line segments drawn by the user on the electronic nautical chart; S2. Obtain historical trajectory data of the ship within the target time period, wherein the historical trajectory data includes multiple trajectory points arranged in a time sequence; S3. Traverse the historical trajectory data and determine whether the trajectory line segment formed by two adjacent trajectory points intersects with the detection line segment; S4. If the trajectory line segment intersects with the detection line segment, the direction in which the ship passes through the detection line segment is determined based on the direction of the trajectory line segment. S5. Based on the direction in which the ship passes through the detection line segment, generate and output the directional crossing statistics for the detection line segment.
[0011] As can be seen from the above description, the beneficial effects of the present invention are as follows: This method receives and stores the configuration information of at least one detection line segment drawn by the user on an electronic nautical chart, providing a flexible and customizable detection benchmark for subsequent analysis. It then lays the data foundation for accurate analysis by acquiring historical trajectory data of at least one vessel within a target time period, containing multiple trajectory points arranged in a time sequence. The subsequent step of traversing the historical trajectory data and determining whether the trajectory line segment formed by adjacent trajectory points intersects with the detection line segment automatically identifies the vessel's crossing behavior. Furthermore, the step of determining the direction of the vessel's crossing of the detection line segment based on the direction of the trajectory line segment when an intersection occurs further completes the determination of the crossing direction based on the automatic identification of crossing behavior. The system accurately judges the direction of ship crossings and then generates and outputs directional crossing statistics for the detected line segments based on the judgment results, forming a complete closed loop. Each step is closely linked and works in concert. This not only achieves automatic identification of ship crossing behavior without human intervention, but also accurately judges the crossing direction through correlation analysis between the trajectory line segment direction and the detected line segment. This effectively solves the shortcomings of traditional methods that cannot automatically identify crossing behavior or distinguish crossing direction. At the same time, relying on custom detection line segment configurations and existing trajectory data, it does not rely on physical hardware and achieves low-cost, high-precision ship crossing behavior analysis, significantly improving the level of intelligence in maritime supervision and waterway analysis.
[0012] Furthermore, step S3 specifically includes: Calculate the bounding box of the trajectory line segment and the bounding box of the detection line segment. If the two bounding boxes do not overlap in the longitude or latitude direction, it is determined that the trajectory line segment and the detection line segment do not intersect.
[0013] As described above, by quickly calculating the bounding boxes of trajectory segments and detection segments, and judging the overlap in longitude and latitude directions, obviously non-intersecting line segment combinations can be quickly eliminated, avoiding subsequent complex calculations and significantly reducing the system's computational load. This is especially suitable for batch processing of massive ship trajectory data. The bounding box judgment rules are simple and intuitive, easy to implement in programs, and the judgment results are accurate and reliable, laying the foundation for subsequent accurate intersection judgment.
[0014] Furthermore, if the two bounding boxes overlap in the longitude or latitude direction, the cross product of the direction vector of the detection line segment with the two endpoints of the trajectory line segment relative to the starting point of the detection line segment is calculated, as well as the cross product of the direction vector of the trajectory line segment with the two endpoints of the detection line segment relative to the starting point of the trajectory line segment is calculated. If the product of the two cross products is less than zero, then the trajectory segment is determined to intersect with the detection segment.
[0015] As described above, by calculating the cross product and combining it with the judgment rule that "the product of both cross products is less than zero", the true intersection relationship between two line segments can be accurately identified, effectively avoiding misjudgments caused by special cases such as overlapping endpoints of line segments or collinear line segments, and ensuring the accuracy of line crossing behavior recognition. Based on the cross product principle of computational geometry, the intersection judgment is realized from the perspective of vector relationship. The theoretical foundation is solid, the judgment rule is scientific and reasonable, and it is applicable to various complex ship trajectory scenarios. It can handle complex situations such as uneven distribution of ship trajectory points and diverse angles of trajectory line segments. Whether the ship is traveling in a straight line or a curve, it can accurately determine whether it has crossed the detection line segment.
[0016] Furthermore, step S4 specifically involves: S41. Calculate the direction vector of the detected line segment and the direction vector of the trajectory line segment; S42. Calculate the dot product of the direction vector of the detection line segment and the direction vector of the trajectory line segment; S43. If the vector dot product is greater than zero, it is determined that the direction in which the ship crosses the line is consistent with the direction set by the detection line segment, and is recorded as positive. If the vector dot product is less than zero, it is determined that the direction in which the ship crosses the line is opposite to the direction set by the detection line segment, and is recorded as reverse. If the vector dot product is equal to zero, then the direction is further determined or marked as perpendicular crossing based on the trend of the adjacent trajectory segments before and after the ship.
[0017] As described above, determining the direction of crossing a line based on the sign of the vector dot product is scientifically sound, computationally simple, and can accurately distinguish between "forward" and "reverse" crossings, solving the core pain point of traditional methods being unable to identify the direction of crossing a line. For perpendicular crossing scenarios where the vector dot product is zero, a supplementary determination scheme is provided to avoid missing direction determination due to special cases, thus improving the completeness and practicality of the method. A unified direction determination standard ensures the consistency of direction recognition results under different ships and different trajectory scenarios, facilitating subsequent statistical analysis and data comparison.
[0018] Furthermore, the directional line crossing statistics results in step S5 include a list of line crossing event records and a summary of directional flow statistics, wherein: The list of crossing events includes a unique identifier for each crossing event, the vessel's maritime movement service identification code, the crossing timestamp, the latitude and longitude of the crossing intersection point, and the crossing direction. The directional flow statistics summary includes the detection line segment identifier, detection line segment name, total number of vessels crossing the line in the forward direction, total number of vessels crossing the line in the reverse direction, and total number of vessels crossing the line.
[0019] As described above, the line crossing event record list includes a unique identifier for each line crossing event, the vessel's maritime movement business identification code, the line crossing timestamp, the latitude and longitude of the line crossing intersection point, and the line crossing direction, which supports refined event tracing and individual vessel behavior analysis. The directional flow statistics summary intuitively presents the forward, reverse, and total number of vessels crossing the detection line segment, making it easy for managers to quickly grasp the vessel flow distribution characteristics of a specific waterway. The statistical results not only meet the needs of macro-flow analysis but also support micro-event tracing, making it suitable for data applications in various scenarios such as port scheduling, waterway planning, and maritime law enforcement.
[0020] Furthermore, in step S5, the method of outputting the directional crossing statistics results for the detected line segment includes visualizing them on an electronic nautical chart and generating a statistical report.
[0021] As described above, displaying statistical results intuitively on electronic nautical charts facilitates managers in quickly locating the position of detection lines and their corresponding flow and direction information, thereby improving data interpretation efficiency. Visual displays are suitable for real-time monitoring and on-site decision-making scenarios, while statistical reports are suitable for archiving, reporting, and cross-departmental collaboration scenarios, meeting diverse usage needs. Diverse output methods lower the barrier to data use, allowing both technical and non-technical personnel to quickly obtain the required information, thus improving the ease of use of the method.
[0022] Furthermore, in step S1, the configuration information includes a unique identifier for the detected line segment, a user-defined line segment name, the latitude and longitude coordinates of the starting point, and the latitude and longitude coordinates of the ending point.
[0023] As described above, clearly defining the unique identifier of the detection line segment, the user-defined line segment name, and the latitude and longitude coordinates of the starting and ending points ensures the integrity and standardization of the configuration information, avoiding analysis errors caused by missing or inconsistent configuration information. The unique identifier facilitates the system's differentiation and management of multiple detection line segments, while the user-defined name intuitively reflects the purpose or location of the detection line segment, improving the efficiency of configuration management. The clear recording of the starting and ending latitude and longitude coordinates provides accurate basic data for subsequent calculations such as line segment intersection judgment and direction identification, ensuring the accuracy of the analysis results.
[0024] Furthermore, in step S2, the historical trajectory data is obtained from the Automatic Identification System (AIS) base station database, the BeiDou Navigation Satellite System platform database, or the maritime data warehouse.
[0025] As described above, the system supports data acquisition from the Automatic Identification System (AIS) base station database, the BeiDou Navigation Satellite System (BDS) platform database, or maritime data warehouses. It is compatible with existing maritime data storage systems and eliminates the need for additional data acquisition channels, thus reducing system deployment costs. AIS and BDS are mature sources of ship positioning data in the maritime field, with high data accuracy and stable update frequency, ensuring the reliability of historical trajectory data and providing high-quality data support for subsequent analysis and calculation.
[0026] Furthermore, the trajectory points include the ship's maritime mobile service identification code, location coordinates, timestamp, heading information to the ground, and speed information to the ground.
[0027] As described above, the trajectory points include key information such as the ship's maritime mobility identification code, position coordinates, timestamp, heading information, and speed information. This not only meets the core requirements of line segment intersection judgment and direction identification, but also provides a data foundation for subsequent extended analyses (such as ship navigation status assessment and channel congestion cause analysis). The position coordinates and timestamps provide accurate basis for the construction of trajectory lines, while the heading and speed information can help verify the results of the line crossing direction judgment, improving the reliability of the analysis results. The rich trajectory point information can meet the personalized analysis needs in different scenarios, enhancing the versatility and scalability of the method.
[0028] Please refer to Figure 2 A ship crossing behavior analysis system includes one or more processors 1 and a memory 2. The memory 2 stores a computer program, which, when executed by the processor 1, implements the aforementioned ship crossing behavior analysis method.
[0029] As can be seen from the above description, the beneficial effects of the present invention are as follows: This system, through the cooperation of processor 1 and memory 2, ensures the stable operation of the computer program, realizes the engineering implementation of the method, and provides hardware support for practical applications; it supports the configuration of one or more processors 1, and can flexibly adjust hardware resources according to the amount of data processing, adapting to maritime management scenarios of different scales; the system design is highly compatible with the above-mentioned method, requiring no complex hardware modification or software integration, facilitating rapid deployment and daily maintenance, and lowering the user's threshold for use; it transforms the method into a directly usable system, realizing integrated processing from data input, analysis and calculation to result output, improving the practicality and operability of the technology.
[0030] Please refer to Figure 1 Embodiment 1 of the present invention is as follows: A method for analyzing ship line crossing behavior includes the following steps: S1. Receive and store the configuration information of the detection line segments drawn by the user on the electronic nautical chart; In step S1, the configuration information includes a unique identifier for the detected line segment, a user-defined line segment name, the latitude and longitude coordinates of the starting point, and the latitude and longitude coordinates of the ending point.
[0031] S2. Obtain historical trajectory data of the ship within the target time period, wherein the historical trajectory data includes multiple trajectory points arranged in a time sequence; In step S2, the historical trajectory data is obtained from the Automatic Identification System (AIS) base station database, the BeiDou Navigation Satellite System platform database, or the maritime data warehouse.
[0032] The trajectory points include the ship's maritime mobile service identification code, location coordinates, timestamp, heading information to the ground, and speed information to the ground.
[0033] S3. Traverse the historical trajectory data and determine whether the trajectory line segment formed by two adjacent trajectory points intersects with the detection line segment.
[0034] Step S3 is as follows: Calculate the bounding box of the trajectory line segment and the bounding box of the detection line segment. If the two bounding boxes do not overlap in the longitude or latitude direction, it is determined that the trajectory line segment and the detection line segment do not intersect.
[0035] If two bounding boxes overlap in the longitude or latitude direction, calculate the cross product of the direction vector of the detection line segment with the two endpoints of the trajectory line segment relative to the starting point of the detection line segment, and calculate the cross product of the direction vector of the trajectory line segment with the two endpoints of the detection line segment relative to the starting point of the trajectory line segment. If the product of the two cross products is less than zero, then the trajectory segment is determined to intersect with the detection segment.
[0036] S4. If the trajectory line segment intersects with the detection line segment, the direction in which the ship passes through the detection line segment is determined based on the direction of the trajectory line segment. Step S4 is as follows: S41. Calculate the direction vector of the detected line segment and the direction vector of the trajectory line segment; S42. Calculate the dot product of the direction vector of the detection line segment and the direction vector of the trajectory line segment; S43. If the vector dot product is greater than zero, it is determined that the direction in which the ship crosses the line is consistent with the direction set by the detection line segment, and is recorded as positive. If the vector dot product is less than zero, it is determined that the direction in which the ship crosses the line is opposite to the direction set by the detection line segment, and is recorded as reverse. If the vector dot product is equal to zero, then the direction is further determined or marked as perpendicular crossing based on the trend of the adjacent trajectory segments before and after the ship.
[0037] S5. Based on the direction in which the ship passes through the detection line segment, generate and output the directional crossing statistics for the detection line segment.
[0038] The directional line crossing statistics results in step S5 include a list of line crossing event records and a summary of directional flow statistics, wherein: The list of crossing events includes a unique identifier for each crossing event, the vessel's Maritime Mobility Service Identifier (MMSI), the crossing timestamp, the latitude and longitude of the crossing intersection point, and the crossing direction. The directional flow statistics summary includes the detection line segment identifier, detection line segment name, total number of vessels crossing the line in the forward direction, total number of vessels crossing the line in the reverse direction, and total number of vessels crossing the line.
[0039] In step S5, the method of outputting the directional crossing statistics of the detected line segment includes visualization on an electronic nautical chart and generating a statistical report.
[0040] The visualization uses dynamic arrows of different colors to indicate the main flow direction and marks the number of ships crossing the line in each direction next to the detection line segment; The statistical report supports exporting in Excel and PDF formats and includes detailed event records and summary data.
[0041] The specific steps of the above-mentioned method for analyzing ship line crossing behavior are as follows: Step 1: Receive and store the detection line segment configuration information: The system provides a human-computer interaction interface (such as a web interface), which allows users to customize detection line segments on electronic nautical charts by drawing with a mouse, inputting coordinates, etc., and can draw one or more detection line segments; The system receives the detection line segment configuration information drawn by the user. This configuration information includes: the unique identifier of the detection line segment (such as ID number), the user-defined line segment name (such as "port access channel detection line"), the latitude and longitude coordinates of the starting point (Lon_Start, Lat_Start) and the latitude and longitude coordinates of the ending point (Lon_End, Lat_End). The system stores the configuration information in the database and establishes a detection segment configuration information table to provide basic data for subsequent analysis and calculation.
[0042] Step 2: Obtain historical ship trajectory data: The system connects to data sources such as the Automatic Identification System (AIS) base station database, the BeiDou Navigation Satellite System platform database, or the maritime data warehouse through a data interface module; Users can set the target time range (e.g., "2025-10-01 00:00:00" to "2025-10-01 23:59:59") and the target vessel range (e.g., "all vessels in a specific water area" or "vessels with a specified MMSI") through the system. The system retrieves historical trajectory data of the target vessel from the data source based on the set conditions. This data includes multiple trajectory points arranged in a time series. Each trajectory point contains: the vessel's Maritime Mobility Service Identifier (MMSI), position coordinates (latitude and longitude), timestamp (Time), heading information (COG), and speed information (SOG). The system preprocesses the acquired historical trajectory data, including data cleaning (removing outliers and missing values) and format standardization (unifying coordinate and timestamp formats) to ensure data quality.
[0043] Step 3: Determine whether the trajectory line segment intersects with the detection line segment: 1. Data preparation: The system reads the detection line segment configuration information stored in step one from the database, extracts the historical trajectory points of a single ship from the preprocessed trajectory data, and sorts them in chronological order; 2. Construct trajectory segments: Traverse the historical trajectory data of the ship, and take two adjacent trajectory points P1 (Lon1, Lat1, Time1) and P2 (Lon2, Lat2, Time2) in sequence to construct trajectory segments P1P2; 3. Boundary box calculation and preliminary judgment: Calculate the bounding box of trajectory line segment P1P2: the longitude range is [min (Lon1, Lon2), max (Lon1, Lon2)], and the latitude range is [min (Lat1, Lat2), max (Lat1, Lat2)]; Calculate the bounding box of the detected line segment AB (A is the starting point and B is the ending point): the longitude range is [min(Lon_A, Lon_B), max(Lon_A, Lon_B)], and the latitude range is [min(Lat_A, Lat_B), max(Lat_A, Lat_B)]; Determine the overlap of bounding boxes: If the bounding box of trajectory line segment P1P2 does not overlap with the bounding box of detection line segment AB in the longitude direction (i.e., the minimum longitude of the trajectory line segment > the maximum longitude of the detection line segment or the maximum longitude of the trajectory line segment < the minimum longitude of the detection line segment) or the latitude direction (i.e., the minimum latitude of the trajectory line segment > the maximum latitude of the detection line segment or the maximum latitude of the trajectory line segment < the minimum latitude of the detection line segment), then it is directly determined that trajectory line segment P1P2 does not intersect with detection line segment AB, and the next set of adjacent trajectory points is processed. Cross product calculation and precise judgment: If two bounding boxes overlap, calculate the following four cross products: C1 = cross((BA), (P1-A)) represents the cross product of the direction vector of the detected line segment and the relative position of the trajectory point P1; C2 = cross((B - A), (P2 - A)) represents the cross product of the direction vector of the detected line segment and the relative position of the trajectory point P2; C3 = cross((P2 - P1), (A - P1)), which represents the cross product of the direction vector of the trajectory line segment and the relative position of the starting point A; C4 = cross((P2-P1), (B - P1)), which represents the cross product of the direction vector of the trajectory line segment and the relative position of the endpoint B; Intersection determination: If C1×C2<0 and C3×C4<0 (i.e., the product of the two cross products is less than zero), then the trajectory line segment P1P2 is determined to intersect with the detection line segment AB; otherwise, it is determined to be non-intersecting.
[0044] The meanings of the above parameters are as follows: BA: The direction vector from the starting point A of the detection line to the ending point B; for example, if A (121.5, 31.2) and B (121.6, 31.3), then BA = (0.1, 0.1). P1-A: is the vector from the starting point A of the detection line to the previous point P1 on the trajectory.
[0045] P2-A: is the vector from the starting point A of the detection line to the next point P2 on the trajectory.
[0046] P2-P1: is the direction vector from the previous point P1 to the next point P2 on the trajectory, that is, the direction vector of the trajectory line segment.
[0047] A-P1: is the vector from the previous point P1 on the trajectory to the starting point A of the detection line.
[0048] B-P1: is the vector from the previous point P1 on the trajectory to the end point B of the detection line.
[0049] Step 4: Determine the direction of the vessel crossing the line: 1. Vector Calculation: If the trajectory segment P1P2 determined in step three intersects with the detection segment AB, then the following calculation is performed: Calculate the direction vector V_line = (Lon_B-Lon_A, Lat_B-Lat_A) for the detected line segment AB; Calculate the direction vector V_track = (Lon2-Lon1, Lat2-Lat1) for trajectory line segment P1P2; Vector dot product calculation: Calculate the vector dot product of V_line and V_track: Dot_Value = (Lon_B - Lon_A) × (Lon2 - Lon1) + (Lat_B - Lat_A) × (Lat2 - Lat1); Direction determination: If Dot_Value>0, it is determined that the direction of the ship crossing the line is consistent with the set direction of the detection line segment AB (from the starting point A to the ending point B), and is recorded as "positive direction"; If Dot_Value < 0, then the direction in which the ship crosses the line is determined to be opposite to the set direction of the detection line segment AB, and is recorded as "reverse". If Dot_Value=0 (i.e. the two vectors are perpendicular), then obtain the adjacent trajectory segments (such as P0P1 and P2P3) of the ship, analyze its driving trend, and supplement the determination of the crossing direction; if it is not possible to supplement the determination, then mark it as "perpendicular crossing".
[0050] Step 5: Generate and output the directional line crossing statistics: 1. Construct a line crossing event record list: For each intersection determination result, generate a line crossing event record, which includes: event unique identifier (such as UUID), ship's MMSI, line crossing timestamp (accurate line crossing time is calculated by interpolation based on the timestamps of trajectory point P1 and trajectory point P2), latitude and longitude of the line crossing intersection point (determined based on the intersection calculation result of trajectory line segment P1P2 and detection line segment AB), and line crossing direction (forward / reverse / perpendicular line crossing); 2. Generate directional flow statistics summary: Statistically analyze all line-crossing events within the target time, group them by detection line segment, summarize the total number of vessels crossing the line in the forward direction and the total number of vessels crossing the line in the reverse direction for each detection line segment, and calculate the total number of vessels crossing the line (total number of vessels crossing the line in the forward direction + total number of vessels crossing the line in the reverse direction + total number of vessels crossing the line perpendicularly), forming a statistical summary data that includes detection line segment identifier, detection line segment name, total number of vessels crossing the line in the forward direction, total number of vessels crossing the line in the reverse direction, and total number of vessels crossing the line; 3. Visualization: On the electronic nautical chart, at the corresponding position of the detection line segment AB, the statistical results are visually displayed in the form of text labels (such as "Forward: 120 vessels | Reverse: 95 vessels | Total: 215 vessels") and dynamic arrows (different colored arrows indicate the forward and reverse main current directions); 4. Statistical Report Generation: The system automatically generates standardized statistical reports, which include detection line segment configuration information, target time range, list of line crossing event records, directional flow statistics summary, flow trend analysis, etc., and support users to export to PDF, Excel and other formats.
[0051] Please refer to Figure 2 Embodiment two of the present invention is as follows: A ship crossing behavior analysis system includes one or more processors 1 and a memory 2. The memory 2 stores a computer program, which, when executed by the processor 1, implements the aforementioned ship crossing behavior analysis method.
[0052] In summary, the ship line-crossing behavior analysis method and system provided by this invention receives and stores the configuration information of at least one detection line segment drawn by the user on an electronic nautical chart, providing a flexible and customizable detection benchmark for subsequent analysis. Furthermore, by acquiring historical trajectory data of at least one ship within a target time period, containing multiple trajectory points arranged in a time sequence, a data foundation for accurate analysis is laid. The subsequent step of traversing the historical trajectory data and determining whether the trajectory line segment formed by adjacent trajectory points intersects with the detection line segment achieves automatic identification of ship line-crossing behavior. The step of determining the direction in which the ship crosses the detection line segment based on the direction of the trajectory line segment when intersection occurs is based on the automatic identification of line-crossing behavior. The system further refines the accurate determination of the crossing direction. Finally, it generates and outputs directional crossing statistics for the detected line segment based on the determination results, forming a complete closed loop. Each step is interconnected and closely coordinated, achieving automatic identification of ship crossing behavior without human intervention. It also accurately determines the crossing direction through correlation analysis between the trajectory line segment direction and the detected line segment. This effectively solves the shortcomings of traditional methods that cannot automatically identify crossing behavior or distinguish crossing direction. Furthermore, relying on custom detection line segment configurations and existing trajectory data, it achieves low-cost and high-precision ship crossing behavior analysis without relying on physical hardware, significantly improving the intelligence level of maritime supervision and waterway analysis.
[0053] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for analyzing ship crossing behavior, characterized in that, Includes the following steps: S1. Receive and store the configuration information of the detection line segments drawn by the user on the electronic nautical chart; S2. Obtain historical trajectory data of the ship within the target time period, wherein the historical trajectory data includes multiple trajectory points arranged in a time sequence; S3. Traverse the historical trajectory data and determine whether the trajectory line segment formed by two adjacent trajectory points intersects with the detection line segment; S4. If the trajectory line segment intersects with the detection line segment, the direction in which the ship passes through the detection line segment is determined based on the direction of the trajectory line segment. S5. Based on the direction in which the ship passes through the detection line segment, generate and output the directional crossing statistics for the detection line segment.
2. The method for analyzing ship crossing behavior according to claim 1, characterized in that, Step S3 is as follows: Calculate the bounding box of the trajectory line segment and the bounding box of the detection line segment. If the two bounding boxes do not overlap in the longitude or latitude direction, it is determined that the trajectory line segment and the detection line segment do not intersect.
3. The method for analyzing ship line crossing behavior according to claim 2, characterized in that, If two bounding boxes overlap in the longitude or latitude direction, calculate the cross product of the direction vector of the detection line segment with the two endpoints of the trajectory line segment relative to the starting point of the detection line segment, and calculate the cross product of the direction vector of the trajectory line segment with the two endpoints of the detection line segment relative to the starting point of the trajectory line segment. If the product of the two cross products is less than zero, then the trajectory segment is determined to intersect with the detection segment.
4. The method for analyzing ship crossing behavior according to claim 1, characterized in that, Step S4 is as follows: S41. Calculate the direction vector of the detected line segment and the direction vector of the trajectory line segment; S42. Calculate the dot product of the direction vector of the detection line segment and the direction vector of the trajectory line segment; S43. If the vector dot product is greater than zero, it is determined that the direction in which the ship crosses the line is consistent with the direction set by the detection line segment, and is recorded as positive. If the vector dot product is less than zero, it is determined that the direction in which the ship crosses the line is opposite to the direction set by the detection line segment, and is recorded as reverse. If the vector dot product is equal to zero, then the direction is further determined or marked as perpendicular crossing based on the trend of the adjacent trajectory segments before and after the ship.
5. The method for analyzing ship crossing behavior according to claim 1, characterized in that, The directional line crossing statistics results in step S5 include a list of line crossing event records and a summary of directional flow statistics, wherein: The list of crossing events includes a unique identifier for each crossing event, the vessel's maritime movement service identification code, the crossing timestamp, the latitude and longitude of the crossing intersection point, and the crossing direction. The directional flow statistics summary includes the detection line segment identifier, detection line segment name, total number of vessels crossing the line in the forward direction, total number of vessels crossing the line in the reverse direction, and total number of vessels crossing the line.
6. The method for analyzing ship line crossing behavior according to claim 1, characterized in that, In step S5, the method of outputting the directional crossing statistics of the detected line segment includes visualization on an electronic nautical chart and generating a statistical report.
7. The method for analyzing ship line crossing behavior according to claim 1, characterized in that, In step S1, the configuration information includes a unique identifier for the detected line segment, a user-defined line segment name, the latitude and longitude coordinates of the starting point, and the latitude and longitude coordinates of the ending point.
8. The method for analyzing ship crossing behavior according to claim 1, characterized in that, In step S2, the historical trajectory data is obtained from the Automatic Identification System (AIS) base station database, the BeiDou Navigation Satellite System platform database, or the maritime data warehouse.
9. The method for analyzing ship line crossing behavior according to claim 1, characterized in that, The trajectory points include the ship's maritime mobile service identification code, location coordinates, timestamp, heading information to the ground, and speed information to the ground.
10. A ship line-crossing behavior analysis system, characterized in that, It includes one or more processors and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the ship crossing behavior analysis method according to any one of claims 1 to 9.