Positioning method, apparatus and electronic device

By calculating the ratio of the intersection area between the circular area of ​​the electronic device and the geofence, and using a threshold to determine whether the geofence is inside or outside, the problem of unstable position status in geofence detection is solved, and more stable geofence detection is achieved.

CN116320986BActive Publication Date: 2026-03-03VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310352308.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2026-03-03
Estimated Expiration
2043-03-31

AI Technical Summary

Technical Problem

In existing technologies, the user's position relative to the geofence is unstable during geofence detection, leading to frequent false positives and false negatives, which affects the user experience.

Method used

By obtaining the current location of the electronic device, a circular area is determined, and the proportion of the area of ​​the intersection of this area and the target geofence to the area of ​​the circular area is calculated. A threshold is used to determine whether the electronic device is inside or outside the target geofence, reducing the amount of calculation required to calculate the intersection area and improving the stability of the location status.

Benefits of technology

It improves the stability of geofence detection, reduces false positives and false negatives, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320986B_ABST
    Figure CN116320986B_ABST
Patent Text Reader

Abstract

The application discloses a positioning method, device and electronic equipment, and belongs to the technical field of communication. The method comprises the following steps: acquiring a first position point and a target geofence, wherein the first position point is a current position of an electronic device; determining a circular region corresponding to the electronic device according to the first position point, wherein the circular region comprises a second position point; determining a first proportion of an intersection area of the circular region and the target geofence to an area of the circular region according to a third position point in the target geofence, wherein the third position point is a corresponding position point in an intersection region of the circular region and the target geofence; determining that the electronic device is in the target geofence when the first proportion is greater than a first threshold value; and determining that the electronic device is outside the target geofence when the first proportion is less than a second threshold value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of communication technology, specifically relating to a positioning method, device, and electronic device. Background Technology

[0002] Geofence detection is an important function in electronic devices. It serves as a bridge to transform geographic location information into user space and context, playing a crucial supporting role in user context awareness, user profiling, and important information alerts.

[0003] In related technologies, the common approach is to detect the user's location point and determine whether that point is inside or outside a geofence, thereby determining the user's entry or exit relative to the geofence. In this technology, geofence detection treats the user's location as a single point. Thus, when the user's location is consistently inside the geofence, the location point itself can drift, moving back and forth within the geofence. This results in the user entering and leaving the geofence intermittently, leading to low stability in detecting the user's position relative to the geofence. Summary of the Invention

[0004] The purpose of this application is to provide a positioning method, apparatus, and electronic device that can solve the problem of low stability in detecting the positional status of a user's location relative to a geofence.

[0005] In a first aspect, embodiments of this application provide a positioning method, which includes: acquiring a first location point and a target geofence, wherein the first location point is the current location of an electronic device; determining a circular area corresponding to the electronic device based on the first location point, wherein the circular area includes a second location point; determining a first ratio of the area of ​​the intersection of the circular area and the target geofence to the area of ​​the circular area based on a third location point within the target geofence, wherein the third location point is a location point corresponding to the area of ​​the intersection of the circular area and the target geofence; determining that the electronic device is within the target geofence if the first ratio is greater than a first threshold; and determining that the electronic device is outside the target geofence if the first ratio is less than a second threshold.

[0006] Secondly, embodiments of this application provide a positioning device, which includes: an acquisition module and a processing module; the acquisition module is used to acquire a first location point and a target geofence, the first location point being the current location of an electronic device; the processing module is used to determine a circular area corresponding to the electronic device based on the first location point, the circular area including a second location point; the processing module is further used to determine a first ratio of the intersection area of ​​the circular area and the target geofence to the area of ​​the circular area based on a third location point within the target geofence, the third location point being a location point corresponding to the intersection area of ​​the circular area and the target geofence; the processing module is further used to determine that the electronic device is within the target geofence if the first ratio is greater than a first threshold; and to determine that the electronic device is outside the target geofence if the first ratio is less than a second threshold.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0010] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0011] In this embodiment, a first location point and a target geofence are obtained, where the first location point is the current location of the electronic device. Based on the first location point, a circular region corresponding to the electronic device is determined, including a second location point. Based on a third location point within the target geofence, a first ratio is determined between the intersection area of ​​the circular region and the target geofence and the area of ​​the circular region. The third location point is a location point corresponding to the intersection area of ​​the circular region and the target geofence. If the first ratio is greater than a first threshold, the electronic device is determined to be within the target geofence; if the first ratio is less than a second threshold, the electronic device is determined to be outside the target geofence. Thus, by counting the number of location points within the circular region of the geofence, the coverage area of ​​these location points can be calculated, thereby obtaining the intersection area of ​​the circular region and the geofence, reducing the computational workload of calculating the intersection area. Furthermore, based on the first ratio of the intersection area to the area of ​​the circular region, the first ratio is used to determine whether the circular region corresponding to the electronic device is inside the geofence, thereby improving the stability of detecting the user's position relative to the geofence. Attached Figure Description

[0012] Figure 1 This is a schematic diagram of the conventional Monte Carlo method provided in the embodiments of this application;

[0013] Figure 2 This is one of the flowcharts illustrating a positioning method provided in an embodiment of this application;

[0014] Figure 3 This is a schematic diagram of an embodiment of a positioning method provided in this application;

[0015] Figure 4 This is a second schematic flowchart of a positioning method provided in an embodiment of this application;

[0016] Figure 5 This is a third flowchart illustrating a positioning method provided in an embodiment of this application;

[0017] Figure 6 This is a schematic diagram of the structure of a positioning device provided in an embodiment of this application;

[0018] Figure 7 This is one of the hardware structure diagrams of an electronic device provided in the embodiments of this application;

[0019] Figure 8 This is a second schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0020] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0021] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0022] The following is a definition of the relevant terms used in this embodiment:

[0023] 1) Circular Error Probable (CEP): This is a measure of accuracy. It refers to the probability that the distance between the measured position and the actual position will be less than a certain standard deviation when the measurement is performed multiple times at the same location. For example, CEP-50 is 100 meters, meaning there is a 50% probability that the positioning error will be within 100 meters. Commonly used CEP values ​​include CEP-50 (50% circular error), CEP-68 (68% circular error, corresponding to one standard deviation of a Gaussian distribution), and CEP-95 (95% circular error, corresponding to two standard deviations of a Gaussian distribution).

[0024] 2) Global Positioning System (GPS): This is a type of satellite positioning system. Currently, most electronic devices integrate GPS chip modules, which can receive and interpret signals broadcast by GPS satellites to determine their location.

[0025] 3) The Monte Carlo method, also known as the statistical simulation method or statistical experiment method, is a numerical simulation algorithm that takes probabilistic phenomena as its research object. The basic idea of ​​the Monte Carlo method is: to solve a problem, first establish a probabilistic model or stochastic process whose parameters or numerical characteristics are equal to the solution to the problem; then calculate these parameters or numerical characteristics through observation or sampling experiments on the model or process; finally, provide an approximate value of the solution. The accuracy of the solution is expressed by the standard error of the estimate. The main theoretical basis of the Monte Carlo method is probability and statistics theory, and its main methods are random sampling and statistical experiments. The basic steps of using the Monte Carlo method are:

