Electronic geo-fence detection method and system, and embedded device
By judging the shortest distance value between the electronic device and the electronic geofence boundary, and combining the positioning data and fence area data to detect the relative position relationship, the problem of repeated horizontal jumps in the detection results caused by positioning data error in traditional methods is solved, improving the stability of the detection Sex and accuracy.
Patent Information
- Application Number
- CN202310964291.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-01
- Publication Date
- 2025-02-14
AI Technical Summary
Traditional electronic geofence detection methods cause repeated jumps in detection results due to positioning data acquisition errors, affecting the stability and accuracy of the detection.
By acquiring the positioning data of the electronic device, it is determined whether the shortest distance value between the corresponding positioning data and the boundary of the target electronic geofence is greater than the preset value. If so, the previous state will be directly output. Otherwise, based on the positioning data and fence area data, it will be based on the positioning data and the fence area data. Detect relative positional relationships to avoid error effects.
It improves the stability and accuracy of electronic geofence detection, reduces the repeated jumps in detection results caused by positioning data errors, supports fences of multiple shapes, and reduces data traffic and energy consumption on the device and server side.
Smart Images

Figure CN119450355A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an electronic geographic fence detection method and system, and an embedded device. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the invention recited in the claims. No admission is made that the description herein is prior art by its inclusion in this section.
[0003] In wearable electronic products such as children's watches, electronic geo-fencing is a very competitive product feature. Electronic geo-fencing is a practical function based on electronic maps. It is designed to delineate a circular, polygonal, linear and other location areas on the electronic map. When the device's location is out of this area, an alarm prompt and other operations will be performed. The traditional electronic geo-fencing algorithm runs on the server side. The device side only uploads the geographic location information (obtained from hardware channels such as GPS) to the server side in real time, and the server determines the electronic fence algorithm. Since the collected geographic location information may have certain errors, for example, when the test point is actually on a line, the collected data may randomly be on the left and right of the real point. Therefore, if the test point is close to the boundary of the electronic geo-fence, the relative position determination result of the electronic geo-fence and the test point may repeatedly jump between "outside the fence" and "inside the fence". Summary of the invention
[0004] The electronic geographic fence detection method, system, and embedded device provided by the embodiments of the present invention can at least improve the stability of relative position detection and ensure the accuracy of relative position relationship detection.
[0005] According to one aspect of the present application, there is also provided an electronic geo-fence detection method, including: acquiring positioning data of an electronic device; determining whether the shortest distance value between the position corresponding to the positioning data and the boundary of a target electronic geo-fence is greater than a first preset value; if so, detecting the relative position relationship between the electronic device and the target electronic geo-fence based on the positioning data and the fence area data of the target electronic geo-fence, wherein the relative position relationship is used to indicate whether the electronic device is located within the area of the target electronic geo-fence; if not, determining the relative position relationship between the electronic device and the target electronic geo-fence based on the detected relative position relationship.
[0006] According to another aspect of the present application, an embedded device is also provided, including: an acquisition module for acquiring positioning data of an electronic device; a judgment module for judging whether the shortest distance value between the position corresponding to the positioning data and the boundary of a target electronic geo-fence is greater than a first preset value; a detection module for, if yes, detecting the relative position relationship between the electronic device and the target electronic geo-fence based on the positioning data and the fence area data of the target electronic geo-fence, wherein the relative position relationship is used to indicate whether the electronic device is located within the area of the target electronic geo-fence; a determination module for, if no, determining the relative position relationship between the electronic device and the target electronic geo-fence based on the detected relative position relationship.
[0007] According to another aspect of the present application, an electronic geographic fence detection system is also provided, including: a server and the above-mentioned embedded device.
[0008] According to another aspect of the present application, an electronic device is provided, comprising: a processor; and a memory storing a program, wherein the program comprises instructions, and when the instructions are executed by the processor, the processor executes the above method.
[0009] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is also provided, wherein the computer instructions are used to enable the computer to execute the steps of the above method.
[0010] According to another aspect of the present application, a computer program product is also provided. The computer program product includes a computer program. When the computer program is executed by a processor, the above method steps are implemented.
[0011] Beneficial effects of the embodiments of the present invention:
[0012] In an embodiment of the present invention, positioning data of an electronic device is acquired; it is determined whether the shortest distance value between the position corresponding to the positioning data and the boundary of a target electronic geo-fence is greater than a first preset value; if so, the relative position relationship between the electronic device and the target electronic geo-fence is detected based on the positioning data and the fence area data of the target electronic geo-fence, wherein the relative position relationship is used to indicate whether the electronic device is located within the area of the target electronic geo-fence; if not, the relative position relationship between the electronic device and the target electronic geo-fence is determined based on the detected relative position relationship. After acquiring the positioning data of the electronic device, the embodiment of the present invention determines whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is greater than a first preset value, thereby determining whether the electronic device is on or near the boundary of the target electronic geo-fence; if on or near the boundary, the relative position relationship between the electronic device and the target electronic geo-fence is determined based on the detected relative position relationship, so as to avoid repeated horizontal jumps in the detection results due to the influence of positioning data collection errors, etc., and improve the stability of relative position detection; if not on or near the boundary, the relative position relationship between the electronic device and the target electronic geo-fence is detected based on the positioning data and the fence area data of the target electronic geo-fence, thereby ensuring the accuracy of relative position relationship detection.
[0013] The details of one or more embodiments of the invention are set forth in the following drawings and description so that other features, objects, and advantages of the invention are more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other embodiments can be obtained based on these drawings without creative work.
[0015] Figure 1 is a flow chart of an electronic geographic fence detection method according to an embodiment of the present invention;
[0016] Figure 2 is a schematic diagram of a polygonal electronic geographic fence detection method according to an embodiment of the present invention;
[0017] Figure 3 is a schematic diagram of a linear electronic geographic fence detection method according to an embodiment of the present invention;
[0018] Figure 4 is a schematic structural diagram of an electronic device of this embodiment;
[0019] Figure 5 It is a schematic diagram of the implementation process of the electronic geographic fence detection method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0020] Embodiments of the present embodiment will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present embodiment are shown in the accompanying drawings, it should be understood that the present embodiment can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, which are instead provided for a more thorough and complete understanding of the present embodiment. It should be understood that the drawings and embodiments of the present embodiment are only for exemplary purposes and are not intended to limit the scope of protection of the present embodiment.
[0021] At present, the existing electronic geofence calculation engines have different support for electronic geofences of various shapes. Some only support circular fences, and some only support circular and polygonal fences. Due to the limitations on the supported fence shapes, they cannot meet the various needs of users.
[0022] In addition, many fence determination algorithms can only run on the cloud. Since the determination algorithm of the electronic geofence (here referred to as the electronic geofence calculation engine) has a large amount of calculation, the embedded device side is generally used to simply collect location information through GPS and other devices, and then upload the location information to the cloud. The cloud runs the electronic geofence calculation engine to calculate the final result. Reporting the location information of the device to the cloud all the time consumes a lot of upstream and downstream data traffic, and also brings corresponding power consumption problems to the device. Some fence determination algorithms need to run on high-end embedded chips with high main frequency and very rich resources. Since some fence determination algorithms require strong computing power, if the electronic fence algorithm is to be executed on the device side, if the device side uses a general performance chip, it cannot bear the computing power required for the operation of the electronic fence algorithm.
[0023] In addition, for electronic geofences, the role of the calculation engine is to determine whether the test point is inside the fence, and the only indicators considered are the accuracy and stability of the judgment. Among them, stability means that when the test point is at the fence boundary and around it, there will be no repeated jumps between the results of "outside the fence" and "inside the fence", but a more stable state. Since the location information collected by the embedded system has certain errors, when the electronic device moves near the boundary of the electronic geofence, for example, when the electronic device is actually on a line, the collected data may randomly be on the left and right of the real point. These errors may cause the electronic geofence detection results to repeatedly jump between "outside the fence" and "inside the fence".
[0024] Based on the above background, the present application provides an electronic geographic fence detection method and system, and an embedded device. The method can support circular, polygonal and linear fences to meet the different needs of various users; by combining boundary distance detection with a specific fence judgment algorithm, the abnormal situations of the judgment algorithm are greatly reduced, thereby simplifying the difficulty of the algorithm so that it can run on chips with average performance; if the distance between the electronic device and the boundary is within the set boundary stability band, the next step of the judgment algorithm will not be performed, and the result will be output directly in the previous state, thereby solving the problem of horizontal jumps in the judgment results around the boundary.
[0025] The terms involved are explained below.
[0026] Electronic geofence: Geographic fence refers to a boundary drawn by people in the real world. When a child or object goes out of the boundary, there will be an alarm prompt and other effects. Electronic geofence means that people use electronic maps to draw a virtual boundary corresponding to the real world to achieve the purpose of monitoring whether children or objects go out of the boundary.
[0027] Geo-fence calculation engine: is a software algorithm or module used to calculate whether a given object's coordinates are inside or outside the geo-fence.
[0028] An embodiment of the present invention provides an electronic geographic fence detection method, which can be applied to electronic devices. Figure 1 is a flow chart of an electronic geo-fence detection method according to an embodiment of the present application. Figure 1 The method steps involved are described.
[0029] Step S101, obtaining positioning data of the electronic device.
[0030] In this step, the electronic device may be an embedded device and may be set in other devices or systems. For example, the electronic device may be a mobile phone, a tablet computer, a GPS (Global Positioning System) navigator, a car navigation system, a handheld GPS device, a smart watch or other portable or mobile device. The electronic device may be a cloud computing-related smart device or an IOT (Internet of Things) device.
[0031] Positioning data may include information such as longitude, latitude, altitude, speed and direction, and can be obtained through a variety of methods, such as global satellite positioning system, base station positioning, WiFi (wireless network communication technology) positioning, Bluetooth positioning, etc.
[0032] In the above steps, the positioning data of the electronic device is obtained in real time to provide data support for real-time electronic geographic fence detection.
[0033] Step S102, determining whether the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value.
[0034] In this step, the location of the electronic device can be determined based on the positioning data. Different electronic geofences have different information such as location, size, name, boundary, etc. The target electronic geofence is the electronic geofence on which the electronic geofence detection process is to be performed, wherein the purpose of the electronic geofence detection is to find out whether the electronic device enters or leaves the electronic fence.
[0035] It should be noted that, in the embodiment of the present invention, the boundary of the target electronic geographic fence can adopt a variety of shapes, for example, it can be a circle, a polygon, an irregular closed figure with one or more edges being curved, and a line.
[0036] The shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is the minimum value selected from multiple distance values between the calculated position corresponding to the positioning data and the boundary of the target electronic geo-fence.
[0037] The first preset value can be used to determine the specified distance from the boundary of the target electronic geofence, thereby classifying the positioning data according to the first preset value, and processing the positioning data whose shortest distance values from the boundary of the target electronic geofence are greater than and not greater than the first preset value respectively, so as to improve the stability of electronic geofence detection.
[0038] It should be noted that the first preset value can be set according to actual needs, and the embodiment of the present invention does not specifically limit this.
[0039] In the above steps, based on the step of determining whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value, boundary distance detection is performed. If the test point is on the boundary or the distance from the boundary is within the set boundary stability band, the next step of the judgment algorithm is not performed, and the result is directly output in the previous state, so as to solve the problem of horizontal jumps in the judgment results around the boundary and improve the stability of the electronic geographic fence detection results.
[0040] Step S103, if yes, then detect the relative position relationship between the electronic device and the target electronic geo-fence based on the positioning data and the fence area data of the target electronic geo-fence, wherein the relative position relationship is used to indicate whether the electronic device is located within the area of the target electronic geo-fence.
[0041] In this step, when the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is greater than a first preset value, it means that the position of the electronic device is not on or near the boundary of the electronic geo-fence, then based on the positioning data and the fence area data of the target electronic geo-fence, the relative position relationship between the electronic device and the target electronic geo-fence is detected, wherein the relative position relationship is used to indicate whether the electronic device is located within the area of the target electronic geo-fence.
[0042] The fence area data may include a set of coordinate points for drawing the fence and other auxiliary data, such as the radius of a circular fence, the coordinates of a reference point of a linear fence, etc.
[0043] In the above steps, by selecting positioning data that satisfies the condition that the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is greater than the first preset value, the positioning data on or near the boundary can be filtered out, so that the electronic geo-fence detection is performed only based on the positioning data far from the boundary, which can reduce the judgment of abnormal situations of positioning data on or near the boundary during the electronic geo-fence detection process and reduce the complexity of calculation. When the calculation complexity is reduced, the computing power required for calculation is also reduced, that is, the electronic geo-fence detection can be run on a chip with average performance, without the need for calculation processing on the server, thereby greatly reducing the uplink and downlink traffic and reducing the energy consumption of electronic devices.
[0044] Step S104: if not, determining the relative position relationship between the electronic device and the target electronic geographic fence based on the detected relative position relationship.
[0045] In this step, when the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is not greater than the first preset value, it means that the position of the electronic device is on or near the boundary of the electronic geo-fence. Then, the relative position relationship between the electronic device and the target electronic geo-fence is determined based on the detected relative position relationship.
[0046] In the above steps, by selecting positioning data that satisfies the condition that the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is not greater than a first preset value, the relative position relationship between the electronic device and the target electronic geo-fence can be determined for the positioning data corresponding to the boundary or near the boundary based on the detected relative position relationship. The detected relative position relationship is used to perform electronic geo-fence detection. For example, for point A outside the fence boundary and close to the fence, its detected relative position relationship is outside the area of the target electronic geo-fence. The electronic geo-fence detection is performed using the detected relative position relationship, and the relative position relationship between the electronic device and the target electronic geo-fence can be directly output as being outside the area of the target electronic geo-fence.
[0047] An embodiment of the present invention obtains positioning data of an electronic device; determines whether the shortest distance value between the position corresponding to the positioning data and the boundary of a target electronic geo-fence is greater than a first preset value; if so, detects the relative position relationship between the electronic device and the target electronic geo-fence based on the positioning data and the fence area data of the target electronic geo-fence, wherein the relative position relationship is used to indicate whether the electronic device is located within the area of the target electronic geo-fence; if not, determines the relative position relationship between the electronic device and the target electronic geo-fence based on the detected relative position relationship. After acquiring the positioning data of the electronic device, the embodiment of the present invention determines whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is greater than a first preset value, thereby determining whether the electronic device is on or near the boundary of the target electronic geo-fence; if on or near the boundary, the relative position relationship between the electronic device and the target electronic geo-fence is determined based on the detected relative position relationship, so as to avoid repeated horizontal jumps in the detection results due to the influence of positioning data collection errors, etc., and improve the stability of relative position detection; if not on or near the boundary, the relative position relationship between the electronic device and the target electronic geo-fence is detected based on the positioning data and the fence area data of the target electronic geo-fence, thereby ensuring the accuracy of relative position relationship detection.
[0048] In a possible implementation, the method may also perform the following steps: judging whether the electronic device is outside the area of the target electronic geo-fence based on the detected relative position relationship; if the electronic device is outside the area of the target electronic geo-fence and the shortest distance is greater than a second preset value, stopping detecting the relative position relationship between the electronic device and the target electronic geo-fence, wherein the second preset value is greater than the first preset value.
[0049] In an embodiment of the present invention, when the electronic device is outside the area of the target electronic geo-fence and the shortest distance is greater than a second preset value, it indicates that the electronic device is too far away from the electronic geo-fence, and the detection of the relative position relationship between the electronic device and the target electronic geo-fence can be stopped, thereby saving the computing power of the electronic device and reducing energy consumption.
[0050] It should be noted that, in this step, the second preset value is greater than the first preset value, and the second preset value can be set according to actual needs, which is not specifically limited in the embodiment of the present invention.
[0051] In a possible implementation, when the area of the target electronic fence is a polygon, the method may further perform the following steps: fitting the target electronic fence with one or more circumscribed circles, and using the boundaries of the one or more circumscribed circles as the boundaries of the target electronic fence when the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is obtained.
[0052] In this possible implementation, when the area of the target electronic fence is a polygon, the target electronic fence is fitted using one or more circumscribed circles. For a regular polygon, such as a square, one circumscribed circle can be used for fitting, and for an irregular polygon, multiple circumscribed circles can be used for fitting. Thereafter, the boundaries of the one or more circumscribed circles are used as the boundaries of the target electronic fence when the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is obtained.
[0053] For example: a circumscribed circle can be generated for every three vertices of a polygon, and two circumscribed circles will be obtained for an edge formed by any two vertices; among the two circumscribed circles, select any one circle, and use the shorter arc of the selected circle corresponding to the edge as the boundary corresponding to the edge (preferably, for example, if the centers of the two circumscribed circles are on the same side of the edge, select the shorter arc corresponding to the circle with the larger radius as the boundary corresponding to the edge; if the centers of the two circumscribed circles are on different sides of the edge, select the shorter arc corresponding to the circle whose center falls inside the polygon as the boundary corresponding to the edge); connect the boundaries corresponding to each edge to obtain the boundary of the target electronic geographic fence.
[0054] It should be noted that the circumscribed circle information used to fit the polygon can be generated in advance as a type of fence area data, thereby reducing the amount of calculation on the electronic device side.
[0055] In a possible implementation, determining whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value can be performed according to the following steps: calculating a first distance value from the position corresponding to the positioning data to the center of each circumscribed circle; calculating a second distance value from the position corresponding to the positioning data to the boundary of the circumscribed circle using the first distance value and radius value corresponding to each circumscribed circle; determining the shortest distance value among the second distance values; and determining whether the shortest distance value is greater than the first preset value.
[0056] In this possible implementation, the first distance value from the position corresponding to the positioning data to the center of each circumscribed circle is calculated. After obtaining the first distance value, the difference between the first distance value and the radius value of each circumscribed circle is calculated, and the absolute value of the difference is taken to obtain the second distance value. The smallest value among the multiple second distance values is taken as the shortest distance value, thereby simplifying the calculation complexity of the shortest distance value. Finally, the shortest distance value is compared with the first preset value to determine whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than the first preset value.
[0057] In one possible implementation, determining whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is greater than a first preset value can be performed according to the following steps: determining multiple groups of target point data on the boundary of the target electronic geo-fence; calculating the target distance value using the positioning data and each group of the target point data; determining the shortest distance value among the multiple target distance values obtained; and determining whether the shortest distance value is greater than the first preset value.
[0058] In this possible implementation, multiple groups of target point data are determined on the boundary of the target electronic geo-fence. For example, if the boundary of the target electronic geo-fence is a circle, a straight line can be determined using the position corresponding to the positioning data and the center of the circle, and the intersection of the straight line and the circle is used as the target point data; if the boundary of the target electronic geo-fence is a polygon or a line, the perpendicular point from the position corresponding to the positioning data to each side can be used as the target point data; if the boundary of the target electronic geo-fence includes a curve, a portion of points on the curve can be selected at intervals as the target point data.
[0059] Afterwards, the target distance value is calculated using the positioning data and each group of target point data; the smallest value among the multiple target distance values obtained is determined as the shortest distance value; finally, it is determined whether the shortest distance value is greater than the first preset value.
[0060] In the above steps, by determining multiple groups of target point data to calculate the shortest distance value, the amount of calculation for determining the shortest distance value can be reduced and the judgment efficiency can be improved.
[0061] In a possible implementation manner, determining whether the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is greater than a first preset value may be performed according to the following steps:
[0062] The position corresponding to the positioning data is used as the target center, and based on the target center, target circular data is generated with the first preset value as the radius; it is determined whether there is an intersection between the target circular data and the boundary of the target electronic geographic fence; if there is an intersection, it is determined that the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is not greater than the first preset value; if there is no intersection, it is determined that the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than the first preset value.
[0063] In this possible implementation, the target circular data may be in the form of a data set. If the data set is used, to determine whether there is an intersection between the target circular data and the boundary of the target electronic geofence, it can be achieved by determining whether there is an intersection between the data set of the target circular data and the data set corresponding to the boundary of the target electronic geofence. If there is an intersection, it means that the electronic device is close to the boundary of the electronic geofence, and it is determined that the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geofence is not greater than a first preset value; if there is no intersection, it means that the electronic device is far from the boundary of the electronic geofence, and it is determined that the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geofence is greater than the first preset value.
[0064] In this step, by generating target circular data and then judging the intersection with the boundary, it is possible to judge whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value. This can avoid the calculation of the shortest distance value and greatly reduce the amount of calculation.
[0065] In one possible implementation, before determining whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value, the following steps may also be performed: performing data verification on the fence area data and the positioning data so that the fence area data satisfies the preset fence range, and the positioning data satisfies the preset position range.
[0066] In this possible implementation, see Figure 5 The schematic diagram of the implementation process of the electronic geographic fence detection method shown can perform data verification processing before boundary distance detection.
[0067] Data verification is performed on the fence area data and the positioning data to determine the validity of the data. For example, the coordinate point information representing the location is the longitude and latitude of the Martian coordinate system. The longitude and latitude have a range, and the radius of the circular fence is also limited. If it exceeds the range, it will be treated as an abnormal result.
[0068] It should be noted that the fence area data and the positioning data need to be verified separately so that the fence area data satisfies the preset fence range, and the positioning data satisfies the preset position range, wherein the preset fence range and the preset position range can be set according to actual needs, and the embodiment of the present invention does not specifically limit this.
[0069] In one possible implementation, the shape of the target electronic geo-fence is a circle, and based on the positioning data and the fence area data of the target electronic geo-fence, the relative position relationship between the electronic device and the target electronic geo-fence is detected, which can be performed according to the following steps: determining the center and radius value of the circle based on the fence area data; calculating the distance value from the electronic device to the center of the circle based on the positioning data; and generating the relative position relationship using the radius value and the distance value.
[0070] In this possible implementation, the determination algorithm for the circular fence mainly calculates the distance from the test coordinate point to the center of the circle. If the distance from the test coordinate point to the center of the circle is greater than the radius of the circle, it means that it is outside the circular fence, otherwise it is inside the circular fence.
[0071] In one possible implementation, the shape of the target electronic geo-fence is a polygon, and based on the positioning data and the fence area data of the target electronic geo-fence, the relative position relationship between the electronic device and the target electronic geo-fence is detected, which can be performed according to the following steps: polygon data is determined based on the fence area data; ray data in the target direction is generated with the position corresponding to the positioning data as the starting point; the target direction is determined based on the polygon data; the number of first intersections between the ray data and the polygon data is calculated; and the relative position relationship is generated based on the first number of intersections.
[0072] In this possible implementation, the polygonal fence judgment algorithm is combined with the step of judging whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value, which can reduce the complexity of the polygonal algorithm and enable the algorithm to run quickly on an embedded device.
[0073] In this step, the target direction is determined according to the polygon data. For example, a direction parallel to an axis in the coordinate system where the polygon is located can be selected as the target direction. The number of first intersections between the ray data and the polygon data is calculated. The number of first intersections can be determined by determining the intersection of the ray data and the polygon data. Then, the relative position relationship is determined according to whether the first number of intersections is an odd number or an even number.
[0074] For example, see Figure 2 The schematic diagram of the polygonal electronic geographic fence detection method shown in the figure starts from the position corresponding to the positioning data (the test point in the figure), generates ray data in the target direction, and if the intersection of the ray and the polygon boundary is an odd number, it means that the test point is inside the polygon, and if the intersection of the ray and the polygon boundary is an even number (including 0), it means that the test point is outside the polygon. Due to the boundary distance detection in the previous step, the common abnormal situations of the traditional polygonal ray method are filtered out, including the situation where the test point is on the boundary, etc., which can make the polygon algorithm of this step very simple.
[0075] In one possible implementation, the shape of the target electronic geo-fence is linear, and based on the positioning data and the fence area data of the target electronic geo-fence, the relative position relationship between the electronic device and the target electronic geo-fence is detected, which can be performed according to the following steps: determining the first line data and reference point data of the line according to the fence area data; generating the second line data between the reference point data and the position corresponding to the positioning data; calculating the second number of intersections between the first line data and the second line data; and generating the relative position relationship according to the second number of intersections.
[0076] In this possible implementation, the fence boundary data in the fence area data is used as the first line data of the line, and the reference point data is used to indicate that one side of the line is within the area of the electronic geographic fence. The second line data between the reference point data and the position corresponding to the positioning data is generated, and the data on the straight line where the reference point data and the position corresponding to the positioning data are located can be used as the second line data. The second number of intersections between the first line data and the second line data is calculated, and the second number of intersections can be determined by calculating the intersection of the first line data and the second line data, and then the relative position relationship is generated according to the second number of intersections.
[0077] See also Figure 3The schematic diagram of the linear electronic geofence detection method shown in the figure shows that in the linear determination algorithm, the linear fence is composed of a continuous straight line or a broken line. It is a line segment with a starting point and an end point, rather than an infinite extension. In addition, a reference point can be used to indicate which side of the bottom line is considered to be inside the fence and which side is considered to be outside the fence. Only the area that passes through the line is considered to have crossed the fence, and passing through the extension area of the line is not considered to have crossed the fence. The specific algorithm is to connect the test point and the reference point into a line segment. If the intersection of the line segment and the fence boundary is an odd number, it is outside the fence; if it is an even number (or 0) of intersections, it is inside the fence. This step is combined with the step of determining whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geofence is greater than the first preset value, which filters out many complex abnormal situations, so the basic algorithm can have a practical effect, and the algorithm can be executed on the device side, so that it can run on a chip with average performance.
[0078] In a possible implementation manner, the following step may also be performed: sending the relative position relationship to a server, so that the server generates alarm information according to the relative position relationship.
[0079] In this possible implementation, in order to facilitate the user to manage the devices entering or leaving the electronic geographic fence, the relative position relationship can be sent to the server, so that the server generates an alarm message based on the relative position relationship and promptly reminds the user through the alarm message.
[0080] The embodiment of the present invention provides an electronic geographic fence detection method and system, and an embedded device. The method supports the most common fences such as circular fences, polygonal fences, and linear fences, and can meet more user needs. By combining boundary distance detection with a specific fence judgment algorithm, the abnormal situations of the judgment algorithm are greatly reduced, thereby simplifying the difficulty of the algorithm, so that low-cost embedded devices can support local electronic fence calculations, and greatly reduce the uplink and downlink data traffic on the device side and the server side.
[0081] In an embodiment of the present invention, an embedded device is provided, comprising: an acquisition module, used to acquire positioning data of an electronic device; a judgment module, used to judge whether the shortest distance value between the position corresponding to the positioning data and the boundary of a target electronic geo-fence is greater than a first preset value; a detection module, used to detect the relative position relationship between the electronic device and the target electronic geo-fence based on the positioning data and the fence area data of the target electronic geo-fence if yes, wherein the relative position relationship is used to indicate whether the electronic device is located within the area of the target electronic geo-fence; and a determination module, used to determine the relative position relationship between the electronic device and the target electronic geo-fence based on the detected relative position relationship if no.
[0082] In an embodiment of the present invention, after the acquisition module acquires the positioning data of the electronic device, the judgment module determines whether the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geo-fence is greater than a first preset value, thereby determining whether the electronic device is on or near the boundary of the target electronic geo-fence. If it is on or near the boundary, the determination module determines the relative position relationship between the electronic device and the target electronic geo-fence based on the detected relative position relationship, so as to avoid repeated horizontal jumps in the detection results due to the influence of positioning data collection errors, etc., and improve the stability of relative position detection. If it is not on or near the boundary, the detection module detects the relative position relationship between the electronic device and the target electronic geo-fence based on the positioning data and the fence area data of the target electronic geo-fence, thereby ensuring the accuracy of relative position relationship detection.
[0083] In a possible implementation, a second detection module is further included, which is used to determine whether the electronic device is outside the area of the target electronic geo-fence based on the detected relative position relationship; if the electronic device is outside the area of the target electronic geo-fence and the shortest distance is greater than a second preset value, stop detecting the relative position relationship between the electronic device and the target electronic geo-fence, wherein the second preset value is greater than the first preset value.
[0084] In a possible embodiment, it also includes a fitting module, which is used to fit the target electronic fence with one or more circumscribed circles when the area of the target electronic fence is a polygon, and use the boundaries of the one or more circumscribed circles as the boundaries of the target electronic fence when the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is obtained.
[0085] In a possible implementation, the judgment module is specifically used to: calculate a first distance value from the position corresponding to the positioning data to the center of each of the circumscribed circles; calculate a second distance value from the position corresponding to the positioning data to the boundary of the circumscribed circle using the first distance value and radius value corresponding to each of the circumscribed circles; determine the shortest distance value among the second distance values; and determine whether the shortest distance value is greater than the first preset value.
[0086] In one possible implementation, the judgment module is specifically used to: determine multiple groups of target point data on the boundary of the target electronic geographic fence; calculate the target distance value using the positioning data and each group of the target point data; determine the shortest distance value among the multiple target distance values obtained; and judge whether the shortest distance value is greater than the first preset value.
[0087] In one possible implementation, the judgment module is specifically used to: take the position corresponding to the positioning data as the target center, and based on the target center, generate target circular data with the first preset value as the radius; determine whether there is an intersection between the target circular data and the boundary of the target electronic geographic fence; if there is an intersection, determine that the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is not greater than the first preset value; if there is no intersection, determine that the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than the first preset value.
[0088] In a possible implementation, a verification module is further included, which is used to: perform data verification on the fence area data and the positioning data, so that the fence area data satisfies a preset fence range, and the positioning data satisfies a preset position range.
[0089] In one possible implementation, the shape of the target electronic geographic fence is a circle, and the detection module is specifically used to: determine the center and radius value of the circle based on the fence area data; calculate the distance value from the electronic device to the center of the circle based on the positioning data; and generate the relative position relationship using the radius value and the distance value.
[0090] In a possible implementation, the shape of the target electronic geographic fence is a polygon, and the detection module is specifically used to: determine the polygon data based on the fence area data; generate ray data in the target direction with the position corresponding to the positioning data as the starting point; the target direction is determined based on the polygon data; calculate the first number of intersections between the ray data and the polygon data; and generate the relative position relationship based on the first number of intersections.
[0091] In a possible implementation, the shape of the target electronic geographic fence is linear, and the detection module is specifically used to: determine the first line data and reference point data of the line according to the fence area data; generate the second line data between the reference point data and the position corresponding to the positioning data; calculate the second number of intersections between the first line data and the second line data; and generate the relative position relationship according to the second number of intersections.
[0092] In a possible implementation manner, the system further includes a sending module, configured to send the relative position relationship to a server, so that the server generates alarm information according to the relative position relationship.
[0093] An embodiment of the present invention provides an electronic geographic fence detection system, including: a server and the above-mentioned embedded device.
[0094] An embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory in communication with the at least one processor. The memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the electronic device executes the method of the embodiment of the present invention.
[0095] An embodiment of the present invention further provides a non-transitory machine-readable medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute the method of the embodiment of the present invention.
[0096] An embodiment of the present invention further provides a computer program product, including a computer program, wherein the computer program, when executed by a processor of a computer, is used to enable the computer to execute the method of the embodiment of the present invention.
[0097] refer to Figure 4 , a block diagram of an electronic device that can be used as a server or client of an embodiment of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. Electronic devices are intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, embedded devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0098] like Figure 4 As shown, the electronic device includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In RAM 403, various programs and data required for the operation of the electronic device can also be stored. The computing unit 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0099] Multiple components in the electronic device are connected to the I / O interface 405, including: an input unit 406, an output unit 407, a storage unit 408, and a communication unit 409. The input unit 406 can be any type of device that can input information to the electronic device, and the input unit 406 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device. The output unit 407 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 408 can include but is not limited to a disk, an optical disk. The communication unit 409 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0100] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a CPU, a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above. For example, in some embodiments, the method embodiments of the present invention may be implemented as a computer program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on an electronic device via ROM 402 and / or communication unit 409. In some embodiments, the computing unit 401 may be configured to perform the above-described method in any other appropriate manner (e.g., by means of firmware).
[0101] The computer programs for implementing the methods of the embodiments of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0102] In the context of an embodiment of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable signal medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0103] It should be noted that the term "including" and its variations used in the embodiments of the present invention are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The modifications of "one" and "multiple" mentioned in the embodiments of the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more".
[0104] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0105] The various steps described in the method implementation methods provided in the embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method implementation methods may include additional steps and / or omit the steps shown. The scope of protection of the present invention is not limited in this respect.
[0106] The term "embodiment" in this specification refers to specific features, structures or characteristics described in conjunction with the embodiment that can be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. The various embodiments in this specification are described in a related manner, and the same or similar parts between the various embodiments refer to each other. In particular, for the device, equipment, and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment.
[0107] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the attached claims.
Claims
1. An electronic geographic fence detection method, comprising: Obtaining location data of electronic devices; Determining whether the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value; If yes, detecting the relative position relationship between the electronic device and the target electronic geo-fence according to the positioning data and the fence area data of the target electronic geo-fence, wherein the relative position relationship is used to indicate whether the electronic device is located within the area of the target electronic geo-fence; If not, the relative position relationship between the electronic device and the target electronic geographic fence is determined based on the detected relative position relationship.
2. The method according to claim 1, wherein: The method further comprises: Determining whether the electronic device is outside the area of the target electronic geographic fence according to the detected relative position relationship; If the electronic device is outside the area of the target electronic geo-fence and the shortest distance is greater than a second preset value, stop detecting the relative position relationship between the electronic device and the target electronic geo-fence, wherein the second preset value is greater than the first preset value.
3. The method according to claim 1, wherein: In the case where the area of the target electronic fence is a polygon, the method further includes: The target electronic fence is fitted with one or more circumscribed circles, and the boundaries of the one or more circumscribed circles are used as the boundaries of the target electronic fence when the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is obtained.
4. The method according to claim 3, wherein: Determining whether the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value includes: Calculate a first distance value from the position corresponding to the positioning data to the center of each circumscribed circle; Calculating a second distance value from the position corresponding to the positioning data to the boundary of the circumscribed circle using the first distance value and the radius value corresponding to each circumscribed circle; determining a shortest distance value among the second distance values; Determine whether the shortest distance value is greater than the first preset value.
5. The method according to claim 1, wherein: Determining whether the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value includes: Determining multiple sets of target point data on the boundary of the target electronic geographic fence; Calculating a target distance value using the positioning data and each group of target point data; Determine the shortest distance value among the obtained multiple target distance values; Determine whether the shortest distance value is greater than the first preset value.
6. The method according to claim 1, wherein: Determining whether the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value includes: Taking the position corresponding to the positioning data as the target circle center, and generating target circular data based on the target circle center and taking the first preset value as the radius; Determine whether there is an intersection between the target circular data and the boundary of the target electronic geographic fence; If there is an intersection, determining that the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is not greater than a first preset value; If there is no intersection, it is determined that the shortest distance value between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value.
7. The method according to claim 1, wherein: Before determining whether the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value, the method further includes: The fence area data and the positioning data are verified to ensure that the fence area data meets a preset fence range, and the positioning data meets a preset position range.
8. The method according to claim 7, wherein: The shape of the target electronic geo-fence is circular, and the relative position relationship between the electronic device and the target electronic geo-fence is detected according to the positioning data and the fence area data of the target electronic geo-fence, including: Determine the center and radius of the circle according to the fence area data; Calculating the distance from the electronic device to the center of the circle according to the positioning data; The relative position relationship is generated using the radius value and the distance value.
9. The method according to claim 7, wherein: The shape of the target electronic geo-fence is a polygon, and the relative position relationship between the electronic device and the target electronic geo-fence is detected according to the positioning data and the fence area data of the target electronic geo-fence, including: Determine polygon data according to the fence area data; Taking the position corresponding to the positioning data as a starting point, generating ray data in a target direction; the target direction is determined according to the polygon data; Calculating the number of first intersection points between the ray data and the polygon data; The relative position relationship is generated according to the first number of intersections.
10. The method according to claim 7, wherein: The shape of the target electronic geo-fence is linear, and the relative position relationship between the electronic device and the target electronic geo-fence is detected according to the positioning data and the fence area data of the target electronic geo-fence, including: Determine first line data and reference point data of the linear shape according to the fence area data; generating second line data between the reference point data and the position corresponding to the positioning data; Calculating the number of second intersections between the first line data and the second line data; The relative position relationship is generated according to the second number of intersections.
11. The method according to any one of claims 1 to 10, wherein: Also includes: The relative position relationship is sent to a server, so that the server generates alarm information according to the relative position relationship.
12. An embedded device comprising: An acquisition module, used to acquire positioning data of an electronic device; A determination module, used to determine whether the shortest distance between the position corresponding to the positioning data and the boundary of the target electronic geographic fence is greater than a first preset value; a detection module, for, if yes, detecting a relative position relationship between the electronic device and the target electronic geo-fence according to the positioning data and the fence area data of the target electronic geo-fence, wherein the relative position relationship is used to indicate whether the electronic device is located within the area of the target electronic geo-fence; A determination module is used to determine the relative position relationship between the electronic device and the target electronic geographic fence based on the detected relative position relationship if no.
13. An electronic geographic fence detection system, comprising: A server and the embedded device as claimed in claim 12.
14. An electronic device comprising: A processor, and a memory storing a program, wherein the program comprises instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 11.
15. A non-transitory machine-readable medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-11.
16. A computer program product, wherein: The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Cited By
Novel ESL positioning electronic price tag
CN119889150A
Custom electronic fence-based positioning method and device, and storage medium
CN120416769A