Location matching methods, devices, servers, and storage media
By calculating the location information of geofences and electronic devices in the server and dividing the data into rectangular grids for matching, the problem of excessively long geofence data processing time in existing technologies is solved, and more efficient data acquisition is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-11
- Publication Date
- 2026-03-13
AI Technical Summary
Existing technologies require extensive pairwise combinations and ray casting to obtain crowdsourced data corresponding to geofences, resulting in excessive time consumption and failing to meet the real-time requirements of servers.
By calculating the location information of geofences and electronic devices, the target horizontal rectangular boundary is determined and divided into rectangular grids for spatial location matching, reducing the need for pairwise matching decisions for each geofence and electronic device.
This effectively reduces the time it takes for the server to obtain geofence information containing the location of electronic devices, thus improving data processing efficiency.
Smart Images

Figure CN116886762B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of communication technology, specifically relating to a location matching method, device, server, and storage medium. Background Technology
[0002] Geofencing uses a virtual fence to define a virtual geographical boundary. When a server is conducting a contextual assessment of network signal strength, it needs to statistically analyze the network status characteristics of different geofences within their geographical range, such as network signal strength. Specifically, the server needs to match crowdsourced data with the spatial locations of different geofences to obtain crowdsourced data corresponding to each geofence. This crowdsourced data can include the location information of at least two electronic devices and the corresponding network status information. Based on this, the server can statistically analyze the network status characteristics of each geofence within its geographical range.
[0003] Currently, servers can load different geofence and crowdsourcing data into memory, then combine them in pairs and use ray casting to determine the spatial location of each pair, thus obtaining the crowdsourcing data corresponding to each geofence. However, since the input data is often too large, a single machine cannot meet the requirements. Therefore, it is usually necessary to use a more mature big data framework, such as Spark, to read the geofence and crowdsourcing data as a data table, combine them in pairs, and use ray casting to determine the spatial location of each pair, thus obtaining the crowdsourcing data corresponding to each geofence.
[0004] However, regardless of whether offline writing to memory or using the Spark framework is employed, the process of pairwise combining geofence data and crowdsourced data, followed by ray casting for location determination, remains unavoidable. Assuming there are M geofences and N crowdsourced data points, there are M*N possible pairwise combinations, requiring M*N ray casting operations for location determination. Since different geofences are complex and have many edges, each ray casting operation takes approximately 0.15ms, resulting in a significant time consumption for M*N location determinations. Consequently, retrieving the corresponding crowdsourced data from the geofences takes an excessively long time for the server. Summary of the Invention
[0005] The purpose of this application is to provide a location matching method, apparatus, server, and storage medium that can reduce the time it takes for a server to obtain crowdsourced data corresponding to geofences.
[0006] In a first aspect, embodiments of this application provide a location matching method, the method comprising: determining a target horizontal rectangular boundary based on location information of at least two geofences and location information of at least two electronic devices; dividing the target horizontal rectangular boundary to obtain at least one rectangular grid; performing spatial location matching between at least one first electronic device contained in the first rectangular grid and at least one first geofence to obtain spatial location information corresponding to the first rectangular grid, the spatial location information including location information of the first electronic device contained in each first geofence, the first rectangular grid being any one of the at least one rectangular grid; obtaining target spatial location information based on the spatial location information corresponding to each rectangular grid, the target spatial location information including location information of the electronic device contained in each geofence; wherein, the first geofence is: a geofence in which at least a portion of the area is located within the first rectangular grid among at least two geofences; the first electronic device is: an electronic device in which at least one of the at least two electronic devices is located within the first rectangular grid.
[0007] Secondly, embodiments of this application provide a location matching device, which includes: a determining module, a dividing module, a matching module, and a processing module. The determining module is used to determine a target horizontal rectangular boundary based on the location information of at least two geofences and the location information of at least two electronic devices. The dividing module is used to divide the target horizontal rectangular boundary determined by the determining module to obtain at least one rectangular grid. The matching module is used to perform spatial location matching between at least one first electronic device contained in the first rectangular grid divided by the dividing module and at least one first geofence to obtain spatial location information corresponding to the first rectangular grid. This spatial location information includes the location information of the first electronic device contained within each first geofence, and the first rectangular grid is any one of the at least one rectangular grid. The processing module is used to obtain target spatial location information based on the spatial location information corresponding to each rectangular grid obtained by the matching module. This target spatial location information includes the location information of the electronic device contained within each geofence; wherein, the first geofence is a geofence in which at least a portion of its area is located within the first rectangular grid; and the first electronic device is an electronic device in which at least one of the at least two electronic devices is located within the first rectangular grid.
[0008] Thirdly, embodiments of this application provide a server including a processor and a memory, the memory storing programs or instructions executable on the processor, the programs or instructions, when executed by the processor, implementing the steps of the method described in the first aspect.
[0009] 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.
[0010] 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.
[0011] 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.
[0012] In this embodiment, the electronic device determines a target horizontal rectangular boundary based on the location information of at least two geofences and the location information of at least two electronic devices; the target horizontal rectangular boundary is divided to obtain at least one rectangular grid; spatial location matching is performed between at least one first electronic device contained in the first rectangular grid and at least one first geofence to obtain spatial location information corresponding to the first rectangular grid, the spatial location information including the location information of the first electronic device contained in each first geofence, and the first rectangular grid is any one of the at least one rectangular grid; based on the spatial location information corresponding to each rectangular grid, target spatial location information is obtained, the target spatial location information including the location information of the electronic device contained in each geofence; wherein, the first geofence is: a geofence in at least two geofences whose at least part of the area is located within the first rectangular grid; the first electronic device is: an electronic device in at least two electronic devices located within the first rectangular grid. In this solution, the server calculates the positions of at least two geofences and at least two electronic devices to obtain the target horizontal rectangular boundary. Then, the target horizontal rectangular boundary is divided into at least one regularly shaped rectangular grid. This allows the server to obtain the location information of the electronic devices contained in each geofence by performing spatial location matching between at least one first electronic device contained in each rectangular grid and at least one first geofence. This eliminates the need to match at least two geofences and at least two electronic devices pairwise and then use the ray casting method to determine the pairwise matching results to obtain the location information of the electronic devices contained in each geofence. This reduces the time required for the server to obtain the location information of the electronic devices contained in the geofences. Attached Figure Description
[0013] Figure 1 This is one of the flowcharts illustrating a location matching method provided in an embodiment of this application;
[0014] Figure 2 This is one of the schematic diagrams illustrating an example of confirming the minimum horizontal rectangle boundary provided in this application embodiment;
[0015] Figure 3This is a second schematic flowchart of a location matching method provided in an embodiment of this application;
[0016] Figure 4 This is a second schematic diagram illustrating an example of determining the minimum horizontal rectangle boundary provided in this application embodiment;
[0017] Figure 5 This is a schematic diagram illustrating an example of determining the boundary of a first horizontal rectangle provided in an embodiment of this application;
[0018] Figure 6 This is a schematic diagram illustrating an example of determining the boundary of a second horizontal rectangle provided in an embodiment of this application;
[0019] Figure 7 This is a schematic diagram illustrating an example of determining the boundary of a target horizontal rectangle according to an embodiment of this application;
[0020] Figure 8 This is a schematic diagram of the structure of a position matching device provided in an embodiment of this application;
[0021] Figure 9 This is a schematic diagram of the hardware structure of a server provided in an embodiment of this application. Detailed Implementation
[0022] 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.
[0023] 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 terms can be used interchangeably 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.
[0024] It should be noted that the terms "at least one," "at least one of," etc., in the specification and claims of this application refer to any one, any two, or a combination of two or more of the included objects. For example, at least one of a, b, and c can mean: "a," "b," "c," "a and b," "a and c," "b and c," and "a, b, and c," where a, b, and c can be single or multiple. Similarly, "at least two" refers to two or more, and its meaning is similar to that of "at least one."
[0025] The location matching method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0026] 1. Geometry: refers to geometric figures
[0027] Geometry is an important concept in Geographic Information Systems (GIS), representing the shape and location in geographic space. Geometry is the foundation of structured data in GIS and is an efficient way to store and display geographic information. It can be used to represent points, lines, polygons, and complex geographic objects on the Earth's surface.
[0028] 2. Minimum Bounding Rectangle (MBR)
[0029] In GIS, MBR is the smallest horizontal rectangular bounding box used to represent a set of geographic objects.
[0030] 3. X-ray method
[0031] The ray casting algorithm is a fundamental algorithm in computational geometry, typically used to process input data containing a large number of geometric objects such as points, lines, or polygons. This algorithm determines the spatial relationships between the query point and the objects by drawing a ray from the query point and intersecting, separating, or tangent to the ray with all objects.
[0032] 4. Spark Partition: also known as Spark partition
[0033] Spark partitions can be viewed as abstractions on a dataset. Each partition represents a subset of the input dataset, containing a portion of the data. Data in different partitions is stored on different machines, allowing for parallel computation on different nodes in the cluster, thereby improving computational performance and parallelism.
[0034] The location matching method in this application embodiment can be applied to scenarios where geofencing is used to match electronic devices.
[0035] In conducting scenario-based assessments of network signals, it is necessary to statistically analyze the network status characteristics of different geofences within their geographical locations (e.g., transportation, tourist attractions, business districts, etc.). This requires matching the network data from crowdsourcing with different geographical locations to obtain the crowdsourcing data corresponding to each geofence. Based on this data, the server can then statistically analyze the network status characteristics of each geofence within its geographical location.
[0036] Currently, servers can load different geofence and crowdsourcing data into memory, then combine them in pairs and use ray casting to determine the spatial location of each pair, thus obtaining the crowdsourcing data corresponding to each geofence. However, since the input data is often too large, a single machine cannot meet the requirements. Therefore, it is usually necessary to use a more mature big data framework, such as Spark, to read the geofence and crowdsourcing data as a data table, combine them in pairs, and use ray casting to determine the spatial location of each pair, thus obtaining the crowdsourcing data corresponding to each geofence.
[0037] However, regardless of whether offline writing to memory or using the Spark framework is employed, the process of pairwise combining geofence data and crowdsourced data, followed by ray casting for location determination, remains unavoidable. Assuming there are M geofences and N crowdsourced data points, there are M*N possible pairwise combinations, requiring M*N ray casting operations for location determination. Given the complexity and numerous edges of different geofences, the average time for a single ray casting operation is approximately 0.15ms. Therefore, M*N location determinations consume a significant amount of time. Consequently, retrieving the corresponding crowdsourced data from the geofences takes an excessively long time for the server.
[0038] In the location matching method, apparatus, server, and storage medium provided in this application embodiment, the server calculates the positions of at least two geofences and at least two electronic devices to obtain a target horizontal rectangular boundary. Then, the target horizontal rectangular boundary is divided into at least one regularly shaped rectangular grid. This allows the server to obtain the location information of the electronic devices contained in each geofence by performing spatial location matching between at least one first electronic device contained in each rectangular grid and at least one first geofence. This eliminates the need to match at least two geofences and at least two electronic devices pairwise and then use a ray casting method to determine the pairwise matching results to obtain the location information of the electronic devices contained in each geofence. This reduces the time required for the server to obtain the location information of the electronic devices contained in the geofence.
[0039] The execution subject of the location matching method provided in this application embodiment can be a location matching device, which can be a device, a component in a server, an integrated circuit, or a chip. The following uses a server as an example to illustrate the technical solution provided in this application embodiment.
[0040] This application provides a location matching method. Figure 1 A flowchart of a location matching method provided in an embodiment of this application is shown, which can be executed by a server. Figure 1 As shown, the location matching method provided in this application embodiment may include the following steps 201 to 204.
[0041] Step 201: The server determines the target horizontal rectangular boundary based on the location information of at least two geofences and the location information of at least two electronic devices.
[0042] In some embodiments of this application, the above-mentioned geofence is used to characterize the location, size, and shape of a certain area.
[0043] In some embodiments of this application, the aforementioned at least two geofences can be geofences corresponding to at least two areas within a single region, such as: a geofence corresponding to a train station, a subway station, and a supermarket in city XX. Alternatively, the aforementioned at least two geofences can be geofences corresponding to areas of the same nature in different regions, such as: geofences corresponding to train stations in at least two cities. This application does not impose any limitations on these embodiments.
[0044] In some embodiments of this application, the above-mentioned at least two geofences can be referred to as a geofence set. The server can collect at least two geofences or receive at least two geofences sent by multiple electronic devices.
[0045] In some embodiments of this application, the location information of the geofence can be any of the following: the latitude and longitude of the geofence, or the coordinate information of the geofence.
[0046] In some embodiments of this application, the above-mentioned at least two electronic devices may be referred to as a set of electronic devices.
[0047] In some embodiments of this application, the server can obtain the location information of the electronic device through GPS in the electronic device, or through network positioning.
[0048] In some embodiments of this application, the location information of the electronic device can be any of the following: the latitude and longitude of the electronic device, or the coordinate information of the electronic device.
[0049] In some embodiments of this application, the location information of the electronic device is the location information of the electronic device when it is in a certain area, such as the location information of the electronic device when it is in a train station.
[0050] In some embodiments of this application, the target horizontal rectangular boundary is the smallest horizontal rectangular boundary that includes the at least two geofences and the at least two electronic devices. That is, the location areas corresponding to the at least two geofences and the locations corresponding to the at least two electronic devices are both located within the location area of the target horizontal rectangular boundary.
[0051] In some embodiments of this application, the locations corresponding to the above-mentioned at least two electronic devices can be understood as the locations of the areas where the electronic devices are located when the server obtains the location information of the electronic devices.
[0052] In some embodiments of this application, the aforementioned minimum horizontal rectangular boundary can be understood as the minimum horizontal rectangular frame capable of containing the aforementioned at least two geofences and at least two electronic devices.
[0053] For example, such as Figure 2As shown, suppose there is a geofence A and two electronic devices B and C; the vertex coordinates of geofence A are (1,1), (3,1), and (3,4), the coordinates of electronic device B are (0,1), and the coordinates of electronic device C are (2,0). The server can take the smallest x-coordinate (0) as the x-coordinate of the minimum horizontal rectangle containing geofence A and electronic devices B and C, and the smallest y-coordinate (0) as the y-coordinate of the minimum horizontal rectangle. It can also take the largest x-coordinate (3) as the x-coordinate of the minimum horizontal rectangle, and the largest y-coordinate (4) as the y-coordinate of the minimum horizontal rectangle. Thus, the coordinates of the minimum horizontal rectangle are (0,0) for the bottom left and (3,4) for the top right, thus obtaining the minimum horizontal rectangle boundary. The minimum horizontal rectangle boundary is... Figure 2 It is shown in the middle with a dashed rectangle.
[0054] In some embodiments of this application, combined with Figure 1 ,like Figure 3 As shown, step 201 can be implemented through steps 201a to 201c as described below.
[0055] Step 201a: The server determines the first horizontal rectangular boundary based on the location information of at least two geofences.
[0056] In some embodiments of this application, the above-mentioned at least two geofences each correspond to a minimum horizontal rectangular boundary, and the first horizontal rectangular boundary is a horizontal rectangular boundary that includes at least two minimum horizontal rectangular boundaries.
[0057] In some embodiments of this application, the server can calculate the minimum horizontal rectangle boundary corresponding to each geofence based on the vertex position information of at least two geofences, and then calculate the first horizontal rectangle boundary based on the vertex position information of the minimum horizontal rectangle boundary corresponding to each geofence.
[0058] It should be noted that the specific implementation method for the server to determine the first horizontal rectangle boundary will be described in the following embodiments, and will not be repeated here.
[0059] In some embodiments of this application, step 201a can be specifically implemented by the following steps 201a1 and 201a2.
[0060] Step 201a1: The server determines the third horizontal rectangle boundary corresponding to each geofence.
[0061] In some embodiments of this application, the aforementioned third horizontal rectangular boundary is the minimum horizontal rectangular boundary corresponding to each geofence.
[0062] In some embodiments of this application, the server can determine the minimum horizontal rectangle boundary corresponding to each geofence based on the vertex position information of each geofence.
[0063] For example, suppose a geofence P1 has n vertices, and the coordinates of its n vertices are (x1, y1), (x2, y2)...(x...). n ,y n The server can use the smallest x-coordinate among the n vertex coordinates as the x-coordinate of the bottom left corner of the smallest horizontal rectangle boundary; the smallest y-coordinate among the n vertex coordinates as the y-coordinate of the bottom left corner of the smallest horizontal rectangle boundary; the largest x-coordinate among the n vertex coordinates as the x-coordinate of the top right corner of the smallest horizontal rectangle boundary; and the largest y-coordinate among the n vertex coordinates as the y-coordinate of the top right corner of the smallest horizontal rectangle boundary. Thus, the server can determine the smallest horizontal rectangle boundary corresponding to geofence P1 based on these four coordinates.
[0064] Specifically, after determining the x-coordinate of the lower left corner, the y-coordinate of the lower left corner, the x-coordinate of the upper right corner, and the y-coordinate of the upper right corner of the minimum horizontal rectangle boundary, the server can obtain the coordinates of the lower left corner of the minimum horizontal rectangle boundary based on the x-coordinate of the lower left corner and the y-coordinate of the lower left corner; obtain the coordinates of the upper right corner of the minimum horizontal rectangle boundary based on the x-coordinate of the upper right corner and the y-coordinate of the upper right corner; obtain the coordinates of the upper left corner of the minimum horizontal rectangle boundary based on the x-coordinate of the lower left corner and the y-coordinate of the upper right corner; and obtain the coordinates of the lower right corner of the minimum horizontal rectangle boundary based on the x-coordinate of the upper right corner and the x-coordinate of the lower left corner, thereby determining the minimum horizontal rectangle boundary corresponding to geofence P1.
[0065] For example, the server calculates the coordinates of the lower left corner of the third horizontal rectangle boundary corresponding to the geofence based on the vertex coordinates of the n vertices of the geofence, as shown in Formula 1.
[0066]
[0067]
[0068] Where, x min Let y be the x-coordinate of the bottom left corner of the third horizontal rectangle boundary. min The ordinate of the bottom left corner of the third horizontal rectangle boundary is x. i Let y be the smallest x-coordinate among the coordinates of n vertices. i It is the smallest ordinate among the coordinates of n vertices.
[0069] For example, the server calculates the coordinates of the upper right corner of the third horizontal rectangle boundary corresponding to the geofence based on the vertex coordinates of the n vertices of the geofence, as shown in Formula 2.
[0070]
[0071]
[0072] Where, x max Let y be the x-coordinate of the upper right corner of the third horizontal rectangle boundary. max The ordinate of the upper right corner of the third horizontal rectangle boundary is x. i Let y be the maximum x-coordinate among the coordinates of n vertices. i Let x be the maximum ordinate among the n vertices. Therefore, the coordinates of the lower left corner of the third horizontal rectangle boundary can be obtained as (x...). min ,y min The coordinates of the upper right corner are (x... max ,y max ).
[0073] For example, such as Figure 4 As shown, the geofences P1-P3 are defined. The vertex coordinates of P1 are (3, 4), (5, 4), and (4, 6), the vertex coordinates of P2 are (1, 4), (3, 3), (5, 4), and (3, 5), and the vertex coordinates of P3 are (3, 1), (6, 1), (6, 2), and (3, 2). For P1, the server can take the minimum x-coordinate 3 as the x-coordinate of the bottom left corner of the minimum horizontal rectangle boundary corresponding to P1, take the minimum y-coordinate 4 as the y-coordinate of the bottom left corner of the minimum horizontal rectangle boundary, take the maximum x-coordinate 5 as the x-coordinate of the top right corner of the minimum horizontal rectangle boundary, and take the maximum y-coordinate 6 as the y-coordinate of the top right corner of the minimum horizontal rectangle boundary. Thus, the coordinates of the bottom left corner of the minimum horizontal rectangle boundary corresponding to P1 are (3, 4), and the coordinates of the top right corner are (5, 6), thereby obtaining the minimum horizontal rectangle boundary corresponding to P1. The descriptions of the coordinates of the bottom left corner (1, 3) and top right corner (5, 5) of the minimum horizontal rectangle boundary corresponding to geofence P2, and the coordinates of the bottom left corner (3, 1) and top right corner (6, 2) of the minimum horizontal rectangle boundary corresponding to geofence P3, can be found in the description of the server obtaining the minimum horizontal rectangle boundary corresponding to geofence P1, and will not be repeated here. The minimum horizontal rectangle boundaries corresponding to geofences P1-P3 are respectively... Figure 4 It is shown in the middle with a dashed rectangle.
[0074] In some embodiments of this application, the aforementioned third horizontal rectangular boundary is the minimum horizontal rectangular boundary corresponding to each geofence.
[0075] In some embodiments of this application, the server can determine the minimum horizontal rectangle boundary corresponding to each geofence based on the vertex position information of each geofence.
[0076] Step 201a2: The server aggregates the third horizontal rectangular boundaries corresponding to each geofence to obtain the first horizontal rectangular boundaries.
[0077] In some embodiments of this application, the first horizontal rectangular boundary is the smallest horizontal rectangular boundary that includes the third horizontal rectangular boundary corresponding to each geofence.
[0078] In some embodiments of this application, the server can calculate the first horizontal rectangular boundary based on the vertex position information of the third horizontal rectangular boundary corresponding to each geofence.
[0079] For example, suppose there are m third horizontal rectangular boundaries, and the coordinates of the lower left corners of the m third horizontal rectangular boundaries are as follows: The coordinates of the top right corner are as follows: The server can use the smallest x-coordinate among the m bottom-left corner coordinates as the x-coordinate of the bottom-left corner of the first horizontal rectangle boundary; the smallest y-coordinate among the m bottom-left corner coordinates as the y-coordinate of the bottom-left corner of the first horizontal rectangle boundary; the largest x-coordinate among the m top-right corner coordinates as the x-coordinate of the top-right corner of the first horizontal rectangle boundary; and the largest y-coordinate among the m top-right corner coordinates as the y-coordinate of the top-right corner of the first horizontal rectangle boundary; thus, the server can obtain the boundary of the first horizontal rectangle based on these four coordinates.
[0080] For example, the server calculates the coordinates of the lower left corner of the first horizontal rectangle boundary based on the coordinate information of the vertex of the third horizontal rectangle boundary corresponding to each geofence, as shown in Formula 3.
[0081]
[0082]
[0083] Among them, Ax min Let Ay be the x-coordinate of the bottom left corner of the first horizontal rectangle boundary. min The ordinate is the bottom left corner of the first horizontal rectangle boundary. The smallest x-coordinate among m bottom-left corner coordinates. It is the smallest ordinate among the m lower left corner coordinates.
[0084] For example, the server calculates the coordinates of the upper right corner of the first horizontal rectangle boundary based on the coordinate information of the vertices of the third horizontal rectangle boundary corresponding to each geofence, as shown in Formula 4.
[0085]
[0086]
[0087] Among them, Ax max Let Ay be the x-coordinate of the upper right corner of the first horizontal rectangle boundary. max The ordinate is the top-right corner of the first horizontal rectangle boundary. Let x be the largest x-coordinate among the m top-right corner coordinates. Let be the maximum ordinate among the m top-right corner coordinates. Therefore, the coordinate of the bottom-left corner of the first horizontal rectangle boundary can be obtained as (Ax...). min Ay min The coordinates of the upper right corner are (Ax max Ay max ).
[0088] For example, combined with Figure 4 ,like Figure 5 As shown, the server can use the coordinates of the lower left corner (3, 4) and upper right corner (5, 6) of the minimum horizontal rectangle boundary corresponding to P1; the coordinates of the lower left corner (1, 3) and upper right corner (5, 5) of the minimum horizontal rectangle boundary corresponding to P2; and the coordinates of the lower left corner (3, 1) and upper right corner (6, 2) of the minimum horizontal rectangle boundary corresponding to P3. The server can then use the smallest x-coordinate (1) of the lower left corner as the x-coordinate of the lower left corner; the smallest y-coordinate (1) of the lower left corner as the y-coordinate of the lower left corner; the largest x-coordinate (6) of the upper right corner as the x-coordinate of the upper right corner; and the largest y-coordinate (6) of the upper right corner as the y-coordinate of the upper right corner. Based on these four coordinates, the server can obtain the lower left corner coordinates as (1, 1) and the upper right corner coordinates as (6, 6) of the first horizontal rectangle boundary, and thus obtain the first horizontal rectangle boundary 21.
[0089] In this way, the server first calculates the minimum horizontal rectangle boundary corresponding to each geofence, and then aggregates the minimum horizontal rectangle boundaries corresponding to each geofence to obtain the lowest horizontal rectangle boundary including each geofence, i.e. the first horizontal rectangle boundary, thereby improving the server's flexibility in determining the first horizontal rectangle boundary.
[0090] Step 201b: The server determines the second horizontal rectangle boundary based on the location information of at least two electronic devices.
[0091] In some embodiments of this application, the second horizontal rectangular boundary is the smallest horizontal rectangular boundary containing at least two electronic devices, that is, the positions corresponding to the at least two electronic devices are all located within the position area corresponding to the second horizontal rectangular boundary.
[0092] In some embodiments of this application, the locations corresponding to the above-mentioned at least two electronic devices can be understood as the locations of the areas where the electronic devices are located when the server obtains the location information of the electronic devices.
[0093] In some embodiments of this application, the server can determine the second horizontal rectangle boundary based on the coordinate information of each electronic device.
[0094] For example, suppose there is coordinate information for m electronic devices, and the coordinates of the m electronic devices are (x1, y1), (x2, y2)...(x...). m ,y m The server can use the smallest x-coordinate among the m coordinates as the x-coordinate of the lower left corner of the second horizontal rectangle boundary; the smallest y-coordinate among the m coordinates as the y-coordinate of the lower left corner of the second horizontal rectangle boundary; the largest x-coordinate among the m coordinates as the x-coordinate of the upper right corner of the second horizontal rectangle boundary; and the largest y-coordinate among the m coordinates as the y-coordinate of the upper right corner of the second horizontal rectangle boundary. Thus, the server can obtain the boundary of the second horizontal rectangle based on these four coordinates.
[0095] For example, the server determines the coordinates of the lower left corner of the second horizontal rectangle boundary based on the coordinate information of each electronic device, as shown in Formula 5;
[0096]
[0097]
[0098] Among them, Bx min The x-coordinate of the bottom left corner of the second horizontal rectangle boundary, By min The ordinate of the bottom left corner of the second horizontal rectangle boundary is x. i Let y be the minimum x-coordinate among the coordinates of m electronic devices. i Let be the minimum ordinate among the coordinates of m electronic devices.
[0099] For example, the server determines the coordinates of the lower left corner of the second horizontal rectangle boundary based on the coordinate information of each electronic device, as shown in Formula 6;
[0100]
[0101]
[0102] Among them, Bx max The x-coordinate of the upper right corner of the second horizontal rectangle boundary, By max Let x be the ordinate of the upper right corner of the second horizontal rectangle boundary. i Let y be the maximum x-coordinate among the coordinates of m electronic devices. iLet be the maximum ordinate among the coordinates of the m electronic devices. Therefore, the coordinates of the lower left corner of the second horizontal rectangle boundary can be obtained as (Bx...). min By min The coordinates of the upper right corner are (Bx) max By max ).
[0103] For example, such as Figure 6 As shown, assuming at least two electronic devices are P1-P3, with vertex coordinates of P1 being (7, 7), P2 being (2, 2), and P3 being (1, 2), the server can use the smallest x-coordinate 1 as the x-coordinate of the lower left corner of the second horizontal rectangle boundary; the smallest y-coordinate 2 as the y-coordinate of the lower left corner of the second horizontal rectangle boundary; the largest x-coordinate 7 as the x-coordinate of the upper right corner of the second horizontal rectangle boundary; and the largest y-coordinate 7 as the y-coordinate of the upper right corner of the second horizontal rectangle boundary. Thus, based on these four coordinates, the server can obtain the coordinates of the lower left corner of the second horizontal rectangle boundary as (1, 2) and the upper right corner as (7, 7), thereby obtaining the second horizontal rectangle boundary 22.
[0104] It should be noted that when the server executes steps 201a and 201b above, there is no restriction on the execution order of steps 201a and 201b. That is, step 201a can be executed first, followed by step 201b; or step 201b can be executed first, followed by step 201a; or steps 201a and 201b can be executed simultaneously.
[0105] Step 201c: The server aggregates the first horizontal rectangle boundary and the second horizontal rectangle boundary to obtain the target horizontal rectangle boundary.
[0106] In some embodiments of this application, the server can obtain the target horizontal rectangle boundary based on the position information of the first horizontal rectangle boundary and the position information of the second horizontal rectangle boundary.
[0107] For example, the server can obtain the target horizontal rectangle boundary based on the coordinate information of the first horizontal rectangle boundary and the coordinate information of the second horizontal rectangle boundary.
[0108] For example, the coordinates of the lower left corner of the first horizontal rectangle boundary are: (Ax min Ay min The coordinates of the upper right corner are (Ax max Ay max The coordinates of the lower left corner of the second horizontal rectangle boundary are (Bx) min By min The coordinates of the upper right corner are (Bx) max Bymax The server can take the minimum x-coordinate of the two lower-left corner coordinates corresponding to the first and second horizontal rectangle boundaries as the x-coordinate of the lower-left corner of the target horizontal rectangle boundary; take the minimum y-coordinate of the two lower-left corner coordinates as the y-coordinate of the lower-left corner of the target horizontal rectangle boundary; take the maximum x-coordinate of the two upper-right corner coordinates as the x-coordinate of the upper-right corner of the target horizontal rectangle boundary; take the maximum y-coordinate of the two upper-right corner coordinates as the y-coordinate of the upper-right corner of the target horizontal rectangle boundary; thus, the server can obtain the target horizontal rectangle boundary based on these four coordinate information.
[0109] For example, the server obtains the coordinates of the lower left corner of the target horizontal rectangle based on the coordinate information of the first horizontal rectangle boundary and the coordinate information of the second horizontal rectangle boundary, as shown in Formula 7.
[0110] Cx min =min{Ax min Bx min}
[0111] Cy min =min{Ay min By min Formula 7
[0112] Among them, Cx min Cy is the x-coordinate of the bottom left corner of the target horizontal rectangle boundary. min Let Ax be the ordinate of the lower left corner of the target horizontal rectangle boundary. min Let Bx be the x-coordinate of the lower left corner of the first horizontal rectangle boundary. min Ay is the x-coordinate of the lower left corner of the second horizontal rectangle boundary. min The ordinate of the bottom left corner of the first horizontal rectangle boundary, By min The ordinate is the lower left corner of the second horizontal rectangle boundary.
[0113] For example, the server obtains the coordinates of the upper right corner of the target horizontal rectangle based on the coordinate information of the first horizontal rectangle boundary and the coordinate information of the second horizontal rectangle boundary, as shown in Formula 8.
[0114] Cx max =max{Ax max Bx max}
[0115] Cy max =max{Ay max By max Formula 8
[0116] Among them, Cx max Cy is the x-coordinate of the upper right corner of the target horizontal rectangle boundary.max Let Ax be the ordinate of the upper right corner of the target horizontal rectangle boundary. max Let Bx be the x-coordinate of the upper right corner of the first horizontal rectangle boundary. max Ay is the x-coordinate of the upper right corner of the second horizontal rectangle boundary. max The ordinate of the upper right corner of the first horizontal rectangle boundary, By max Let be the ordinate of the upper right corner of the second horizontal rectangle boundary. Therefore, the coordinates of the lower left corner of the target horizontal rectangle boundary can be obtained as (Cx). min Cy min The coordinates of the upper right corner are (Cx) max Cy max ).
[0117] For example, combined with Figure 5 and Figure 6 ,like Figure 7 As shown, the lower left corner coordinates of the first horizontal rectangular boundary 21 are (1, 1), and the upper right corner coordinates are (6, 6). The lower left corner coordinates of the second horizontal rectangular boundary 22 are (1, 2), and the upper right corner coordinates are (7, 7). The server can use the smallest x-coordinate (1) of the two lower left corner coordinates as the x-coordinate of the lower left corner of the target horizontal rectangular boundary; the smallest y-coordinate (1) of the two lower left corner coordinates as the y-coordinate of the lower left corner of the target horizontal rectangular boundary; the largest x-coordinate (7) of the two upper right corner coordinates as the x-coordinate of the upper right corner of the target horizontal rectangular boundary; and the largest y-coordinate (7) of the two upper right corner coordinates as the y-coordinate of the upper right corner of the target horizontal rectangular boundary. Thus, the server can obtain the lower left corner coordinates (1, 1) and the upper right corner coordinates (7, 7) of the target horizontal rectangular boundary based on these four coordinate information, and then obtain the target horizontal rectangular boundary 23.
[0118] Thus, the server calculates a first horizontal rectangular boundary containing at least two geofences using the location information of at least two geofences; and calculates a second horizontal rectangular boundary containing at least two electronic devices using the location information of at least two electronic devices; then the first and second horizontal rectangular boundaries are aggregated to obtain the minimum horizontal rectangular boundary containing at least two geofences and at least two electronic devices, i.e., the target horizontal rectangular boundary, thereby improving the server's flexibility in determining the target horizontal rectangular boundary.
[0119] Step 202: The server divides the target horizontal rectangular boundary to obtain at least one rectangular grid.
[0120] In some embodiments of this application, the server can divide the target horizontal rectangular boundary equally or randomly to obtain at least one rectangular grid.
[0121] For example, the server can divide the length and width of the target horizontal rectangle boundary into K parts, thus obtaining K. 2 A rectangular grid after equal division.
[0122] In some embodiments of this application, a uniformly divided grid can be used (Gx min Gx max Gy min Gy max )express.
[0123] In some embodiments of this application, different rectangular grids represent different partitions, and the data corresponding to different partitions are placed on different machines.
[0124] In some embodiments of this application, step 202 described above can be specifically implemented by step 202a as described below.
[0125] Step 202a: The server divides the target horizontal rectangular boundary into N rectangular grids according to the predetermined number of rectangular grids N.
[0126] In some embodiments of this application, the number N of the predetermined rectangular grid is determined based on the server's processing power.
[0127] In some embodiments of this application, the processing capabilities of the server include at least one of the following: processing speed, amount of data processed, etc.
[0128] In some embodiments of this application, the aforementioned at least two geofences and at least two electronic devices may have uneven geographical distribution. Therefore, if the server divides the target horizontal rectangular boundary evenly, some rectangular grids may contain more data than others, leading to an increase in overall computation time. Therefore, the server can sample the data and partition it into non-uniform rectangular grids based on the sampling results to ensure a balanced amount of data in each rectangular grid, thereby further reducing computation time.
[0129] In this way, by dividing the target horizontal rectangular boundary according to the predetermined number of rectangular grids N, N rectangular grids are obtained, which improves the flexibility and diversity of the server in dividing the target horizontal rectangular boundary.
[0130] Step 203: The server performs spatial location matching between at least one first electronic device contained in the first rectangular grid and at least one first geofence to obtain the spatial location information corresponding to the first rectangular grid.
[0131] In some embodiments of this application, the aforementioned spatial location information includes the location information of a first electronic device contained within each first geofence, and the first rectangular grid is any one of at least one rectangular grid.
[0132] In some embodiments of this application, the first geofence is a geofence in which at least a portion of the area is located within a first rectangular grid; the first electronic device is an electronic device in which at least two electronic devices are located within the first rectangular grid.
[0133] In some embodiments of this application, the location information of the first electronic device contained within each first geofence is the location information of the first electronic device contained within each first geofence within the first rectangular grid.
[0134] In some embodiments of this application, after obtaining at least one rectangular grid, the server can assign at least two geofences and at least two electronic devices to corresponding rectangular grids based on the location information of at least two geofences and the location information of at least two electronic devices, thereby obtaining at least one first electronic device and at least one first geofence contained in each rectangular grid.
[0135] In some embodiments of this application, the server assigns at least two geofences and at least two electronic devices to corresponding rectangular grids, which can be understood as transmitting the data corresponding to the at least two geofences and at least two electronic devices to the partitions corresponding to the corresponding rectangular grids.
[0136] It is understandable that at least two geofences and at least two electronic devices would originally have a default partition. After dividing the area into at least one rectangular grid, each rectangular grid can be assigned a new partition. Since the data of different partitions is placed on different machines, a data transfer is required.
[0137] It should be noted that the specific implementation of the server obtaining at least one first electronic device and at least one first geofence contained in each rectangular grid will be described in the following embodiments, and will not be repeated here.
[0138] In some embodiments of this application, the above spatial location matching can be understood as: matching at least one first electronic device contained in the first rectangular grid with at least one first geofence in pairs, and then determining the positional relationship between a first electronic device and a first geofence in each matching result, such as: inclusion, intersection, separation.
[0139] In some embodiments of this application, the first electronic device included within the first geofence can be understood as the first electronic device being located within the location area of the first geofence, that is, the first electronic device and the first geofence have an inclusion relationship.
[0140] It should be noted that the spatial position matching process for each rectangular grid in at least one rectangular grid can refer to the spatial position matching process for the first rectangular grid, which will not be repeated here.
[0141] In some embodiments of this application, before step 203 above, the location matching method provided in this application embodiment further includes step 301 as described below, and step 203 above can be specifically implemented by steps 203a and 203b as described below.
[0142] Step 301: The server determines the location information of at least one first electronic device and the location information of at least one first geofence based on the location information of at least two geofences, the location information of at least two electronic devices, and the location information of at least one rectangular grid.
[0143] In some embodiments of this application, the server determines the location information of at least one first electronic device and the location information of at least one first geofence, which can also be understood as determining that each rectangular grid contains at least one first electronic device and at least one first geofence.
[0144] In some embodiments of this application, after the server divides at least one rectangular grid, it can compare the location information of at least two geofences and at least two electronic devices with the location information of at least one rectangular grid to obtain the location information of at least one first electronic device and the location information of at least one first geofence in the rectangular grid.
[0145] In some embodiments of this application, the server compares the location information of at least two geofences with the location information of at least one rectangular grid, and the comparison result includes the following two cases:
[0146] Scenario 1: The geofence is located inside a rectangular grid;
[0147] Scenario 2: The geofence spans at least two rectangular grids.
[0148] In some embodiments of this application, if the lower left corner x-coordinate of the minimum horizontal rectangular boundary of a geofence is greater than the lower left corner x-coordinate of a rectangular grid, the upper right corner x-coordinate is less than the upper right corner x-coordinate of a rectangular grid, and the lower left corner y-coordinate of the minimum horizontal rectangular boundary of the geofence is greater than the lower left corner y-coordinate of the rectangular grid, and the upper right corner y-coordinate is less than the upper right corner y-coordinate of the rectangular grid, the server can determine that the geofence is within the rectangular grid.
[0149] For example, when the location information of a certain geofence satisfies the following Formula 9, it is determined that the geofence is inside the rectangular grid, that is, it satisfies Case 1.
[0150] (Gx min ≤x min )&&(Gx max ≥x max )&&(Gy min ≤y min )&&(Gy max ≥y max Formula Nine
[0151] Among them, Gx min Gy represents the lower left x-coordinate of any evenly divided grid. min Gx represents the lower left ordinate of any evenly divided grid. max Gy represents the x-coordinate of the top right corner of any evenly divided grid. max x represents the y-coordinate of the top right corner of any evenly divided grid; min The x-coordinate of the bottom left corner of the smallest horizontal rectangle boundary of a geofence. max The x-coordinate and y-coordinate of the top right corner of the smallest horizontal rectangle boundary of a geofence. min The y-coordinate of the bottom left corner of the smallest horizontal rectangle of a geofence. max The ordinate of the top right corner of the smallest horizontal rectangular boundary of a geofence.
[0152] In some embodiments of this application, if the server determines that the current rectangular grid intersects with another rectangular grid and the current rectangular grid does not contain the entirety of a certain geofence, the server can determine that a certain geofence spans at least two rectangular grids.
[0153] In some embodiments of this application, when the first value is less than the second value and the third value is less than the fourth value, the server determines that the current rectangular grid intersects with another rectangular grid; the first value is the minimum of the lower left horizontal coordinate of the minimum horizontal rectangle boundary of a certain geofence and the lower left horizontal coordinate of the current rectangular grid; the second value is the maximum of the upper right horizontal coordinate of the minimum horizontal rectangle boundary of the certain geofence and the upper right horizontal coordinate of the current rectangular grid; the third value is the minimum of the lower left vertical coordinate of the minimum horizontal rectangle boundary of the certain geofence and the lower left vertical coordinate of the current rectangular grid; and the fourth value is the maximum of the upper right vertical coordinate of the minimum horizontal rectangle boundary of the certain geofence and the upper right vertical coordinate of the current rectangular grid.
[0154] In some embodiments of this application, if the fifth value is not equal to the lower left x-coordinate of the minimum horizontal rectangle boundary of a geofence, the sixth value is not equal to the lower left y-coordinate of the minimum horizontal rectangle boundary of a geofence, the seventh value is not equal to the upper right x-coordinate of the minimum horizontal rectangle boundary of a geofence, and the eighth value is not equal to the upper right y-coordinate of the minimum horizontal rectangle boundary of a geofence, the server determines that the current rectangular grid does not contain the entirety of the geofence. The fifth value is the minimum of the lower left x-coordinate of the minimum horizontal rectangle boundary of the geofence and the lower left x-coordinate of the current rectangular grid; the sixth value is the minimum of the lower left y-coordinate of the minimum horizontal rectangle boundary of the geofence and the lower left y-coordinate of the current rectangular grid; the seventh value is the maximum of the upper right x-coordinate of the minimum horizontal rectangle boundary of the geofence and the upper right x-coordinate of the current rectangular grid; and the eighth value is the maximum of the upper right y-coordinate of the minimum horizontal rectangle boundary of the geofence and the upper right y-coordinate of the current rectangular grid.
[0155] For example, when the location information of a certain geofence satisfies Formulas 10 and 11, it is determined that the geofence spans at least two rectangular grids, i.e., it satisfies Case 2.
[0156]
[0157] When Formula 10 is satisfied, the server can confirm that the current rectangular grid intersects with another rectangular grid.
[0158]
[0159] When Formula 11 is satisfied, the server can confirm that the current rectangular grid does not contain the entirety of a certain geofence.
[0160] In some embodiments of this application, if the horizontal coordinate of the electronic device's location is greater than the lower left horizontal coordinate of an evenly divided grid and less than the upper right horizontal coordinate of that evenly divided grid, and the vertical coordinate of the electronic device's location is greater than the lower left vertical coordinate of that evenly divided grid and less than the upper right vertical coordinate of that evenly divided grid, the server can determine that the electronic device is within the evenly divided grid.
[0161] For example, when the location information of an electronic device satisfies the following formula 12, it is determined that the electronic device is inside a rectangular grid.
[0162] Formula 12:
[0163] (Gx min ≤x)&&(Gx max ≥x)&&(Gy min ≤y)&&(Gymax ≥y)
[0164] Where x is the horizontal coordinate of the electronic device's location, and y is the vertical coordinate of the electronic device's location.
[0165] In some embodiments of this application, when the location information of an electronic device intersects with a rectangular grid, it is confirmed that the electronic device is within the rectangular grid.
[0166] Step 203a: Based on the location information of at least one first electronic device and the location information of at least one first geofence, the server performs pairwise matching between at least one first electronic device and at least one first geofence to obtain at least one matching result.
[0167] In some embodiments of this application, each matching result includes a first electronic device and a first geofence.
[0168] In some embodiments of this application, each matching result is used by the server to subsequently determine the location relationship between a first electronic device and a first geofence contained in each matching result.
[0169] In some embodiments of this application, for situation 2 above, a certain geofence spans at least two rectangular grids. The server can divide the certain geofence and then store the divided geofences in the partitions corresponding to the corresponding rectangular grids.
[0170] In some embodiments of this application, when the server stores the segmented geofences in the partitions corresponding to the corresponding rectangular grids, it can store corresponding tag information to mark the current geofence as a segmented geofence.
[0171] In some embodiments of this application, when a segmented geofence is stored within a rectangular grid, the location information of the segmented geofence is matched pairwise with the location information of at least one first electronic device within the rectangular grid.
[0172] In some embodiments of this application, when the server stores the segmented geofences in the partitions corresponding to the corresponding rectangular grids, it can assign new identifiers to the segmented geofences.
[0173] For example, if geofence P1 is divided into two rectangular grids, the server will assign new identifiers as P1_1 and P2_2.
[0174] Step 203b: The server uses the ray casting method to determine at least one matching result and obtains the spatial location information corresponding to the first rectangular grid.
[0175] In some embodiments of this application, the location information of the first geofence includes: the location information of the area within the first rectangular grid of the first geofence; or, the location information of the entire area of the first geofence.
[0176] In some embodiments of this application, when the server uses the ray casting method to determine at least one matching result, the determination result can be any of the following: the first geofence contains the first electronic device, or the first geofence does not contain the first electronic device, thereby obtaining the location information of the first electronic device contained in each first geofence.
[0177] In some embodiments of this application, when the server outputs the spatial location information corresponding to each first rectangular grid, for the segmented geofence, the original identifier is used to output the location information of the first electronic device contained therein.
[0178] For example, if geofence P1_1 contains the location information of electronic devices X1 and X2, and geofence P1_2 contains the location information of electronic device X3, then the output spatial location information is: geofence P1 contains the location information of electronic devices X1 and X2, and geofence P1 contains the location information of electronic device X3.
[0179] Step 204: The server obtains the target spatial location information based on the spatial location information corresponding to each rectangular grid.
[0180] In some embodiments of this application, the target spatial location information includes the location information of electronic devices contained within each geofence.
[0181] In some embodiments of this application, the server can traverse at least one rectangular grid obtained after partitioning to obtain the location information of electronic devices contained within each geofence included in each rectangular grid, as shown in Table 1.
[0182] Table 1
[0183] Rectangular grid Geofencing electronic devices Does it contain 0 A polygon 1 point 1 true 1 A polygon 1 point 2 false 2 B polygon 2 point 3 true … … … …
[0184] As shown in Table 1, geofence polygon 1 contains electronic device point 1, and geofence polygon 2 contains electronic device point 3.
[0185] In the location matching method provided in this application embodiment, the server calculates the positions of at least two geofences and at least two electronic devices to obtain the target horizontal rectangular boundary. Then, the target horizontal rectangular boundary is divided into at least one regularly shaped rectangular grid. This allows the server to obtain the location information of the electronic devices contained in each geofence by performing spatial location matching between at least one first electronic device contained in each rectangular grid and at least one first geofence. This eliminates the need to match at least two geofences and at least two electronic devices pairwise and then use the ray casting method to determine the pairwise matching results in order to obtain the location information of the electronic devices contained in each geofence. This reduces the time it takes for the server to obtain the location information of the electronic devices contained in the geofence.
[0186] It should be noted that the location matching method provided in this application embodiment can be executed by a location matching device. This application embodiment uses the execution of the location matching method by a location matching device as an example to illustrate the location matching device provided in this application embodiment.
[0187] Figure 8 A schematic diagram of a possible structure of the position matching device involved in an embodiment of this application is shown. For example... Figure 8 As shown, the position matching device 70 may include: a determining module 71, a dividing module 72, a matching module 73, and a processing module 74.
[0188] The system comprises the following modules: a determination module 71, used to determine a target horizontal rectangular boundary based on the location information of at least two geofences and at least two electronic devices; a partitioning module 72, used to partition the target horizontal rectangular boundary determined by the determination module 71 to obtain at least one rectangular grid; a matching module 73, used to perform spatial location matching between at least one first electronic device contained in the first rectangular grid partitioned by the partitioning module 72 and at least one first geofence to obtain spatial location information corresponding to the first rectangular grid, which includes the location information of the first electronic device contained within each first geofence, and the first rectangular grid being any one of the at least one rectangular grid; and a processing module 74, used to obtain target spatial location information based on the spatial location information corresponding to each rectangular grid obtained by the matching module 73, which includes the location information of the electronic device contained within each geofence; wherein, the first geofence is a geofence in which at least a portion of its area is located within the first rectangular grid; and the first electronic device is an electronic device in which at least two electronic devices are located within the first rectangular grid.
[0189] This application provides a location matching device. The location matching device calculates the positions of at least two geofences and at least two electronic devices to obtain a target horizontal rectangular boundary. Then, it divides the target horizontal rectangular boundary into at least one regularly shaped rectangular grid. This allows the location matching device to obtain the location information of the electronic devices contained in each geofence by performing spatial location matching between at least one first electronic device contained in each rectangular grid and at least one first geofence. This eliminates the need to match at least two geofences and at least two electronic devices pairwise and then use a ray casting method to determine the pairwise matching results to obtain the location information of the electronic devices contained in each geofence. This reduces the time required for the location matching device to obtain the location information of the electronic devices contained in the geofences.
[0190] In one possible implementation, the aforementioned determining module 71 is specifically used to determine a first horizontal rectangular boundary based on the location information of at least two geofences; and to determine a second horizontal rectangular boundary based on the location information of at least two electronic devices; and to aggregate the first horizontal rectangular boundary and the second horizontal rectangular boundary to obtain a target horizontal rectangular boundary.
[0191] In one possible implementation, the aforementioned determining module 71 is specifically used to determine the third horizontal rectangular boundary corresponding to each geofence; and to aggregate the third horizontal rectangular boundaries corresponding to each geofence to obtain the first horizontal rectangular boundary.
[0192] In one possible implementation, the determining module 71 is further configured to determine the location information of at least one first electronic device and the location information of at least one first geofence based on the location information of at least two geofences, the location information of at least two electronic devices, and the location information of at least one rectangular grid before the matching module 73 performs spatial location matching between at least one first electronic device and at least one first geofence contained in the first rectangular grid to obtain the spatial location information corresponding to the first rectangular grid.
[0193] The matching module 73 is specifically used to perform pairwise matching between at least one first electronic device and at least one first geofence based on the location information of at least one first electronic device and the location information of at least one first geofence, to obtain at least one matching result, each matching result containing one first electronic device and one first geofence; and to use the ray casting method to determine the at least one matching result to obtain the spatial location information corresponding to the first rectangular grid; wherein, the location information of the first geofence includes: the location information of the area within the first rectangular grid in the first geofence; or, the location information of the entire area of the first geofence.
[0194] In one possible implementation, the aforementioned partitioning module 72 is specifically used to partition the target horizontal rectangular boundary according to a predetermined number of rectangular grids N, resulting in N rectangular grids; wherein the predetermined number of rectangular grids N is determined based on the server's processing capacity.
[0195] The location matching device in the embodiments of this application can be a device, or it can be a component, integrated circuit, or chip in a server.
[0196] The location matching device provided in this application embodiment can implement the various processes implemented in the above method embodiments, and will not be described again here to avoid repetition.
[0197] Figure 9 A schematic diagram of the hardware structure of a server to implement an embodiment of this application.
[0198] This application also provides a server in its embodiments. For example... Figure 9 As shown, the server in this embodiment of the application includes: a processor 91, a transceiver 92, a memory 93, a network interface 94, and a bus interface. Figure 9 In this configuration, the bus architecture can include any number of interconnected buses and bridges, specifically linking various circuits together, represented by one or more processors (processor 91) and memory (memory 93). The bus architecture can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface. The transceiver 92 can be multiple elements, including transmitters and receivers, providing a unit for communicating with various other devices over a transmission medium. Processor 91 is responsible for managing the bus architecture and general processing, and memory 93 can store data used by processor 91 during operation. Additionally, the server includes several functional modules not shown and will not be described further here.
[0199] Specifically, the server also includes instructions or programs stored in memory 93 and executable on processor 91, which are invoked by processor 91 to execute. Figure 8 The methods executed by each module in the process achieve the same technical effect, and to avoid repetition, they will not be described in detail here.
[0200] The processor 91 is configured to: determine a target horizontal rectangular boundary based on the location information of at least two geofences and the location information of at least two electronic devices; divide the target horizontal rectangular boundary to obtain at least one rectangular grid; perform spatial location matching between at least one first electronic device contained in the first rectangular grid and at least one first geofence to obtain spatial location information corresponding to the first rectangular grid, the spatial location information including the location information of the first electronic device contained in each first geofence, the first rectangular grid being any one of the at least one rectangular grid; and obtain target spatial location information based on the spatial location information corresponding to each rectangular grid, the target spatial location information including the location information of the electronic device contained in each geofence; wherein, the first geofence is: a geofence in at least two geofences whose at least part of the area is located within the first rectangular grid; the first electronic device is: an electronic device in at least two electronic devices located within the first rectangular grid.
[0201] This application provides a server that calculates the positions of at least two geofences and at least two electronic devices to obtain a target horizontal rectangular boundary. Then, the target horizontal rectangular boundary is divided into at least one regularly shaped rectangular grid. This allows the server to obtain the location information of electronic devices contained in each geofence by performing spatial location matching between at least one first electronic device contained in each rectangular grid and at least one first geofence. This eliminates the need to match at least two geofences and at least two electronic devices pairwise and then use a ray casting method to determine the pairwise matching results to obtain the location information of electronic devices contained in each geofence. This reduces the time required for the server to obtain the location information of electronic devices contained in geofences.
[0202] The server provided in this application embodiment can implement all the processes implemented in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0203] For details on the beneficial effects of the various implementation methods in this embodiment, please refer to the beneficial effects of the corresponding implementation methods in the above method embodiments. To avoid repetition, these will not be repeated here.
[0204] 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 method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0205] 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.
[0206] 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 method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0207] 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.
[0208] 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 above method embodiments and achieve the same technical effects. To avoid repetition, it will not be described again here.
[0209] 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.
[0210] 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.
[0211] 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 location matching method, characterized in that, The method includes: Determine the horizontal rectangular boundary of the target based on the location information of at least two geofences and at least two electronic devices. The target horizontal rectangular boundary is divided to obtain at least one rectangular grid; Spatial location matching is performed between at least one first electronic device contained in the first rectangular grid and at least one first geofence to obtain spatial location information corresponding to the first rectangular grid. The spatial location information includes the location information of the first electronic device contained in each first geofence. The first rectangular grid is any one of the at least one rectangular grid. Based on the spatial location information corresponding to each of the rectangular grids, target spatial location information is obtained, and the target spatial location information includes the location information of the electronic devices contained within each of the geofences; Wherein, the first geofence is: a geofence in which at least a portion of the area of the at least two geofences is located within the first rectangular grid; the first electronic device is: an electronic device in which the at least two electronic devices are located within the first rectangular grid.
2. The method according to claim 1, characterized in that, Determining the target horizontal rectangular boundary based on the location information of at least two geofences and the location information of at least two electronic devices includes: Based on the location information of the at least two geofences, determine the boundary of the first horizontal rectangle; Based on the location information of the at least two electronic devices, the boundary of the second horizontal rectangle is determined; The first horizontal rectangle boundary and the second horizontal rectangle boundary are aggregated to obtain the target horizontal rectangle boundary.
3. The method according to claim 2, characterized in that, Determining the first horizontal rectangular boundary based on the location information of the at least two geofences includes: Determine the third horizontal rectangle boundary corresponding to each of the geofences; Aggregate the third horizontal rectangular boundaries corresponding to each of the geofences to obtain the first horizontal rectangular boundary.
4. The method according to claim 1, characterized in that, Before performing spatial location matching between at least one first electronic device contained in the first rectangular grid and at least one first geofence to obtain the spatial location information corresponding to the first rectangular grid, the method further includes: Based on the location information of the at least two geofences, the location information of the at least two electronic devices, and the location information of the at least one rectangular grid, the location information of the at least one first electronic device and the location information of the at least one first geofence are determined; The step of spatially matching at least one first electronic device contained in the first rectangular grid with at least one first geofence to obtain spatial location information corresponding to the first rectangular grid includes: Based on the location information of the at least one first electronic device and the location information of the at least one first geofence, the at least one first electronic device and the at least one first geofence are matched in pairs to obtain at least one matching result, and each matching result includes one first electronic device and one first geofence. The at least one matching result is determined using the ray casting method to obtain the spatial location information corresponding to the first rectangular grid; The location information of the first geofence includes: the location information of the area within the first rectangular grid in the first geofence; or, the location information of the entire area of the first geofence.
5. The method according to any one of claims 1 to 4, characterized in that, The step of dividing the target horizontal rectangular boundary to obtain at least one rectangular grid includes: The target horizontal rectangular boundary is divided into N rectangular grids according to a predetermined number N. The number N of the predetermined rectangular grid is determined based on the server's processing power.
6. A position matching device, characterized in that, The device includes: a determining module, a dividing module, a matching module, and a processing module; The determining module is used to determine the target horizontal rectangular boundary based on the location information of at least two geofences and the location information of at least two electronic devices; The partitioning module is used to partition the target horizontal rectangular boundary determined by the determining module to obtain at least one rectangular grid. The matching module is used to perform spatial location matching between at least one first electronic device contained in the first rectangular grid divided by the segmentation module and at least one first geofence, to obtain spatial location information corresponding to the first rectangular grid. The spatial location information includes the location information of the first electronic device contained in each first geofence, and the first rectangular grid is any one of the at least one rectangular grid. The processing module is used to obtain target spatial location information based on the spatial location information corresponding to each rectangular grid obtained by the matching module. The target spatial location information includes the location information of the electronic device contained within each geofence. Wherein, the first geofence is: a geofence in which at least a portion of the area of the at least two geofences is located within the first rectangular grid; the first electronic device is: an electronic device in which the at least two electronic devices are located within the first rectangular grid.
7. The apparatus according to claim 6, characterized in that, The determining module is specifically used to determine a first horizontal rectangular boundary based on the location information of the at least two geofences; and to determine a second horizontal rectangular boundary based on the location information of the at least two electronic devices; and to aggregate the first horizontal rectangular boundary and the second horizontal rectangular boundary to obtain the target horizontal rectangular boundary.
8. The apparatus according to claim 7, characterized in that, The determining module is specifically used to determine the third horizontal rectangular boundary corresponding to each of the geofences; and to aggregate the third horizontal rectangular boundaries corresponding to each of the geofences to obtain the first horizontal rectangular boundary.
9. The apparatus according to claim 6, characterized in that, The determining module is further configured to determine the location information of the at least one first electronic device and the location information of the at least one first geofence based on the location information of the at least two geofences, the location information of the at least two electronic devices, and the location information of the at least one rectangular grid before the matching module performs spatial location matching between the at least one first electronic device contained in the first rectangular grid and the at least one first geofence to obtain the spatial location information corresponding to the first rectangular grid. The matching module is specifically used to perform pairwise matching of the at least one first electronic device and the at least one first geofence based on the location information of the at least one first electronic device and the location information of the at least one first geofence, to obtain at least one matching result, each matching result containing one first electronic device and one first geofence. The at least one matching result is determined using the ray casting method to obtain the spatial location information corresponding to the first rectangular grid. The location information of the first geofence includes: the location information of the area within the first rectangular grid in the first geofence; or, the location information of the entire area of the first geofence.
10. The apparatus according to any one of claims 6 to 9, characterized in that, The partitioning module is specifically used to partition the target horizontal rectangular boundary according to a predetermined number of rectangular grids N, to obtain N rectangular grids; The number N of the predetermined rectangular grid is determined based on the server's processing power.
11. A server, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the position matching method as described in any one of claims 1-5.
12. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the position matching method as described in any one of claims 1-5.
Citation Information
Patent Citations
Method for inquiring a position relation between a positioning point and an electronic fence in a positioning system
CN109800281A
Position tracking processing method and device
CN115439945A