[0026] (1) Based on the characteristics of the actual problem, construct a simple and easy-to-implement probability and statistics model so that the solution is exactly the probability distribution or mathematical expectation of the problem.

[0027] (2) Give the sampling methods for random variables with different distributions in the model;

[0028] (3) Statistically process the simulation results and give the statistical estimate and accuracy estimate of the solution to the problem.

[0029] One typical example is calculating the area covered by irregular geometric shapes. For example... Figure 1 As shown, the curve f(x) divides the rectangle into two parts. It is impossible to calculate the area covered by these two parts using traditional geometric methods and mathematical formulas.

[0030] The Monte Carlo method involves generating random points within a rectangular area, where each point falls anywhere within the rectangle. The geometric relationship between each point and the curve f(x) is then calculated. Points above the curve are labeled as one category, and those below as another. By calculating the proportion of each category, the area covered by the irregular geometric shape divided by curve f(x) can be roughly estimated. Naturally, the more random points generated, the closer the solution will be to the actual result.

[0031] The positioning method, apparatus, and electronic device provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0032] Geofence detection is an important function in electronic devices. It serves as a bridge to transform geographic location information into user space and context, playing a crucial supporting role in user context awareness, user profiling, and important information alerts.

[0033] Currently, most geofences are designed as circular fences, meaning the boundary of a geofence is a circle, consisting of the center coordinates plus a radius. The advantage of circular fences is their simplicity, especially for fence detection algorithms, which only need to determine if the distance between the current location and the fence's center is less than the fence's radius to decide whether to enter the fence. However, circular fences also have inherent drawbacks. Their main drawback is that they cannot coincide with actual geographic boundaries, leading to frequent false positives and false negatives in real-world applications, thus affecting the accuracy of geofence detection.

[0034] In real-world applications, geographic boundaries are often formed by discrete points and their corresponding lines, creating a closed, irregular polygon. To improve the accuracy of geofence detection and better support related upper-layer services, the detection of polygonal geofences has become crucial.

[0035] To improve the accuracy of geofence detection, normal vector-based detection methods can be used to quickly detect whether a location is inside or outside the geofence, reducing computational load and latency. This makes low-computation, fast geofence detection possible. However, this method treats the location as a single point, determining entry or exit based on whether the location is inside or outside the geofence. This introduces a problem: when a user is stably inside the geofence, the user's location point may drift, causing it to move back and forth within the geofence. This results in the user being constantly inside and outside the geofence, making their geofence presence highly unstable. This phenomenon severely impacts user experience and necessitates technical solutions to mitigate it.

[0036] Typically, in related technologies, the intersection method is used to determine entry and exit from traditional circular fences, thereby improving the stability of fence status detection. Specifically, the user's location is no longer considered a single point, but rather a circle with a certain radius. Generally, a CEP circle is obtained by measuring using the Circle-Edge Intersection (CEP). For example, using the CEP-95 index, if the CEP-95 value is m meters, it means there is a 95% probability that the positioning error is less than m meters, and the radius of the CEP circle for this positioning is m. Thus, the relationship between the location and the circular fence changes from a point-to-circle relationship to a circle-to-circle relationship. Therefore, determining whether a user enters or exits the geofence changes from judging whether the point is inside or outside the circle to considering the geometric relationship between two circles and the area of ​​their intersection.

[0037] Specifically, the process of calculating the intersection area and ratio is as follows: Circle O1 represents the positioning CEP circle with radius r; circle O2 represents the circular fence with radius R. The distance between the centers of the two circles is d. Then, the intersection area S of the two circles is calculated.I The formula is as follows:

[0038] r1 = min{r, R}

[0039] r2 = max{r, R}

[0040]

[0041]

[0042]

[0043] Then calculate the ratio σ of the intersection area to the area of the CEP circle:

[0044]

[0045] If the ratio is greater than the threshold M, it is determined to enter the fence; if the ratio is less than m (m < M), it is determined to leave the fence; if the ratio is between m and M, no determination is made.

[0046] In this way, it is equivalent to setting up a buffer zone around the boundary of the circular fence, and the width of this buffer zone is determined by the accuracy of the positioning position. The higher the positioning position accuracy, the smaller the radius of the CEP circle, and the smaller the width of the buffer zone; similarly, the worse the positioning position accuracy, the larger the radius of the CEP circle, and the larger the width of the buffer zone. This will greatly reduce the frequent switching of the state of the user entering or leaving the geographical fence caused by the drift of the user's positioning position, and improve the stability of the fence state detection.

[0047] However, for the method of improving the detection stability for circular fences, although it can be borrowed for the state detection of polygon geographical fences, since polygon geographical fences are not regular geometric figures, it is impossible to use a general mathematical calculation formula to calculate the intersection area between the CEP circle and it, and the geometric relationship is also impossible to simply determine. In addition, if the geometric relationship between the CEP circle and the polygon geographical fence is determined by an approximate simulation method and the intersection area is calculated, it will consume a large amount of calculations, reduce the real-time performance of the user's state detection in the polygon geographical fence, and increase the difficulty of state detection.

[0048] In summary, the positioning method provided in this application involves obtaining a first location point and a target geofence, where the first location point is the current location of the electronic device. Based on the first location point, a circular area corresponding to the electronic device is determined, including a second location point. Based on a third location point within the target geofence, a first ratio is determined between the intersection area of ​​the circular area and the target geofence and the area of ​​the circular area, where the third location point is a location point corresponding to the intersection area. If the first ratio is greater than a first threshold, the electronic device is determined to be within the target geofence; if the first ratio is less than a second threshold, the electronic device is determined to be outside the target geofence. Thus, by counting the number of location points within the circular area of ​​the geofence, the coverage area of ​​these location points can be calculated, thereby obtaining the intersection area between the circular area and the geofence, thus reducing the computational load of calculating the intersection area. Furthermore, based on the first ratio of the intersection area to the area of ​​the circular area, the method ultimately determines whether the circular area corresponding to the electronic device is within the geofence, thereby improving the stability of detecting the user's position relative to the geofence.

[0049] The positioning method provided in this embodiment can be executed by a positioning device, which can be an electronic device, or a control module or processing module within the electronic device. The following description uses an electronic device as an example to illustrate the technical solution provided in this application embodiment.

[0050] This application provides a positioning method. Figure 2 A flowchart illustrating a positioning method provided in an embodiment of this application is shown, which can be applied to electronic devices. Figure 2 As shown, the positioning method provided in this application embodiment may include the following steps 201 to 204.

[0051] Step 201: Obtain the first location point and the target geofence.

[0052] In this embodiment of the application, the first location point mentioned above is the current location of the electronic device.

[0053] In this embodiment of the application, the first location point can be obtained through GPS in an electronic device or through positioning by a network device.

[0054] In this embodiment of the application, the target geofence can be obtained through GPS or through network device positioning.

[0055] In this embodiment of the application, the target geofence is used to characterize the location, size, and shape of a certain area.

[0056] Step 202: Determine the circular area corresponding to the electronic device based on the first location point.

[0057] In this embodiment of the application, the aforementioned circular region includes a second location point.

[0058] In this embodiment of the application, the second location point must meet the following conditions: the coverage area of ​​each location point is the same, the coverage areas of two adjacent location points do not intersect, and the coverage area of ​​the second location point occupies the entire circular area.

