Geographical fence determination method based on GPS data

By combining the ray method and the shortest distance determination technology of points and paths, a geofence determination method based on GPS data is provided, which solves the problems of insufficient fence determination and misjudgment in the prior art, and realizes high-precision, dynamic real-time monitoring of the dump truck operation area.

CN119789045APending Publication Date: 2025-04-08NANJING TOP SUN TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411974279.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The existing geofencing technology shows obvious shortcomings in complex and dynamic operation scenarios of dump trucks. Simple geometric fences cannot adapt to irregular operating areas of dump trucks. Static fences lack dynamic update capabilities. Traditional ray methods are easily affected by floating point errors, resulting in misjudgment or repeated counting.

Method used

Combining the ray method and the shortest distance determination technology of points and paths, a geofence determination method based on GPS data is provided through static high-precision determination and dynamic path real-time support. The method includes uploading location information by vehicle GPS, monitoring messages for fence determination, using fence determination algorithm to make judgments, and performing early warning or logging when fence is triggered.

Benefits of technology

It realizes high-precision monitoring of the dump truck operating area, is suitable for complex polygonal areas, and can adapt to dynamic path changes in real time, reducing the possibility of boundary misjudgment, and significantly improving the accuracy and real-time nature of operation monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119789045A_ABST
    Figure CN119789045A_ABST
Patent Text Reader

Abstract

The present invention relates to the field of geographic fence determination technology, and in particular to a geographic fence determination method based on GPS data, comprising the following steps: step one: uploading vehicle location information to a message service Kafka through a vehicle GPS; step two: in the fence determination service, monitoring Kafka messages; step three: for each group of vehicle location information, using a fence determination algorithm to make a determination through GPS data; step four: after a vehicle triggers a fence, continuing to trigger corresponding fence rules, and making an early warning or log record. In the present invention, a ray method is used to make a high-precision determination of a static polygonal fence, which is suitable for operation monitoring in a fixed area. At the same time, a dynamic path determination technology is introduced to calculate the shortest distance from a target point to a path in real time, thereby ensuring that the frequently changing operation trajectory of a muck truck is also within the monitoring range. Through a floating-point error correction and tolerance mechanism, the possibility of boundary misjudgment is effectively reduced, and the accuracy and real-time performance of muck truck operation monitoring are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of geo-fence determination, and in particular to a geo-fence determination method based on GPS data. Background Art

[0002] Existing geo-fencing technologies, such as the determination of points and circular or polygonal areas, are obviously insufficient in complex dynamic operation scenarios of muck trucks. Simple geometric fences cannot adapt to the irregular operation areas of muck trucks, and static fences lack dynamic update capabilities and cannot effectively handle frequent changes in paths and areas. In addition, traditional ray methods are easily affected by floating-point errors when dealing with boundary problems, resulting in misjudgment or repeated counting. During the operation of muck trucks, there are problems such as exceeding the specified area and illegal dumping of muck, which puts higher requirements on urban management.

[0003] How to combine the ray method with the shortest distance determination technology between points and paths, through static high-precision determination and real-time support of dynamic paths, can effectively solve the shortcomings of traditional technology. Therefore, a geographic fence determination method based on GPS data is proposed to address the above problems. Summary of the invention

[0004] The purpose of the present invention is to provide a geographic fence determination method based on GPS data to solve the problem of how to combine the ray method with the shortest distance determination technology between points and paths, and to solve the shortcomings of traditional technologies through static high-precision determination and real-time support of dynamic paths.

[0005] To achieve the above object, the present invention provides the following technical solutions:

[0006] The method for determining geographic fences based on GPS data includes the following steps:

[0007] Step 1: Upload vehicle location information to the message service Kafka through the vehicle GPS;

[0008] Step 2: In the fence determination service, listen to Kafka messages;

[0009] Step 3: For each set of vehicle location information, use the fence determination algorithm to determine based on GPS data;

[0010] Step 4: After the vehicle triggers the fence, continue to trigger the corresponding fence rules to issue an early warning or log record.

[0011] As a further optimized content of the present invention, the process of using the fence determination algorithm to determine through GPS data is as follows:

[0012] S1: Preprocessing of latitude and longitude input:

[0013] Get the geographic latitude and longitude information (lat, lon) of the current location of the muck truck;

[0014] The geographic longitude and latitude information (lat, lon) is converted into plane rectangular coordinates (x, y) through the coordinate projection algorithm for geometric calculations;

[0015] S2: Static fence determination:

[0016] Use the ray method to determine whether the target point is within the polygonal area:

[0017] S21: Read the coordinates of the fence polygon vertices P=P1, P2, ..., Pn;

[0018] S22: emit a horizontal ray to the target point (x, y) and calculate the number of intersections between the ray and the polygon edge;

[0019] S23: If the number of intersection points is an odd number, the target point is inside the fence;

[0020] If the number of intersection points is even, the target point is outside the fence;

[0021] S3: Dynamic path determination:

[0022] By calculating the shortest distance from the target point to the path, determine whether it is within the influence range of the dynamic path:

[0023] S31: providing a point set P = P1, P2, ..., Pn of a dynamic path;

[0024] S32: Calculate the distance from the target point (x, y) to each path segment [P i ,P i+1 ]’s shortest distance d;

[0025] S33: If d≤d threshold Then the target point is within the dynamic path range;

[0026] S4: Comprehensive judgment output:

[0027] According to the determination results of the static fence and the dynamic path, the fence status of the target point is output:

[0028] If the target point is within the static fence or the dynamic path range, it is determined to be a legal operation area;

[0029] If the target point is not in any area, it is considered an illegal operation.

[0030] As a further optimized content of the present invention, wherein: the calculation of the number of intersections between the ray and the polygon edge in S22 comprises the following steps:

[0031] S221: Define polygon vertices and target points: Assume that the fence polygon is represented by a set of vertices, where the coordinates of each vertex are (x i ,y i ), the coordinates of the target point are (x, y);

[0032] S222: Calculate the intersection of the ray and the edge: Check whether the ray intersects each edge of the polygon [P i ,P i+1 ]intersect;

[0033] S223: Determine whether the point is on the line segment. The intersection point must be within the range of the edge, that is, it satisfies:

[0034] min(x i ,x i+1 )≤x intersect ≤max(x i ,x i+1 )

[0035] S224: Status of the parity determination point:

[0036] Count the number of intersections N between the ray and all edges. If N is an odd number, the target point is inside the fence; if N is an even number, the target point is outside the fence.

[0037] As a further optimization of the present invention, in which: in said S222, checking whether the ray is in contact with each edge of the polygon [P i ,P i+1 ] intersects, including the following steps:

[0038] S2221: Define ray as y=y point , the endpoints of each side of the polygon are (xi,yi) and (x i+1 ,y i+1 ), and the intersection point satisfies:

[0039] min(y i ,y i+1 )-ε<y≤max(y i ,y i+1 )+ε

[0040] In the formula, ε is the error tolerance value;

[0041] S2222: Calculate the slope k of the edge. The calculation formula for the slope k of the edge is:

[0042]

[0043] If x i+1 =x, the edge is a vertical edge, and the intersection point is directly recorded as the x coordinate of the edge;

[0044] S2223: Calculate the horizontal coordinate x of the intersection point intersect :

[0045]

[0046] In the formula, y i+1 ≠y i , δx is the error term, where the value of δx takes a smaller offset value of 10 according to the application scenario and calculation requirements. -8 ;

[0047] If the edge is horizontal, the ray will not intersect it.

[0048] As a further optimization of the present invention, in said S32, the target point (x, y) to each path line segment [P i ,P i+1 The calculation formula of the shortest distance d of ] is:

[0049]

[0050] In the formula, x proj and proj is the projection point.

[0051] As a further optimization of the present invention, wherein: the projection point x proj and proj The calculation formula is:

[0052] t<0: The closest point is the path point P i ;

[0053] t>1: The closest point is the path point P i+1 ;

[0054] 0≤t≤1: The closest point is on the path segment. The calculation formula for the projection point on the path segment is:

[0055] (x proj ,y proj )=(x i +t(x i+1 -x i ),y i +t(y i+1 -y i )).

[0056] Compared with the prior art, the present invention has the following beneficial effects:

[0057] 1. In the present invention, the ray method is used to make high-precision judgments on static polygonal fences, which is suitable for operation monitoring in fixed areas. At the same time, the dynamic path judgment technology is introduced to calculate the shortest distance from the target point to the path in real time, ensuring that the frequently changing operation trajectory of the muck truck is also within the monitoring range. The floating point error correction and tolerance mechanism effectively reduces the possibility of boundary misjudgment. Compared with traditional technologies, the present invention has significant advantages in accuracy, dynamic support, robustness and scalability, significantly improves the accuracy and real-time performance of muck truck operation monitoring, and provides efficient technical support for urban construction and management. By combining the high-precision judgment of static fences with the real-time support of dynamic paths, the fence judgment problem in muck truck operation monitoring is optimized;

[0058] 2. In the present invention, the static fence can accurately process complex polygonal areas through the optimized ray method, while the dynamic path technology makes up for the deficiency that the traditional static fence cannot adapt to dynamic changes. The present invention also realizes the combination of fixed fence and dynamic trajectory through a flexible hybrid monitoring mode to adapt to diverse scene requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 Flow chart of the algorithm-based geo-fence determination of the present invention. DETAILED DESCRIPTION

[0060] See also Figure 1 , the present invention provides a technical solution:

[0061] The method for determining geographic fences based on GPS data includes the following steps:

[0062] Step 1: Upload the vehicle location information to the message service Kafka through the vehicle GPS. The message service Kafka of the present invention is a distributed streaming processing platform used by the vehicle GPS;

[0063] Step 2: In the fence determination service, listen to Kafka messages;

[0064] Step 3: For each set of vehicle location information, use the fence determination algorithm to determine based on GPS data;

[0065] Step 4: After the vehicle triggers the fence, continue to trigger the corresponding fence rules to issue an early warning or log record.

[0066] As a technical solution for further implementation of this solution, the process of using the fence determination algorithm through GPS data to make a determination is as follows:

[0067] S1: Preprocessing of latitude and longitude input:

[0068] Get the geographic latitude and longitude information (lat, lon) of the current location of the muck truck;

[0069] The geographic longitude and latitude information (lat, lon) is converted into plane rectangular coordinates (x, y) through the coordinate projection algorithm for geometric calculations;

[0070] S2: Static fence determination:

[0071] Use the ray method to determine whether the target point is within the polygonal area:

[0072] S21: Read the coordinates of the fence polygon vertices P=P1, P2, ..., Pn;

[0073] S22: emit a horizontal ray to the target point (x, y) and calculate the number of intersections between the ray and the polygon edge;

[0074] S23: If the number of intersection points is an odd number, the target point is inside the fence;

[0075] If the number of intersection points is even, the target point is outside the fence;

[0076] S3: Dynamic path determination:

[0077] By calculating the shortest distance from the target point to the path, determine whether it is within the influence range of the dynamic path:

[0078] S31: providing a point set P = P1, P2, ..., Pn of a dynamic path;

[0079] S32: Calculate the distance from the target point (x, y) to each path segment [P i ,P i+1 ]’s shortest distance d;

[0080] S33: If d≤d threshold Then the target point is within the dynamic path range;

[0081] S4: Comprehensive judgment output:

[0082] According to the determination results of the static fence and the dynamic path, the fence status of the target point is output:

[0083] If the target point is within the static fence or the dynamic path range, it is determined to be a legal operation area;

[0084] If the target point is not in any area, it is judged as illegal operation. The ray method is used to make high-precision judgments on static polygonal fences, which is suitable for operation monitoring in fixed areas. At the same time, dynamic path judgment technology is introduced to calculate the shortest distance from the target point to the path in real time to ensure that the frequently changing operation trajectory of the muck truck is also within the monitoring range;

[0085] As a technical solution for further implementing this solution, the calculation of the number of intersections between the ray and the polygon edge in S22 includes the following steps:

[0086] S221: Define polygon vertices and target points: Assume that the fence polygon is represented by a set of vertices, where the coordinates of each vertex are (x i ,y i ), the coordinates of the target point are (x, y);

[0087] S222: Calculate the intersection of the ray and the edge: Check whether the ray intersects each edge of the polygon [P i ,P i+1 ]intersect;

[0088] S223: Determine whether the point is on the line segment. The intersection point must be within the range of the edge, that is, it satisfies:

[0089] min(x i ,x i+1 )≤x intersect ≤max(x i ,x i+1 )

[0090] S224: Status of the parity determination point:

[0091] Count the number of intersections N between the ray and all edges. If N is an odd number, the target point is inside the fence; if N is an even number, the target point is outside the fence. The above can be used to calculate the number of intersections between the ray and the polygon edge, and the number of intersections can be used to determine whether the target is inside the fence.

[0092] As a further technical solution for implementing this solution, in S222, it is checked whether the ray is in contact with each edge of the polygon [P i ,P i+1 ] intersects, including the following steps:

[0093] S2221: Define ray as y=y point , the endpoints of each side of the polygon are (xi,yi) and (x i+1 ,y i+1 ), and the intersection point satisfies:

[0094] min(y i ,y i+1 )-ε<y≤max(y i ,y i+1 )+ε

[0095] In the formula, ε is the error tolerance value;

[0096] S2222: Calculate the slope k of the edge. The calculation formula for the slope k of the edge is:

[0097]

[0098] If x i+1 =x, the edge is a vertical edge, and the intersection point is directly recorded as the x coordinate of the edge;

[0099] S2223: Calculate the horizontal coordinate x of the intersection point intersect :

[0100]

[0101] In the formula, y i+1 ≠y i , δx is the error term, where the value of δx takes a smaller offset value of 10 according to the application scenario and calculation requirements. -8 ;

[0102] If the edge is horizontal, the ray will not intersect it, which can avoid the problem of precision errors (such as rounding errors) when floating-point numbers are stored and calculated in the computer, which may lead to errors in the determination of points and boundaries. For example, in the calculation of intersection coordinates, due to precision problems, the ray may be determined to be not intersecting with the edge, and when the point is exactly on the line segment, the error may lead to the problem of wrong parity determination.

[0103] As a further technical solution for implementing this solution, it is characterized in that: in S32, the target point (x, y) to each path line segment [P i ,P i+1 The calculation formula of the shortest distance d of ] is:

[0104]

[0105] In the formula, x proj and proj is the projection point;

[0106] Projection point x proj and proj The calculation formula is:

[0107] t<0: The closest point is the path point P i ;

[0108] t>1: The closest point is the path point P i+1 ;

[0109] 0≤t≤1: The closest point is on the path segment. The calculation formula for the projection point on the path segment is:

[0110] (x proj ,y proj )=(x i +t(x i+1 -x i ),y i +t(yi+1 -y i )), by providing a dynamic path algorithm for compensation, the path points can be updated in real time to adapt to changes in the vehicle trajectory and ensure that the fence can adjust to the dynamic environment; the extension of the path range can be refined to the local area around each path point to ensure that the point is determined with high accuracy in the local environment; combined with the boundary filtering mechanism of the ray method, the dynamic path can quickly exclude target points that are not within the range and reduce computational overhead.

[0111] The present invention uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only used to help understand the methods and core ideas of the present invention. The above is only a preferred implementation of the present invention. It should be pointed out that due to the limitations of textual expression, there are objectively infinite specific structures. For ordinary technicians in this technical field, without departing from the principles of the present invention, they can make several improvements, modifications or changes, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the inventive concept and technical solution to other occasions without improvement, should be regarded as the protection scope of the present invention.

Claims

1. A method for determining a geographic fence based on GPS data, characterized in that: The following steps are involved: Step 1: Upload vehicle location information to the message service Kafka through the vehicle GPS; Step 2: In the fence determination service, listen to Kafka messages; Step 3: For each set of vehicle location information, use the fence determination algorithm to determine based on GPS data; Step 4: After the vehicle triggers the fence, continue to trigger the corresponding fence rules to issue an early warning or log record.