[0059] In this embodiment, the circular region may be a CEP circle.

[0060] In this embodiment of the application, the aforementioned CEP circle is constructed with the current location of the electronic device, i.e., the first location point, as the center and the precision information in the location information of the current location of the electronic device as the radius.

[0061] Furthermore, in the location reports obtained by satellite positioning systems like GPS, the Accuracy (Acc) field represents the circular error probable (CEP) of the location. This means satellite positioning can estimate its accuracy relatively precisely. While network positioning also reports the Acc field, its value is typically trained using data simulation based on highly correlated indicators such as wireless signal density and strength, resulting in lower reliability. In short, regardless of whether the location originates from satellite or network positioning, the accuracy information, i.e., the radius of the CEP circle, can be obtained from the location report.

[0062] For example, the circular probability error can be CEP-50 (50% circular probability error), CEP-68 (68% circular probability error), and CEP-95 (95% circular probability error).

[0063] In one example, under certain conditions, the CEP circle radii corresponding to these different circular probability errors can be converted to each other.

[0064] Specifically, assume that the positioning deviation follows a Gaussian distribution with zero mean and equal variance in both the longitude and latitude orthogonal directions, and that the probability distributions in these two orthogonal directions are independent. The first formula relating the CEP circle radius to the corresponding probability can be derived theoretically:

[0065]

[0066] Where P is the corresponding probability, and σ is the standard deviation of the Gaussian distribution. Based on the first formula above, the conversion relationship of the CEP circle radius under different probabilities can be derived, as shown in the second and third formulas below:

[0067] Second formula: RCEP-95 ≈2.0789R CEP-50

[0068] Third formula: R CEP-68 ≈1.2821R CEP-50

[0069] In this embodiment, the CEP circle used to uniformly set the positioning position adopts a 95% circular error probability, i.e., CEP-95. If the accuracy of the positioning position is not 95% circular error probability, it can be obtained through the above formula.

[0070] For example, the electronic device uses a first location point as the center of a circle and determines the radius of the circular region based on the location information of the first location point, thereby determining the circular region corresponding to the electronic device.

[0071] Step 203: Based on the third location point within the target geofence, determine the first proportion of the area of ​​the circular area intersecting with the target geofence to the area of ​​the circular area.

[0072] In this embodiment of the application, the third position point is at least one of the second position points evenly distributed in the circular region.

[0073] In this embodiment of the application, the third location point is the location point corresponding to the area where the circular area intersects with the target geofence.

[0074] In this embodiment of the application, the total coverage area of ​​the aforementioned third location point is the intersection area of ​​the circular area and the target geofence.

[0075] For example, the electronic device can count the number of third location points, and then calculate the total coverage area of ​​the third location points based on the coverage area of ​​each location point, that is, calculate the intersection area of ​​the circular area and the target geofence.

[0076] In this embodiment of the application, the first proportion of the intersecting area to the total area of ​​the circular region is calculated based on the total area of ​​the circular region.

[0077] In this embodiment of the application, the first ratio is used to characterize the proportion of the area where the circular region intersects with the target geofence to the area of ​​the circular region.

[0078] In the embodiments of this application, the first ratio can be expressed as a percentage or as a decimal, and this application does not limit it.

[0079] Step 204: If the first proportion is greater than the first threshold, determine that the electronic device is inside the target geofence; if the first proportion is less than the second threshold, determine that the electronic device is outside the target geofence.

[0080] For example, the first threshold mentioned above is either set by the system or defined by the user.

[0081] For example, assuming the first threshold is 0.8, when the first ratio is greater than 0.8, that is, when the first ratio is greater than the first threshold, for example, 0.9, it is determined that the electronic device is currently within the target geofence.

[0082] It should be noted that the first threshold is usually greater than 0.5. The larger the value, the stricter the conditions for determining entry into the geofence, the lower the possibility of the geofence status fluctuating, and the better the stability of the geofence status detection. However, at the same time, a larger value also means that the user has to go deeper into the geofence before the entry judgment is triggered, which reduces the timeliness of the geofence trigger. Therefore, the first threshold needs to be given a reasonable value based on a comprehensive consideration of the stability and timeliness of geofence detection, usually set between 0.75 and 0.95.

[0083] For example, the second threshold mentioned above is either system-set or user-defined.

[0084] It should be noted that, similar to the first threshold, the second threshold is usually less than 0.5. The smaller the value, the stricter the conditions for determining whether to leave the geofence, the lower the possibility of the geofence status fluctuating, and the better the stability. However, it also means that a greater distance is required to trigger the departure judgment, and the timeliness of the departure judgment will be reduced. The second threshold is usually set between 0.05 and 0.2.

[0085] For example, assuming the second threshold is 0.3, when the first ratio is less than 0.3, that is, when the first ratio is less than the second threshold, for example, 0.2, it is determined that the electronic device is currently outside the target geofence.

[0086] It should be noted that the first threshold is greater than the second threshold.

[0087] In one possible example, the aforementioned first proportion is less than a first threshold and greater than a second threshold.

[0088] For example, if the first ratio is less than the first threshold and greater than the second threshold, it is no longer determined whether the location of the electronic device is inside or outside the target geofence, and the determination of the current location of the electronic device is directly maintained.

[0089] For example, assuming the first threshold is 0.8 and the second threshold is 0.3, when the first ratio is less than 0.8 but greater than 0.3, for example, 0.6, no judgment is made, and the current location is maintained. If the current location is determined to be within the target geofence, then the electronic device is confirmed to be within the target geofence.

[0090] In the positioning method provided in this application embodiment, a first location point and a target geofence are obtained, where the first location point is the current location of the electronic device. Based on the first location point, a circular area corresponding to the electronic device is determined, including a second location point. Based on a third location point within the target geofence, a first ratio is determined between the intersection area of ​​the circular area and the target geofence and the area of ​​the circular area, where the third location point is a location point corresponding to the intersection area. If the first ratio is greater than a first threshold, the electronic device is determined to be within the target geofence; if the first ratio is less than a second threshold, the electronic device is determined to be outside the target geofence. Thus, by counting the number of location points within the circular area of ​​the geofence, the coverage area of ​​these location points can be calculated, thereby obtaining the intersection area of ​​the circular area and the geofence, thus reducing the computational workload of calculating the intersection area. Furthermore, based on the first ratio of the intersection area to the area of ​​the circular area, the first ratio is used to determine whether the circular area corresponding to the electronic device is inside the geofence, thereby improving the stability of detecting the user's position relative to the geofence.

[0091] Optionally, in this embodiment of the application, after step 202 "determining the circular area corresponding to the electronic device based on the first location point", the positioning method provided in this embodiment of the application further includes steps 301 to 302:

[0092] Step 301: Determine the target distribution density based on the preset coverage area of ​​the second location point and the area of ​​the circular region.

[0093] For example, the preset coverage area can be customized by the system or set by the user.

[0094] For example, the target distribution density is used to characterize the density of the second location points arranged within the circular region.

[0095] For example, the preset coverage area mentioned above refers to the preset coverage area of ​​each second location point.

[0096] For example, the target distribution density can be customized by the system or set by the user.

[0097] Step 302: Arrange the second position points evenly within the circular area based on the target distribution density.

[0098] For example, the electronic device arranges the second location points evenly in a circular area according to a predetermined order based on the target distribution density and the preset coverage area of ​​each location point.

[0099] For example, the predetermined order can be an inside-out order, an outside-in order, or an order based on the column containing the radius of the circular region.

[0100] In this way, position points can be evenly arranged within a circular area according to the preset coverage area and distribution density. Since it is done according to rules and is uniform, the amount of calculation required to calculate the area covered by the position points can be reduced.

[0101] Optionally, in this embodiment of the application, step 302 above includes steps 302a and 302b:

[0102] Step 302a: Based on the target distribution density and the radius of the circular region, determine the orientation angle and distance of the second position point arranged within the circular region.

[0103] For example, the orientation angle of the second position point is used to characterize the angle of rotation of the second position point relative to the line connecting the center of the circle.

[0104] For example, the distance of the second location point is used to characterize the distance between the second location point and the center of the circular region.

[0105] For example, the electronic device can determine the polar coordinates of the second position point based on the target distribution density and the radius of the circular region. These coordinates can be expressed as rcosθ, where the parameter r is the distance from the second position point to the center of the circle, and the parameter θ is the orientation angle of the position point.

[0106] Step 302b: Arrange the second position points layer by layer in the circular area according to the direction angle and distance of the second position points.

[0107] For example, the electronic device calculates the coordinates of the second position point using the following first set of formulas based on the direction angle and distance of the second position point, and arranges the second position points layer by layer in the circular area according to the coordinates of the second position point.

[0108] For example, suppose the center of the circular region is O(x) o y o Given a radius of R, the second position point (x, y) can be represented by the following first set of formulas:

[0109] First formula group:

[0110] Where, x o and y o The circle represents the center of the circular region, with radius R. The parameter r is the distance from the second position point (x, y) to the center of the circle, and the parameter θ is the direction angle of the position point, representing the angle of rotation of the line connecting point (x, y) and the center of the circle. The value range of parameter r is [0, R], and the value range of parameter θ is [0, 2π].

[0111] For example, suppose the location points to be generated are within the CEP circle, meaning the distribution density within the circular area is 1 point / square meter, equivalent to one location point covering an area of ​​1 square meter. Then, we can define the sequence of distances to the radius in polar coordinates as {Rn} = {R1, R2, ..., R...}. N The sequence is an arithmetic sequence with a common difference of -1, and the first term R1 = [R], the last term R2 = [R]. N =1, representing the radius of the distance between the position point inside the CEP circle generated by the pseudo Monte Carlo method and the center of the CEP circle.

[0112] In other words, generating location points is a progressive search process from the boundary of the CEP circle to its center, essentially forming concentric circles. The distance between adjacent circles differs by 1 meter, and these circles are searched sequentially from the outside in. Location points within the same circle lie on concentric circles with the CEP circle's center as the center and Rn as the radius. To ensure these points are 1 meter apart, meaning the arc length intercepted by two adjacent location points on the concentric circles is 1 meter, the corresponding included angle is... Unit radians. That is, an arithmetic sequence of direction angles in polar coordinates. The tolerance is This tolerance is linearly related to the radius of the concentric circles at the location point.

[0113] Specifically, the location points of each concentric circle are constructed using the second set of formulas;

[0114] Second formula group:

[0115] in, m is used to represent the number of concentric circles.

[0116] like Figure 3 As shown, the location points within the CEP circle are generated layer by layer from the outside in. Following this method, the distance between each location point and its adjacent location points can be guaranteed to be 1 meter, equivalent to each location point covering an area of ​​1 square meter. Therefore, calculating the intersection area of ​​the CEP circle and the geofence is equivalent to counting the number of location points generated within the CEP circle that are located inside the geofence. These location point statistics satisfy the uniform distribution characteristic within the CEP circle.

[0117] Therefore, given that the Monte Carlo method requires generating a large number of random location points to calculate the coverage area of ​​irregular shapes, resulting in a huge computational burden, it is necessary to optimize the traditional Monte Carlo method. In other words, this application optimizes the traditional Monte Carlo method, using the optimized Monte Carlo method (i.e., steps 201a to 201b2 above) to arrange location points within the CEP circle, transforming it into the method for generating location points provided in the embodiments of this application. It should be noted that the optimized Monte Carlo method of this application can be called a pseudo-Monte Carlo method.

[0118] Specifically, the difference between the pseudo-Monte Carlo method and the traditional Monte Carlo method lies in the fact that the pseudo-Monte Carlo method no longer generates location data randomly, but rather according to certain rules, maintaining statistical characteristics consistent with a random distribution. The advantage of this is that it minimizes the number of generated location points while ensuring computational accuracy, thus reducing the algorithm's computational complexity.

[0119] Thus, the location points generated by the pseudo-Monte Carlo method are uniform and regular, and are more difficult to calculate the area than those generated by the traditional Monte Carlo method.

[0120] Optionally, in this embodiment of the application, after step 202 "determining the circular area corresponding to the electronic device based on the first location point", the positioning method provided in this embodiment of the application further includes steps 401 to 402:

[0121] Step 401: Obtain the location information of the target geofence and the circular area.

[0122] Optionally, in this embodiment of the application, the location of the electronic device and the coordinates of the target geofence boundary need to be obtained before step 201 above.

[0123] For example, if the coordinate systems used for the location of the electronic device and the boundary vertex of the geofence are non-geocentric coordinate systems such as GCJ02 or BD09, the location points need to be transformed to the WGS84 coordinate system. This is because only the WGS84 coordinate system is a linear coordinate system, which allows for the geometric relationship between the location and the geofence to be solved using geometric and Monte Carlo methods.

[0124] It should be noted that the conversion from GCJ02 or BD09 coordinate system to WGS84 coordinate system is a publicly available technology and can be performed directly.

[0125] This provides data for calculating the intersection area using the pseudo-Monte Carlo method and for determining the geometric relationship between the CEP circle and the geofence.

[0126] Step 402: Based on the location information of the circular area and the location information of the target geofence, determine the positional geometric relationship between the circular area and the target geofence.

[0127] For example, the above-mentioned location geometry relationship includes any of the following: the circular area intersects with the target geofence, the circular area is separate from the target geofence, the circular area contains the target geofence, and the target geofence contains the circular area.

[0128] It should be noted that a geofence itself can be an irregular geometric shape, and the geometric relationship between an irregular shape and a circle cannot be determined by simple geometric methods. Therefore, in this embodiment, the determination of the geometric relationship with a circle can be transformed into the determination of the geometric relationship between a rectangle and a circle by constructing the circumscribed rectangle of the geofence.

[0129] Alternatively, in this embodiment of the application, before determining the positional geometric relationship between the circular area and the target geofence, the circumscribed rectangle of the geofence is first generated.

[0130] For example, the maximum and minimum values ​​of latitude and longitude of each location point in the geofence boundary vertex sequence are calculated, and the maximum and minimum values ​​of longitude and latitude are used to form the boundary of the circumscribed rectangle.

[0131] For example, the geometric relationship between the target geofence and the circular region is determined based on the geometric relationship between the bounding rectangle of the target geofence and the circular region.

[0132] Specifically, the method for determining the geometric relationship between the bounding rectangle and the circular region of the target geofence is as follows:

[0133] Assume the center of the circular region is O(x) o ,y o The radius is R. The four sides of the bounding rectangle of the target geofence are denoted as L1, L2, L3, and L4, where L1 / / L2, L3 / / L4, and L1(L2) and L3(L4) are perpendicular. Their linear expressions are: L i :a i x+b i y+c i =0, i=1,2,3,4, and from this linear expression we can obtain According to geometric formulas, the distances between the center of the circular region and the four straight lines can be calculated:

[0134]

[0135]

[0136]

[0137]

[0138] In addition, the following values ​​are calculated using formulas four through seven to characterize the relative positional relationship between the center of the circular region and the four sides of the rectangle:

[0139] Fourth formula: p1 = a1x o +b1y o +c1

[0140] Fifth formula: p2 = a2x o +b2y o +c2

[0141] Sixth formula: p3 = a3x o +b3y o +c3

[0142] Seventh formula: p4 = a4x o +b4y o +c4

[0143] The following discussion will cover several scenarios:

[0144] Case 1: d1≥R, d2≥R, p1·p2>0, or d3≥R, d4≥R, p3·p4>0

[0145] In this case, the lines containing the two parallel sides of the outer rectangle of the target geofence are geometrically disjoint from the circular region. If p1p2>0 or p3p4>0, it means that the two parallel sides of the outer rectangle of the target geofence are on the same side of the center of the circular region, indicating that the circular region and the outer rectangle of the target geofence are geometrically disjoint and have no intersection.

[0146] Case 2: d1≥R, d2≥R, p1·p2<0, and d3≥R, d4≥R, p3·p4<0

[0147] In this case, the lines containing the two pairs of parallel sides of the outer rectangle of the target geofence are in a non-intersecting geometric relationship with the circular region. p1p2<0 or p3p4<0 indicates that the two pairs of parallel sides of the outer rectangle of the target geofence are located on opposite sides of the center of the circular region. This means that the geometric relationship between the circular region and the outer rectangle of the target geofence is one of inclusion, and the circular region is contained within the outer rectangle of the target geofence.

[0148] case 3: d1<R,d2,<R,d3<R,d3,<R

[0149] In this case, all four sides of the outer rectangle of the target geofence are located inside the circular area, indicating that the geometric relationship between the circular area and the outer rectangle of the target geofence is one of inclusion, and the outer rectangle of the target geofence is contained within the circular area.

[0150] Case 4: Other cases excluding Cases 1 to 3

[0151] After ruling out other possible geometric relationships, only one possibility remains: the circular region and the rectangle are geometrically intersecting.

[0152] It should be noted that if case 3 occurs, it means that the accuracy of this location is very poor, the radius of the circular area is very large, and it has already included the target geofence. In this case, the reliability of this location is very poor and is no longer sufficient to support the determination of the user's location status within the target geofence. Therefore, the status is determined to be unknown, and the status of entering or leaving the geofence is not determined.

[0153] Thus, by constructing a bounding rectangle, the geometric relationship between the target geofence and the circular area can be determined using simple mathematical and geometric formulas.

[0154] The following three examples illustrate in detail how an electronic device, after determining the positional geometry between a circular area and a target geofence, determines whether the electronic device is currently within the target geofence based on that positional geometry.

[0155] First example:

[0156] When the geometric relationship between the circular area and the target geofence is tangent or disjoint, the electronic device can directly determine that it is currently outside the target geofence.

[0157] Second example:

[0158] When the geometric relationship between the circular area and the target geofence is such that the circular area contains the target geofence, or the target geofence contains the circular area, the electronic device can directly determine that the electronic device is currently within the target geofence.

[0159] Third example:

[0160] When the geometric relationship between the circular area and the target geofence is one of intersection, the electronic device needs to first determine the first proportion of the area of ​​the circular area to the area of ​​the target geofence.

[0161] Further optionally, in this embodiment of the application, the process of step 203, "determining the first proportion of the area of ​​the circular region intersecting with the target geofence to the area of ​​the circular region based on the third location point within the target geofence," includes step 203a:

[0162] Step 203a: When the circular area intersects with the target geofence, determine the first proportion of the area of ​​the intersection of the circular area and the target geofence to the area of ​​the circular area based on the third location point within the target geofence.

[0163] For example, after determining that the circular area intersects with the target geofence, the number of third location points within the target geofence is counted, and the total coverage area of ​​the third location points is calculated based on the number of third location points to obtain the intersection area of ​​the circular area and the target geofence. Finally, the first ratio is determined based on the obtained intersection area.

[0164] In this way, even if the circular area and the target geofence are not intersecting, it can be directly determined whether the electronic device is currently within the target geofence, thereby reducing the amount of computation.

[0165] Specifically, the embodiments provided in this application are illustrated below with an example of a possible implementation, such as... Figure 4 As shown, the specific steps include A1 to A8:

[0166] Step A1: Locate the position and transform the coordinates of the vertex of the target geofence boundary.

[0167] Step A 2: Generate a CEP circle based on the accuracy of the positioning position.

[0168] Step A3: Generate the bounding rectangle of the target geofence.

[0169] Step A 4: Determine the geometric relationship between the CEP circle and the target geofence using the approximation method.

[0170] Step A 5: When it is determined that the geometric relationship between the CEP circle and the outer rectangle of the target geofence is intersecting, the pseudo Monte Carlo method is used to calculate the ratio of the intersection area of ​​the CEP circle and the target geofence to the area of ​​the CEP circle (i.e. the first ratio mentioned above).

[0171] Step A6: Compare the intersection ratio with the entry ratio threshold M (i.e., the first predetermined threshold mentioned above). If the intersection ratio is greater than the entry ratio threshold, it is determined that the target geofence has been entered; otherwise, proceed to step A7.

[0172] Step A 7: Compare the intersection ratio with the departure ratio threshold m (i.e., the second predetermined threshold mentioned above). If the intersection ratio is less than the departure ratio threshold, it is determined that the target geofence has been left; otherwise, the fence status is considered unknown, and the entry / exit status of the fence is not determined.

[0173] Step A8: If the geometric relationship between the CEP circle and the target geofence obtained from Step A4 is one of inclusion, then further determine whether the CEP circle is contained within the target geofence. If so, it is determined that the polygonal fence has been entered; otherwise, the fence status is determined to be unknown, and the entry / exit status of the fence is not determined.

[0174] This reduces the probability of geofence detection status jumps and jitters, improving the stability of geofence status detection. At the same time, it avoids the huge computational burden of traditional Monte Carlo methods, reducing the computational complexity of geofence detection.

[0175] In one possible embodiment, if the location status of the previous location of the electronic device has been determined, it is necessary to determine whether the current location of the electronic device is within the target geofence.

[0176] For example, an electronic device can determine whether its current location is within a target geofence based on the cached location status of the previous location of the electronic device.

[0177] Optionally, in this embodiment of the application, after step 204 "when the first proportion is greater than the first threshold, determine that the electronic device is within the target geofence; when the first proportion is less than the second threshold, determine that the electronic device is outside the target geofence", the target information of the electronic device can be cached.

[0178] For example, the target information may include at least one of the following: the location status of the electronic device within the target geofence, the geometric relationship between the circular area and the target geofence, the first proportion of the area of ​​the intersection of the circular area and the target geofence to the area of ​​the circular area, and information on the third location point located inside the target geofence among the location points within the arranged circular area.