2. The method for determining geographic fences based on GPS data according to claim 1, characterized in that: The process of using the fence determination algorithm to determine the GPS data is as follows: S1: Preprocessing of latitude and longitude input: Get the geographic latitude and longitude information (lat, lon) of the current location of the muck truck; The geographic longitude and latitude information (lat, lon) is converted into plane rectangular coordinates (x, y) through the coordinate projection algorithm for geometric calculations; S2: Static fence determination: Use the ray method to determine whether the target point is within the polygonal area: S21: Read the coordinates of the fence polygon vertices P=P1, P2, ..., Pn; S22: emit a horizontal ray to the target point (x, y) and calculate the number of intersections between the ray and the polygon edge; S23: If the number of intersection points is an odd number, the target point is inside the fence; If the number of intersection points is even, the target point is outside the fence; S3: Dynamic path determination: By calculating the shortest distance from the target point to the path, determine whether it is within the influence range of the dynamic path: S31: providing a point set P = P1, P2, ..., Pn of a dynamic path; S32: Calculate the distance from the target point (x, y) to each path segment [P i ,P i+1 ]’s shortest distance d; S33: If d≤d threshold Then the target point is within the dynamic path range; S4: Comprehensive judgment output: According to the determination results of the static fence and the dynamic path, the fence status of the target point is output: If the target point is within the static fence or the dynamic path range, it is determined to be a legal operation area; If the target point is not in any area, it is considered an illegal operation.

3. The method for determining geographic fences based on GPS data according to claim 2, characterized in that: The calculation of the number of intersections between the ray and the polygon edge in S22 includes the following steps: S221: Define polygon vertices and target points: Assume that the fence polygon is represented by a set of vertices, where the coordinates of each vertex are (x i ,y i ), the coordinates of the target point are (x, y); S222: Calculate the intersection of the ray and the edge: Check whether the ray intersects each edge of the polygon [P i ,P i+1 ]intersect; S223: Determine whether the point is on the line segment. The intersection point must be within the range of the edge, that is, it satisfies: min(x i ,x i+1 )≤x intersect ≤max(x i ,x i+1 ) S224: Status of the parity determination point: Count the number of intersections N between the ray and all edges. If N is an odd number, the target point is inside the fence; if N is an even number, the target point is outside the fence.

4. The method for determining geographic fences based on GPS data according to claim 3, characterized in that: In S222, it is checked whether the ray is aligned with each edge of the polygon [P i ,P i+1 ] intersects, including the following steps: S2221: Define ray as y=y point , the endpoints of each side of the polygon are (xi,yi) and (x i+1 ,y i+1 ), and the intersection point satisfies: min(and i ,and i+1 )-ε<y≤max(y i ,and i+1 )+ε In the formula, ε is the error tolerance value; S2222: Calculate the slope k of the edge. The calculation formula for the slope k of the edge is: If x i+1 =x, the edge is a vertical edge, and the intersection point is directly recorded as the x coordinate of the edge; S2223: Calculate the horizontal coordinate x of the intersection point intersect : In the formula, y i+1 ≠y i , δx is the error term, where the value of δx takes a smaller offset value of 10 according to the application scenario and calculation requirements. -8 ; If the edge is horizontal, the ray will not intersect it.

5. The method for determining geographic fences based on GPS data according to claim 2, characterized in that: In S32, the target point (x, y) to each path segment [P i ,P i+1 The calculation formula of the shortest distance d of ] is: In the formula, x proj and proj is the projection point.

6. The method for determining geographic fences based on GPS data according to claim 5, characterized in that: The projection point x proj and proj The calculation formula is: t<0: The closest point is the path point P i ; t>1: The closest point is the path point P i+1 ; 0≤t≤1: The closest point is on the path segment. The calculation formula for the projection point on the path segment is: (x proj ,y proj )=(x i +t(x i+1 -x i ),y i +t(y i+1 -y i ))。

Citation Information

Cited By

  • Electronic fence entering and leaving judgment method

    CN120343495A