[0179] For example, the information of the third location point mentioned above includes the location point's position, polar coordinate radius, and orientation angle.

[0180] For example, the location status of the electronic device in the target geofence is used to characterize the entry and exit result of the electronic device in the target geofence, such as having entered, having left, or being uncertain.

[0181] It should be noted that if the circular area and the geofence do not intersect geometrically, the target user's location status is directly determined to be outside the target geofence or uncertain.

[0182] Optionally, in this embodiment of the application, step 203, "determining the first ratio of the intersection area of ​​the circular area and the target geofence to the area of ​​the circular area based on the third location point within the target geofence," includes steps 203A to 203C:

[0183] Step 203A: Determine the search direction angle based on the positions of the first and second search points.

[0184] For example, the first search point is the previous position of the electronic device, and the second search point is the current position of the electronic device.

[0185] For example, based on the current motion direction of the electronic device, the motion vector of the current position point is calculated, and the orientation angle of the position point is determined.

[0186] For example, suppose the target user's motion direction vector is... The angle between the direction vector of motion and the negative y-axis of the rectangular coordinate system can be calculated as follows:

[0187] Step 203B: Obtain the first set of orientation angles and the second set of orientation angles.

[0188] For example, the location point corresponding to the direction angle in the first set of direction angles mentioned above is within the target geofence.

[0189] For example, the location point corresponding to the direction angle in the second set of direction angles mentioned above is outside the target geofence.

[0190] For example, for each concentric circle in the circular region except for the outermost concentric circle, the orientation angle of each location point in the first concentric circle in the circular region is obtained. Based on the orientation angle of each location point, it is determined that the location point with the orientation angle in the first sub-orientation angle set is inside the target geofence, and it is determined that the location point with the orientation angle in the second sub-orientation angle set is outside the target geofence, so as to count the number of all location points inside the target geofence.

[0191] For example, the first concentric circle mentioned above refers to each concentric circle except for the outermost concentric circle in the circular region.

[0192] For example, it can be determined whether a location point is within the target geofence based on the orientation angle of each location point.

[0193] In one example, the geofence can be determined layer by layer, according to the concentric circles of the circular region, by analyzing the set of orientation angles of each point within each circle. Specifically, since points within the same circle have the same polar radius, but different orientation angle parameters θ, after determining whether each point is inside or outside the geofence using the normal vector method, the orientation angle sequence will be... Separated into two non-intersecting geometries: a set of orientation angles located inside the geofence. and the set of orientation angles located outside the geofence Of course, one of these sets may be empty. Due to the spatial continuity of the intersecting and non-intersecting spaces between the circular region and the geographic fence, after the location point where the second layer is generated, the corresponding orientation angle of this layer is... The location points in the set are highly likely to be located inside the geofence; similarly, the azimuth angles corresponding to the location points in this ring are... The locations within the set will most likely be located outside the geofence. Thus, with and By using the intersection of the sets as a reference, the intersection point of the second layer of direction angles can be found very quickly, thus determining the set of direction angles for the second layer. and This provides a basis for determining the third concentric circle. By following this process sequentially, the set of location points inside the geofence for each concentric circle can be determined sequentially from the outside in. This continues until all location points within a certain concentric circle are outside the geofence. Due to spatial continuity, location points in subsequent concentric circles will also be outside the geofence, thus concluding the search process. The total number of location points inside the geofence across all concentric circles is then counted to obtain the first set of orientation angles.

[0194] It should be noted that azimuth angles may cause phase ambiguity, meaning that 0 and 2π actually refer to the same azimuth angle. If phase ambiguity occurs, 2π needs to be added to / subtracted from the original azimuth angle value to ensure that the azimuth angle interval distribution within the geofence is a continuous interval. The azimuth angle interval distribution within the target geofence is the same as the azimuth angle interval distribution for entering the target geofence.

[0195] For example, by taking the opposite phase (i.e., adding / subtracting π) at the two endpoints of the directional angle interval entering the target geofence, the distribution of the second directional angle interval when the target user leaves the target geofence can be calculated, thus obtaining the second directional angle set.

[0196] It should be noted that when this application uses the pseudo-Monte Carlo method to solve for the intersection area of ​​the circular region and the geofence, for the points identified as being inside the geofence, their orientation angles are statistically analyzed. These orientation angles exhibit a concentrated distribution. Of course, this distribution may not be a single peak; it may also have bimodal or even multimodal patterns. This means that in the direction of this orientation angle distribution interval, the user is moving towards entering the geofence; similarly, in the opposite direction, the user is moving towards leaving the geofence. If neither of these conditions is met, it becomes difficult to determine whether the user is moving towards or away from the geofence, and the process directly reverts to the pseudo-Monte Carlo method for determination.

[0197] Based on the above scheme for determining whether a location point is within a target geofence, the following describes a possible embodiment of the pseudo-Monte Carlo method for calculating the first ratio of the intersection area of ​​the CEP circle and the target geofence to the area of ​​the CEP circle, such as... Figure 5As shown, the specific steps include S1 to S10:

[0198] Step S1: Initialize the CEP circle, i.e. the circular region mentioned above. Let i = 1, i.e. the first layer, and the direction angle range is [0, 2π].

[0199] Step S2: Determine whether all spheres have been searched, i.e., whether all location points in the spheres are determined to be within the geofence; if the search has been completed, proceed to step S9; if the search has not been completed, proceed to step S3.

[0200] Step S3: Construct a set of location points for all layers of the CEP circle.

[0201] Step S4: Apply the normal vector to determine whether the location point of circle i is inside or outside the geofence.

[0202] Step S5: Generate the set of orientation angles inside the geofence of layer i.

[0203] Step S6, Judgment Is it an empty set? If it is not an empty set, proceed to step S7; if it is an empty set, proceed to step S9.

[0204] Step S7: Search for the next lap i+1.

[0205] Step S8, according to Search near the boundary to obtain the intersection point of the orientation angle of this layer; then proceed to step S2.

[0206] Step S9: Stop the search and count the total number of locations inside the geofence.

[0207] Step S10: Calculate the total area of ​​the CEP circle and the ratio of the area where the CEP circle intersects with the geographic fence to the area of ​​the CEP circle.

[0208] For example, the radius of the CEP circle is 60 meters. Using the traditional Monte Carlo method, with a density of one point per square meter, 11,310 random location points would need to be constructed. However, using the pseudo-Monte Carlo method described above, only 2,312 location points are needed throughout the entire process, representing only 20.4% of the computational cost of the traditional Monte Carlo method. Of these, 1,986 location points are located inside the geofence, resulting in the intersection area of ​​the CEP circle and the geofence accounting for 17.56% of the total area of ​​the CEP circle. This significantly reduces the computational workload of calculating the intersection area and its proportion within the CEP circle, improving real-time performance and detection speed.

[0209] Step 203C: If the search direction angle does not belong to the first direction angle set and does not belong to the second direction angle set, determine the first proportion of the area of ​​the circular area intersecting the target geographic fence to the area of ​​the circular area based on the third location point within the target geographic fence.

[0210] For example, the search direction angle is determined, that is, whether the motion direction vector of the electronic device moving to the current position belongs to the first direction angle set, or to the second direction angle set, or neither.

[0211] Specifically, the following three cases illustrate how to determine whether an electronic device's current location is within the target geofence based on whether the search direction angle belongs to the first direction angle set, the second direction angle set, or neither.

[0212] Case 1: The search direction angle belongs to the first direction angle set.

[0213] In this case, if the electronic device at the previous time t0 is in the target geofence entry / exit state, then from time t0 to time t1, the target user is moving in the direction of entering the target geofence, indicating that the target user has already entered the target geofence, and it is directly determined that the target user has entered the target geofence; otherwise, it is uncertain whether the target user has entered the target geofence at the current time, and a pseudo-Monte Carlo method needs to be applied to determine the target user's target geofence entry / exit state.

[0214] It should be noted that time t1 is the moment when the electronic device is at its current position, and time t0 is the moment when the electronic device is at its previous position.

[0215] Case 2: The search direction angle belongs to the second set of direction angles.

[0216] Similar to case 1, in this case, if the electronic device at the previous time t0 was in the target geofence entry / exit state and had left the target geofence, then from time t0 to time t1, the electronic device is moving in the direction of leaving the target geofence, which means that the electronic device has left the target geofence at this moment, and it is directly determined that it has left; otherwise, it is uncertain whether the electronic device has entered the target geofence at the current time, and the pseudo Monte Carlo method needs to be applied to determine the target user's target geofence entry / exit state.

[0217] Case 3: The search direction angle does not belong to the first direction angle set, nor does it belong to the second direction angle set.

[0218] In this case, the pseudo Monte Carlo method is directly applied for determination. The electronic device determines the first ratio of the area of ​​the intersection of the circular area and the target geofence to the area of ​​the circular area based on the third location point within the target geofence. Based on this first ratio, it is determined whether the current position of the electronic device is within the target geofence.

[0219] In this way, since the location and status of the electronic device have already been determined, only the direction of the movement vector of the electronic device needs to be determined, which reduces the amount of computation and improves the real-time performance of geofence status determination.

[0220] It should be noted that the positioning method provided in this application can be executed by a positioning device, an electronic device, or a functional module or entity within an electronic device. This application uses a positioning device executing the positioning method as an example to illustrate the positioning device provided in this application.

[0221] Figure 6 A schematic diagram of a possible structure of the positioning device involved in an embodiment of this application is shown. For example... Figure 6 As shown, the positioning device 600 may include: an acquisition module and a processing module;

[0222] The acquisition module 601 is used to acquire a first location point and a target geofence, where the first location point is the current location of the electronic device. The processing module 602 is used to determine a circular area corresponding to the electronic device based on the first location point, where the circular area includes a second location point. The processing module 602 is also used to determine a first ratio of the area of ​​the intersection of the circular area and the target geofence to the area of ​​the circular area based on a third location point within the target geofence, where the third location point is a location point corresponding to the area of ​​the intersection of the circular area and the target geofence. The processing module 602 is also used to determine that the electronic device is within the target geofence if the first ratio is greater than a first threshold, and that the electronic device is outside the target geofence if the first ratio is less than a second threshold.

[0223] Optionally, in this embodiment of the application, the processing module 602 is further configured to determine the target distribution density based on the preset coverage area of ​​the second location point and the area of ​​the circular region; the processing module 602 is further configured to uniformly arrange the second location point within the circular region based on the target distribution density.

[0224] Optionally, in this embodiment of the application, the processing module 602 is specifically used for:

[0225] Based on the target distribution density and the radius of the circular region, determine the orientation angle and distance of the second position point within the circular region; according to the orientation angle and distance of the second position point, arrange the second position point layer by layer in the circular region.

[0226] Optionally, in this embodiment of the application, the acquisition module 601 is further configured to acquire the location information of the target geofence and the location information of the circular area; the processing module 602 is further configured to determine the positional geometric relationship between the circular area and the target geofence based on the location information of the circular area and the location information of the target geofence.

[0227] Optionally, in this embodiment of the application, the above-mentioned processing module 602 is specifically used to determine, based on a third location point within the target geofence, the first proportion of the area of ​​the circular area to the area of ​​the circular area when the circular area intersects with the target geofence.

[0228] Optionally, in this embodiment of the application, the processing module 602 is specifically used to: determine the search direction angle based on the location of the first search point and the location of the second search point; obtain the first direction angle set and the second direction angle set, wherein the location point corresponding to the direction angle in the first direction angle set is within the target geofence, and the location point corresponding to the direction angle in the second direction angle set is outside the target geofence; if the search direction angle does not belong to the first direction angle set and does not belong to the second direction angle set, determine the first proportion of the intersection area of ​​the circular area and the target geofence to the area of ​​the circular area based on the third location point within the target geofence.

[0229] In this embodiment, a first location point and a target geofence are obtained. The first location point is the current location of the electronic device. Based on the first location point, a circular area corresponding to the electronic device is determined, including a second location point. Based on a third location point within the target geofence, a first ratio is determined between the intersection area of ​​the circular area and the target geofence and the area of ​​the circular area. The third location point is a location point corresponding to the intersection area of ​​the circular area and the target geofence. If the first ratio is greater than a first threshold, the electronic device is determined to be within the target geofence; if the first ratio is less than a second threshold, the electronic device is determined to be outside the target geofence. Thus, by counting the number of location points within the circular area of ​​the geofence, the coverage area of ​​these location points can be calculated, thereby obtaining the intersection area of ​​the circular area and the geofence, reducing the computational workload of calculating the intersection area. Furthermore, based on the first ratio of the intersection area to the area of ​​the circular area, the first ratio is used to determine whether the circular area corresponding to the electronic device is inside the geofence, thereby improving the stability of detecting the user's location relative to the geofence. In this embodiment, the location can be an electronic device or a component within the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, electronic devices can be mobile phones, tablets, laptops, handheld computers, in-vehicle electronic devices, mobile internet devices (MID), augmented reality (AR) / virtual reality (VR) devices, robots, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc. They can also be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. The embodiments of this application do not impose specific limitations.

[0230] The positioning device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0231] The positioning device provided in this application embodiment can achieve... Figures 1 to 5 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0232] Optionally, such as Figure 7 As shown, this application embodiment also provides an electronic device 700, including a processor 701 and a memory 702. The memory 702 stores a program or instructions that can run on the processor 701. When the program or instructions are executed by the processor 701, they implement the various steps of the above-described positioning method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0233] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0234] Figure 8 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0235] The electronic device 800 includes, but is not limited to, components such as: radio frequency unit 801, network module 802, audio output unit 803, input unit 804, sensor 805, display unit 806, user input unit 807, interface unit 808, memory 809, and processor 810.

[0236] Those skilled in the art will understand that the electronic device 800 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 810 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 8 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0237] The processor 810 is configured to acquire a first location point and a target geofence, wherein the first location point is the current location of the electronic device; the processor 810 is further configured to determine a circular area corresponding to the electronic device based on the first location point, wherein the circular area includes a second location point; the processor 810 is further configured to determine a first ratio of the area of ​​the intersection of the circular area and the target geofence to the area of ​​the circular area based on a third location point within the target geofence, wherein the third location point is a location point corresponding to the area of ​​the intersection of the circular area and the target geofence; the processor 810 is further configured to determine that the electronic device is within the target geofence if the first ratio is greater than a first threshold, and determine that the electronic device is outside the target geofence if the first ratio is less than a second threshold.

[0238] Optionally, in this embodiment of the application, the processor 810 is further configured to determine the target distribution density based on the preset coverage area of ​​the second location point and the area of ​​the circular region; the processor 810 is further configured to uniformly arrange the second location point within the circular region based on the target distribution density.

[0239] Optionally, in this embodiment of the application, the processor 810 is specifically used for:

[0240] Based on the target distribution density and the radius of the circular region, determine the orientation angle and distance of the second position point within the circular region; according to the orientation angle and distance of the second position point, arrange the second position point layer by layer in the circular region.

[0241] Optionally, in this embodiment of the application, the processor 810 is further configured to acquire the location information of the target geofence and the location information of the circular area; the processor 810 is further configured to determine the positional geometric relationship between the circular area and the target geofence based on the location information of the circular area and the location information of the target geofence.

[0242] Optionally, in this embodiment of the application, the processor 810 is specifically used to determine, based on a third location point within the target geofence, the first proportion of the area of ​​the circular area to the area of ​​the circular area when the circular area intersects with the target geofence.

[0243] Optionally, in this embodiment of the application, the processor 810 is specifically configured to: determine a search direction angle based on the location of the first search point and the location of the second search point; obtain a first direction angle set and a second direction angle set, wherein the location point corresponding to the direction angle in the first direction angle set is within the target geofence, and the location point corresponding to the direction angle in the second direction angle set is outside the target geofence; if the search direction angle does not belong to the first direction angle set and does not belong to the second direction angle set, determine a first proportion of the intersection area of ​​the circular area and the target geofence to the area of ​​the circular area based on a third location point within the target geofence.

[0244] In this embodiment, a first location point and a target geofence are obtained, where the first location point is the current location of the electronic device. Based on the first location point, a circular region corresponding to the electronic device is determined, including a second location point. Based on a third location point within the target geofence, a first ratio is determined between the intersection area of ​​the circular region and the target geofence and the area of ​​the circular region. The third location point is a location point corresponding to the intersection area of ​​the circular region and the target geofence. If the first ratio is greater than a first threshold, the electronic device is determined to be within the target geofence; if the first ratio is less than a second threshold, the electronic device is determined to be outside the target geofence. Thus, by counting the number of location points within the circular region of the geofence, the coverage area of ​​these location points can be calculated, thereby obtaining the intersection area of ​​the circular region and the geofence, reducing the computational workload of calculating the intersection area. Furthermore, based on the first ratio of the intersection area to the area of ​​the circular region, the first ratio is used to determine whether the circular region corresponding to the electronic device is inside the geofence, thereby improving the stability of detecting the user's position relative to the geofence.

[0245] It should be understood that, in this embodiment, the input unit 804 may include a graphics processing unit (GPU) 8041 and a microphone 8042. The GPU 8041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 806 may include a display panel 8061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 807 includes at least one of a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include a touch detection device and a touch controller. Other input devices 8072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0246] The memory 809 can be used to store software programs and various data. The memory 809 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 809 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 809 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0247] Processor 810 may include one or more processing units; optionally, processor 810 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 810.

[0248] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described positioning method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0249] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0250] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described positioning method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0251] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0252] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the positioning method embodiments described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0253] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0254] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0255] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A positioning method, characterized by, The method comprises: obtaining a first position point and a target geofence, the first position point being a current position of an electronic device; determining a circular region corresponding to the electronic device according to the first position point, the circular region including a second position point; determining a search direction angle according to a previous position point of the electronic device and a current position point of the electronic device; obtaining a first direction angle set and a second direction angle set, wherein a direction angle in the first direction angle set corresponds to a position point within the target geofence, and a direction angle in the second direction angle set corresponds to a position point outside the target geofence; in a case where the search direction angle does not belong to the first direction angle set and does not belong to the second direction angle set, determining a first proportion of an intersection area of the circular region and the target geofence to an area of the circular region according to a third position point within the target geofence, the third position point being a corresponding position point in an intersection region of the circular region and the target geofence; in a case where the first proportion is greater than a first threshold value, determining that the electronic device is within the target geofence; and in a case where the first proportion is less than a second threshold value, determining that the electronic device is outside the target geofence.

2. The method of claim 1, wherein, After the determining of the circular region corresponding to the electronic device according to the first position point, the method further comprises: determining a target distribution density based on a preset coverage area of the second position point and an area of the circular region; arranging the second position points uniformly in the circular region based on the target distribution density.

3. The method of claim 2, wherein, The method further comprises: determining a direction angle and a distance of arranging the second position points in the circular region based on the target distribution density and a radius of the circular region; arranging the second position points layer by layer in the circular region according to the direction angle and the distance of the second position points.

4. The method of claim 1, wherein, After the determining of the circular region corresponding to the electronic device according to the first position point, the method further comprises: obtaining position information of the target geofence and position information of the circular region; determining a position geometric relationship between the circular region and the target geofence based on the position information of the circular region and the position information of the target geofence.

5. The method according to claim 1 or 4, characterized in that, The determining of the first proportion of the intersection area of the circular region and the target geofence to the area of the circular region according to the third position point within the target geofence comprises: in a case where the circular region intersects with the target geofence, determining the first proportion of the intersection area of the circular region and the target geofence to the area of the circular region according to the third position point within the target geofence.

6. A positioning device, characterized by The positioning device comprises an obtaining module and a processing module. The obtaining module is configured to obtain a first position point and a target geofence, the first position point being a current position of an electronic device. The processing module is configured to determine a circular region corresponding to the electronic device according to the first position point, the circular region including a second position point. The processing module is further configured to determine a search direction angle according to a previous position point of the electronic device and a current position point of the electronic device; The processing module is further configured to obtain a first set of direction angles and a second set of direction angles, wherein a direction angle in the first set of direction angles corresponds to a position point within the target geofence, and a direction angle in the second set of direction angles corresponds to a position point outside the target geofence; The processing module is further configured to, when the search direction angle does not belong to the first set of direction angles and does not belong to the second set of direction angles, determine a first proportion of an intersection area of the circular region and the target geofence to an area of the circular region according to a third position point within the target geofence, the third position point being a corresponding position point in an intersection region of the circular region and the target geofence. The processing module is further configured to, when the first proportion is greater than a first threshold, determine that the electronic device is within the target geofence, and when the first proportion is less than a second threshold, determine that the electronic device is outside the target geofence.

7. The apparatus of claim 6, wherein The processing module is further configured to determine a target distribution density based on a preset coverage area of the second position point and an area of the circular region. The processing module is further configured to arrange the second position points uniformly in the circular region based on the target distribution density.

8. The apparatus of claim 7, wherein The processing module is specifically configured to: determine a direction angle and a distance of arranging the second position points in the circular region based on the target distribution density and a radius of the circular region; and arrange the second position points in the circular region layer by layer according to the direction angle and the distance of the second position points.

9. An electronic device, comprising: A processor, a memory, and a program or instructions stored in the memory and executable on the processor, the program or instructions being executed by the processor to implement the steps of the positioning method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Detecting geo-fence events using varying confidence levels

    CN105519142A

  • Vehicle positioning method and device based on electronic fence

    CN113376671A