Geofence generation and matching method and device, electronic equipment and storage medium

By finding the intersection hash rectangles of the target area step by step and generating geofences, the problems of large amount of geofence data and large amount of matching calculations in the prior art are solved, and a fast and accurate geofence generation and efficient matching process is achieved.

CN119396938APending Publication Date: 2025-02-07SHANGHAI HUACE NAVIGATION TECH +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411496802.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In the prior art, the geofence generation method generates a large amount of geofence data, occupy a lot of storage space, and the geofence matching calculation is large, and the calculation time is long.

Method used

By searching the intersection hash rectangle of the target area step by step, determining the target intersection hash rectangle based on the current level and the target accuracy, then generating a geofence, and using the geo hash coding and geofence of the position point to be matched The fence hash code matches.

Benefits of technology

It realizes the rapid and accurate generation of target area geofences with small amounts of data, reduces the storage memory requirements of geofence data, and improves the system response and matching speed of geofence matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396938A_ABST
    Figure CN119396938A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a geo-fence generation and matching method and device, electronic equipment and a storage medium. The method comprises the steps that intersecting hash rectangles of a target area are searched step by step according to the sequence of levels from high to low; for the searched intersecting Hash rectangles of each level, after the intersecting Hash rectangles of the current level are found, determining target intersecting Hash rectangles based on the intersecting Hash rectangles of the current level and target accuracy; and determining a fence hash code corresponding to the target area based on the target intersection hash rectangle, and generating a geo-fence of the target area based on the fence hash code, wherein the intersected Hash rectangles are geographical Hash rectangles intersected with the boundary of the target area, the area represented by the highest-level geographical Hash rectangle is the largest, and the area represented by the lowest-level geographical Hash rectangle is the smallest. According to the embodiment of the invention, the geo-fences of the target area with relatively small data volume can be quickly and accurately generated, and the matching process of the geo-fences can be quickly and efficiently carried out with relatively small calculation amount.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for generating and matching geographic fences. Background Art

[0002] Geofence is a virtual geographical boundary drawn by humans. When a device with corresponding functions enters the geofence area, a response can be triggered so that the user can take corresponding measures. Geofence can be used in scenarios such as smart grazing, monitoring children's activity areas, returning shared bicycles, preventing product counterfeiting, and setting up drone no-fly zones.

[0003] The geo-fence data generated by the geo-fence generation method in the prior art is mostly floating point data. Because the amount of geo-fence data is large, it takes up too much storage space when deployed on embedded devices, and when matching geo-fences, the amount of calculation required for matching floating point data is too large and the calculation time is too long. Summary of the invention

[0004] The embodiments of the present invention provide a geo-fence generation and matching method, device, electronic device and storage medium, which can quickly and accurately generate a target area geo-fence with a small amount of data, and can make the geo-fence matching process fast and efficient with a small amount of calculation.

[0005] In a first aspect, an embodiment of the present invention provides a method for generating a geo-fence, comprising: searching for intersecting hash rectangles of a target area in order from high to low levels;

[0006] For the intersecting hash rectangles of each level being searched, after finding the intersecting hash rectangle of the current level, determining a target intersecting hash rectangle based on the intersecting hash rectangle of the current level and a target accuracy; and

[0007] Determine a fence hash code corresponding to the target area based on the target intersection hash rectangle, and generate a geo-fence of the target area based on the fence hash code;

[0008] The intersecting hash rectangle is a geographic hash rectangle that intersects with the boundary of the target area. The highest-level geographic hash rectangle represents the largest area, and the lowest-level geographic hash rectangle represents the smallest area.

[0009] In a second aspect, an embodiment of the present invention provides a geo-fence matching method, including:

[0010] Obtaining a hash code to be matched based on the geographic hash code of the location point to be matched; and

[0011] The matching result between the location point to be matched and the geo-fence is determined based on the hash code to be matched and the fence hash code corresponding to the geo-fence, and the geo-fence is any geo-fence described in any embodiment of the present invention.

[0012] In a third aspect, an embodiment of the present invention provides a device for generating a geographic fence, including:

[0013] A search module is used to search for intersecting hash rectangles of the target area in descending order of levels;

[0014] a target intersection hash rectangle acquisition module, configured to determine a target intersection hash rectangle based on the intersection hash rectangles at the current level and a target accuracy after finding the intersection hash rectangles at the current level for the intersection hash rectangles at each level; and

[0015] A geo-fence generation module, used to determine a fence hash code corresponding to the target area based on the target intersection hash rectangle, and generate a geo-fence of the target area based on the fence hash code;

[0016] The intersecting hash rectangle is a geographic hash rectangle that intersects with the boundary of the target area. The highest-level geographic hash rectangle represents the largest area, and the lowest-level geographic hash rectangle represents the smallest area.

[0017] In a fourth aspect, an embodiment of the present invention provides a geo-fence matching device, including:

[0018] A code acquisition module, used to acquire a hash code to be matched based on the geographic hash code of the location point to be matched; and

[0019] A matching module is used to determine the matching result between the location point to be matched and the geo-fence based on the hash code to be matched and the fence hash code corresponding to the geo-fence, and the geo-fence is any geo-fence described in the embodiments of the present invention.

[0020] In the fifth aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a geo-fence generation method or a geo-fence matching method as described in any one of the embodiments of the present invention is implemented.

[0021] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a geo-fence generation method or a geo-fence matching method as described in any one of the embodiments of the present invention.

[0022] The embodiments of the present invention provide a method, device, electronic device and storage medium for generating and matching geo-fences. The method searches for intersecting hash rectangles of a target area in descending order, determines the target intersecting hash rectangle based on the location points and target accuracy of the intersecting hash rectangles of the current level, and further determines the fence hash code corresponding to the target area based on the geo-hash code of the target intersecting hash rectangle, thereby generating a geo-fence. The method can quickly and accurately generate a geo-fence of a target area with a small amount of data, reduce the storage memory required for geo-fence data, and help improve the system response and matching speed for geo-fence matching. The embodiments of the present invention are also based on the generated geo-fence. By determining the matching result of the geo-fence based on the hash code to be matched corresponding to the location point to be matched and the fence hash code corresponding to the geo-fence, the geo-fence can be matched quickly and efficiently with a small amount of calculation. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0024] Figure 1 is a flow chart of a method for generating a geographic fence provided by an embodiment of the present invention;

[0025] Figure 2 is another flowchart of the method for generating a geographic fence provided by an embodiment of the present invention;

[0026] Figure 3 is another flowchart of the method for generating a geographic fence provided by an embodiment of the present invention;

[0027] Figure 4 is a flowchart of a geographic fence matching method provided by an embodiment of the present invention;

[0028] Figure 5 is another flowchart of the geo-fence matching method provided by an embodiment of the present invention;

[0029] Figure 6 is a structural schematic diagram of a geographic fence generating device provided by an embodiment of the present invention;

[0030] Figure 7 is a structural schematic diagram of a geographic fence matching device provided by an embodiment of the present invention;

[0031] Figure 8 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0034] Figure 1 The present invention provides a flowchart of a method for generating a geo-fence according to an embodiment of the present invention. The method can be executed by a device for generating a geo-fence according to an embodiment of the present invention. The device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated into an electronic device, such as a computer, a server, etc. The following embodiments will be described by taking the device integrated into an electronic device as an example. Figure 1 , the method may specifically include the following steps:

[0035] Step 101, searching for intersecting hash rectangles of the target area in descending order of levels. This step can quickly and accurately search for intersecting hash rectangles at the boundary of the target area required for generating a geo-fence.

[0036] Specifically, the intersecting hash rectangles are geographic hash rectangles that intersect with the boundary of the target area. The highest-level geographic hash rectangle represents the largest area, and the lowest-level geographic hash rectangle represents the smallest area.

[0037] Specifically, the highest level of the above-mentioned intersecting hash rectangle is the circumscribed hash rectangle of the above-mentioned target area. Specifically, the above-mentioned geographic hash rectangle represents a rectangular area represented by a geographic hash (Geohash) code.

[0038] Specifically, the target area is a closed area, which may be a geographical area, such as an urban area, a residential area, a supermarket, and the like.

[0039] Specifically, the boundary data of the target area may be obtained from a map database, or may be manually drawn in a GeoJSON data format.

[0040] Optionally, before step 101, the maximum longitude and latitude and the minimum longitude and latitude of the target area are obtained, and step 101 includes obtaining a circumscribed hash rectangle of the target area based on the maximum longitude and latitude and the minimum longitude and latitude to obtain a first-level intersecting hash rectangle.

[0041] Optionally, the above process of searching for the intersecting hash rectangles of the target area step by step in order from high to low levels includes: when searching for the intersecting hash rectangles of the current level, judging whether each geographic hash rectangle within the intersecting hash rectangle of the previous level intersects with the boundary of the target area; and determining the intersecting hash rectangle of the current level based on the judgment result.

[0042] In an optional specific example, the process of searching for second-level intersecting hash rectangles includes: after obtaining a 2-digit first-level intersecting hash rectangle based on the maximum longitude and latitude and the minimum longitude and latitude of the target area, that is, the circumscribed hash rectangle of the target area, the 32 3-digit second-level geographic hash rectangles included in the 2-digit first-level intersecting hash rectangle are compared with a predetermined area, and it is determined whether the 32 3-digit second-level geographic hash rectangles intersect with the boundary of the target area respectively; if so, the corresponding second-level geographic hash rectangle is determined as a second-level intersecting hash rectangle; searching for third-level intersecting hash that is too long includes: comparing the 32 4-digit third-level geographic hash rectangles included in the 3-digit second-level intersecting hash rectangle with a predetermined area, and it is determined whether the 32 third-level geographic hash rectangles intersect with the boundary of the target area respectively; if so, the corresponding third-level geographic hash rectangle is determined as a third-level intersecting hash rectangle, and so on.

[0043] Step 102, for each level of intersecting hash rectangles searched, after finding the intersecting hash rectangle of the current level, determine the target intersecting hash rectangle based on the intersecting hash rectangle of the current level and the target accuracy. This step can help determine the fence hash code corresponding to the target area based on the target intersecting hash rectangle.

[0044] Specifically, the target accuracy can be understood as an error distance. Specifically, the error distance includes an error distance when the geo-fence exceeds the boundary of the target area, and an error distance when the geo-fence does not reach the boundary of the target area within the target area.

[0045] Specifically, the target intersection hash rectangle may be each of the found intersection hash rectangles, or may be the lowest level of the found intersection hash rectangle.

[0046] Specifically, the minimum distance between each of the above position points and the boundary of the target area may be a straight-line distance, or a longitude distance and a latitude distance.

[0047] Optionally, the process of determining the target intersecting hash rectangle based on the intersecting hash rectangles of the current level and the target precision includes: determining the target intersecting hash rectangle based on the size of the intersecting hash rectangles of the current level and the target precision.

[0048] Optionally, when the above-mentioned target intersection rectangle is each of the intersection hash rectangles found, the above-mentioned process of determining the target intersection hash rectangle based on the intersection hash rectangle of the current level and the target accuracy includes: when the maximum internal distance is not less than the error distance corresponding to the target accuracy, the intersection hash rectangle of the current level is determined as the above-mentioned target intersection hash rectangle.

[0049] Optionally, when the above-mentioned target intersection rectangle is the lowest level intersection hash rectangle found, the process of determining the target intersection hash rectangle based on the intersection hash rectangle of the current level and the target precision includes: when the current level is the first level where the maximum internal distance of the corresponding intersection hash rectangle is less than the error distance corresponding to the target precision, the intersection hash rectangle of the current level is determined as the above-mentioned target intersection hash rectangle.

[0050] Step 103, determine the fence hash code corresponding to the target area based on the target intersection hash rectangle, and generate the geo-fence of the target area based on the fence hash code. This step is based on steps 101 to 102, by searching for the intersection hash rectangle of the target area step by step in order from high to low levels, and determining the target intersection hash rectangle based on each position point and target accuracy of the intersection hash rectangle of the current level, and further determining the fence hash code corresponding to the target area based on the geo-hash code of the target intersection hash rectangle, and then generating the geo-fence, which can quickly and accurately generate the geo-fence of the target area with a small amount of data, reduce the storage memory required for geo-fence data, and help improve the system response and matching speed of geo-fence matching.

[0051] Optionally, the process of determining the fence hash code corresponding to the target area based on the target intersection hash rectangle includes: acquiring the geographic hash code of each target intersection hash rectangle, obtaining the target hash code, and determining the fence hash code based on the target hash code.

[0052] Optionally, the process of determining the fence hash code corresponding to the target area based on the target intersecting hash rectangle includes: after obtaining the target intersecting hash rectangle, ending the search, and obtaining the geographic hash codes of all the intersecting hash rectangles found to obtain the target hash code.

[0053] Optionally, the process of determining the fence hash code based on the target hash code includes compressing each target hash code to obtain the fence hash code.

[0054] Optionally, the above-mentioned generating a geo-fence of the target area based on the fence hash code includes: encrypting the fence hash code to obtain the geo-fence.

[0055] Optionally, the process of encrypting the fence hash code to obtain the geo-fence includes: encrypting the fence hash code based on the Advanced Encryption Standard (AES) to obtain the geo-fence.

[0056] Specifically, the fence hash code is encrypted to ensure the security and stability of the fence data.

[0057] The following further describes the method for generating a geographic fence provided by an embodiment of the present invention. Figure 2 As shown, Figure 1 Step 102 in may include the following steps:

[0058] Step 1021, determining a boundary distance threshold based on the target accuracy.

[0059] Optionally, the process of determining the boundary distance threshold based on the target accuracy includes: determining the error distance corresponding to the target accuracy as the boundary distance threshold.

[0060] Optionally, the process of determining the boundary distance threshold based on the target accuracy includes: calculating the product of the error distance corresponding to the target accuracy and the accuracy calibration coefficient to obtain the boundary distance threshold.

[0061] Specifically, when matching the fence and the location point, there may be errors in the positioning of the positioning target. Therefore, the error distance corresponding to the target accuracy is calibrated using the accuracy calibration coefficient to obtain the above-mentioned boundary distance threshold, which can help ensure the accuracy of subsequent matching.

[0062] Step 1022, when the minimum distance between each position point of each intersecting hash rectangle of the current level and the boundary of the target area is less than the boundary distance threshold, the search is terminated, and each intersecting hash rectangle found is determined as the target intersecting hash rectangle.

[0063] Step 1023, when the minimum distance between each position point of each intersecting hash rectangle of the current level and the boundary of the target area is not less than the boundary distance threshold, continue searching, and determine the target intersecting hash rectangle based on the minimum distance between each position point of each intersecting hash rectangle of the next level and the boundary of the target area.

[0064] The embodiment of the present invention determines whether to end the search for intersecting hash rectangles based on the minimum distance between each location point of the intersecting hash rectangle of the current level and the boundary of the target area, as well as the boundary distance threshold, thereby ensuring the accuracy of using the intersecting hash rectangle to represent the boundary of the target area, thereby facilitating the rapid and accurate generation of a target area geographic fence with a small amount of data.

[0065] The following further introduces the method for generating a geographic fence provided by an embodiment of the present invention, wherein the target intersecting hash rectangle includes each intersecting hash rectangle found.

[0066] Optional, such as Figure 3 As shown, Figure 1 Step 103 in the method may include the following steps:

[0067] Step 1031, obtain the geographic hash codes of each target intersection hash rectangle and the edge hash rectangles in the same domain as each target intersection hash rectangle to obtain the target hash code.

[0068] Specifically, the edge hash rectangles in the same domain as each target intersection hash rectangle are geographic hash rectangles at the same level as the current target intersection hash rectangle and located in the intersection area of ​​the previous level target intersection hash rectangle and the target area.

[0069] In an optional specific example, the 2-digit geographic hash code of the first-level target intersection hash rectangle, the 3-digit geographic hash code of the second-level target intersection hash rectangle, the 4-digit geographic hash code of the third-level target intersection hash rectangle are obtained in sequence... until all target hash rectangles are acquired, and the 3-digit geographic hash code of the second-level intra-domain edge hash rectangle, the 4-digit geographic hash code of the third-level intra-domain edge hash rectangle are acquired in sequence... until all intra-domain edge hash rectangles are acquired to obtain the above-mentioned target hash codes.

[0070] Specifically, since the 2-bit first-level target hash rectangle is the circumscribed hash rectangle of the target area and there is no corresponding edge hash rectangle in the same domain, there is no need to obtain the geographic hash code of the first-level edge hash rectangle in the domain.

[0071] Optionally, the target hash code is obtained by obtaining edge hash rectangles in the same domain as each target intersection hash rectangle, a circumscribed geographic hash rectangle of the target area, and geographic hash codes of other target intersection hash rectangles except the lowest level target intersection hash rectangle.

[0072] Step 1032: Obtain a fence hash code based on the target hash code.

[0073] Optionally, the process of obtaining the fence hash code based on the target hash code includes: determining the target hash code as the fence hash code.

[0074] Optionally, the process of obtaining the fence hash code based on the target hash code includes: converting the encoded data of the last bit of the target hash code into hexadecimal data to obtain a hexadecimal conversion hash code, and obtaining the fence hash code based on the hexadecimal conversion hash code.

[0075] Optionally, the process of converting the encoded data of the last bit of the target hash code into hexadecimal data to obtain the fence hash code corresponding to each target hash code includes:

[0076] For the binary data of the geo-hash codes of the 3-digit second-level target intersection hash rectangle and the second-level intra-domain edge hash rectangle, only the first 2 bits of the binary data of the geo-hash codes are retained, and the third bit of the binary data of the geo-hash codes is converted into hexadecimal data;

[0077] For the 4-bit binary data of the geohash code of the third-level target intersection hash rectangle and the third-level intra-domain edge hash rectangle, only the first 3 bits of the binary data of the geohash code are retained, and the fourth bit of the binary data of the geohash code is converted into hexadecimal data;

[0078] And so on, until the conversion of the geo-hash codes of the lowest-level target intersection hash rectangle and the intra-domain edge hash rectangle is completed.

[0079] The embodiment of the present invention obtains the geographic hash codes of the target intersecting hash rectangle and the edge hash rectangle in the same domain of the target hash rectangle, and obtains the fence hash code based on the corresponding geographic hash code, which can facilitate more convenient and accurate matching of the geographic fence and the location point in the subsequent process. The embodiment of the present invention further converts the encoded data of the last bit of the geographic hash code of the target hash code into hexadecimal data, which can further compress the data volume of the geographic fence data, so as to further reduce the storage memory required for the geographic fence data, thereby facilitating further improving the system response and matching speed for geographic fence matching.

[0080] Figure 4The present invention provides a flowchart of a geo-fence matching method according to an embodiment of the present invention. The method can be performed by a geo-fence matching device according to an embodiment of the present invention. The device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated into an electronic device, such as a computer, a server, etc. The following embodiments will be described by taking the device integrated into an electronic device as an example. Figure 4 , the method may specifically include the following steps:

[0081] Step 401: Obtain a hash code to be matched based on the geographic hash code of the location point to be matched.

[0082] Optionally, the process of obtaining the hash code to be matched based on the geographic hash code of the location point to be matched includes: obtaining the geographic hash code of the geographic hash rectangle where the location point to be matched is located, and determining the geographic hash code as the hash code to be matched.

[0083] Optionally, the process of obtaining the hash code to be matched based on the geographic hash code of the location point to be matched includes: obtaining the geographic hash code of the geographic hash rectangle where the location point to be matched is located, and then converting the last digit of the geographic hash code into hexadecimal data to obtain the hash code to be matched.

[0084] Step 402, determining a matching result between the location point to be matched and the geo-fence based on the hash code to be matched and the fence hash code corresponding to the geo-fence, where the geo-fence is the geo-fence in any embodiment of the present invention.

[0085] Specifically, the matching result between the location point to be matched and the geo-fence indicates whether the location point to be matched is within the area included in the geo-fence. If the matching result between the location point to be matched and the geo-fence does not match, it means that the location point to be matched is not within the area included in the geo-fence, otherwise it means that the location point to be matched is within the area included in the geo-fence.

[0086] The following further describes the geo-fence matching method provided by the embodiment of the present invention. Figure 5 As shown, Figure 4 Step 402 in includes:

[0087] Step 4021, searching in ascending order of the value of n whether there are hash codes corresponding to the first n characters of the hash code to be matched in the fence hash code, where 1<n≤m, m is the number of characters of the hash code to be matched; and

[0088] Step 4022, determining the matching result based on the search results corresponding to the first n characters.

[0089] Optionally, the above process of determining the matching result based on the retrieval results corresponding to the first n characters includes: when the retrieval result corresponding to the first n characters is a hash code corresponding to the first n characters that does not exist in the fence hash code, determining that the matching result is not a match; and when the retrieval result corresponding to the first n characters is a hash code corresponding to the first n characters that exists in the fence hash code, determining whether the location point to be matched matches the geographic fence based on the retrieval results corresponding to the first n+1 characters.

[0090] Optionally, if n=m, that is, the first n characters are all characters of the hash code to be matched, when the corresponding search result is that the corresponding hash code exists in the fence hash code, the matching result is determined to be a match.

[0091] The geo-fence matching method provided by the embodiment of the present invention can match the geo-fence quickly and efficiently with a small amount of calculation by matching the location point to be matched with the geo-fence based on the geo-fence provided by the embodiment of the present invention. Furthermore, when the location point to be matched and the geo-fence do not match, the embodiment of the present invention only needs to retrieve the previous characters to determine the matching result without searching all the characters, which can further reduce the amount of calculation and improve the matching efficiency.

[0092] Figure 6 is a structural diagram of a device for generating a geographic fence according to an embodiment of the present invention, and the device is suitable for executing a method for generating a geographic fence according to an embodiment of the present invention. Figure 6 As shown, the device may specifically include:

[0093] The search module 601 is used to search for intersecting hash rectangles of the target area in descending order. Specifically, this module can quickly and accurately search for the intersecting hash rectangles at the boundary of the target area required for generating the geo-fence.

[0094] Specifically, the intersecting hash rectangles are geographic hash rectangles that intersect with the boundary of the target area. The highest-level geographic hash rectangle represents the largest area, and the lowest-level geographic hash rectangle represents the smallest area.

[0095] Optionally, the search module 601 can be specifically used to determine whether each geographic hash rectangle in the previous level of intersecting hash rectangles intersects with the boundary of the target area when searching for the current level of intersecting hash rectangles; and determine the current level of intersecting hash rectangles based on the determination result.

[0096] The target intersection hash rectangle acquisition module 602 is used to determine the target intersection hash rectangle based on the intersection hash rectangle of the current level and the target accuracy after finding the intersection hash rectangle of the current level. This module can help determine the fence hash code corresponding to the target area based on the determined target intersection hash rectangle.

[0097] Optionally, the above-mentioned target intersecting hash rectangle acquisition module 602 can be specifically used to determine a boundary distance threshold based on the target accuracy; when the minimum distance between each position point of each intersecting hash rectangle at the current level and the boundary of the target area is less than the boundary distance threshold, the search is terminated, and each intersecting hash rectangle found is determined as a target intersecting hash rectangle; when the minimum distance between each position point of each intersecting hash rectangle at the current level and the boundary of the target area is not less than the boundary distance threshold, the search is continued, and the target intersecting hash rectangle is determined based on the minimum distance between each position point of each intersecting hash rectangle at the next level and the boundary of the target area.

[0098] The geo-fence generation module 603 is used to determine the fence hash code corresponding to the target area based on the target intersecting hash rectangle, and to generate the geo-fence of the target area based on the fence hash code. This module is combined with modules 601 and 602, and can search for the intersecting hash rectangles of the target area step by step in order from high to low levels, and determine the target intersecting hash rectangle based on the various position points and target accuracy of the intersecting hash rectangles of the current level, and further determine the fence hash code corresponding to the target area based on the geo-hash code of the target intersecting hash rectangle, and then generate the geo-fence, which can quickly and accurately generate the geo-fence of the target area with a small amount of data, reduce the storage memory required for geo-fence data, and help improve the system response and matching speed of geo-fence matching.

[0099] Optionally, the geo-fence generation module 603 can be specifically used to obtain the geo-hash codes of each target intersection hash rectangle and the edge hash rectangles in the same domain of each target intersection hash rectangle to obtain the target hash code; and obtain the fence hash code based on the target hash code.

[0100] Optionally, the geo-fence generation module 603 can be specifically used to convert the encoded data of the last bit of the target hash code into hexadecimal data to obtain a hexadecimal conversion hash code, and obtain a fence hash code based on the hexadecimal conversion hash code.

[0101] Optionally, the geo-fence generation module 603 can be specifically used to encrypt the fence hash code to obtain the geo-fence.

[0102] Figure 7is a structural diagram of a geo-fence matching device provided in an embodiment of the present invention, and the device is suitable for executing the geo-fence matching method provided in an embodiment of the present invention. Figure 7 As shown, the device may specifically include:

[0103] The code acquisition module 701 is used to acquire the hash code to be matched based on the geographic hash code of the location point to be matched.

[0104] Optionally, the code acquisition module 701 can be specifically used to: acquire the geographic hash code of the geographic hash rectangle where the to-be-matched location is located, to obtain the geographic hash code of the to-be-matched location.

[0105] The matching module 702 is used to determine the matching result between the location point to be matched and the geo-fence based on the hash code to be matched and the fence hash code corresponding to the geo-fence. The geo-fence is the geo-fence in any embodiment of the present invention.

[0106] Optionally, the matching module 702 can be specifically used to search, in ascending order of the value of n, whether there are hash codes corresponding to the first n characters of the hash code to be matched in the fence hash code, where 1<n≤m, and m is the number of characters of the hash code to be matched; and determine the matching result based on the search result corresponding to the first n characters.

[0107] Optionally, the above-mentioned matching module 702 can be specifically used to determine that the matching result is not a match when the retrieval result corresponding to the first n characters is a hash code corresponding to the first n characters that does not exist in the fence hash code; and when the retrieval result corresponding to the first n characters is a hash code corresponding to the first n characters that exists in the fence hash code, determine whether the location point to be matched matches the geographic fence based on the retrieval result corresponding to the first n+1 characters.

[0108] The geo-fence matching device provided by the embodiment of the present invention can match the geo-fence quickly and efficiently with a small amount of calculation by matching the location point to be matched with the geo-fence based on the geo-fence provided by the embodiment of the present invention. Furthermore, when the location point to be matched and the geo-fence do not match, the embodiment of the present invention only needs to retrieve the previous characters to determine the matching result without searching all the characters, which can further reduce the amount of calculation and improve the matching efficiency.

[0109] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0110] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the geo-fence generation method or the geo-fence matching method provided in any of the above embodiments is implemented.

[0111] An embodiment of the present invention further provides a computer-readable medium having a computer program stored thereon, and when the program is executed by a processor, the geo-fence generation method or the geo-fence matching method provided in any of the above embodiments is implemented.

[0112] An embodiment of the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements a geo-fence generation method or a geo-fence matching method as described in any one of the embodiments of the present invention.

[0113] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of an electronic device suitable for implementing an embodiment of the present invention. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0114] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0115] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0116] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.

[0117] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0118] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0119] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be set in a processor, for example, may be described as: a processor including a search module, a target intersection hash rectangle acquisition module, and a geo-fence generation module; or may be described as: a processor including a code acquisition module and a matching module. The names of these modules do not, in some cases, constitute limitations on the modules themselves.

[0120] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements: searching for intersecting hash rectangles of the target area step by step in order from high to low levels; for the intersecting hash rectangles of each level searched, after finding the intersecting hash rectangle of the current level, determining the target intersecting hash rectangle based on the intersecting hash rectangle of the current level and the target accuracy; and determining the fence hash code corresponding to the target area based on the target intersecting hash rectangle, and generating the geographic fence of the target area based on the fence hash code; wherein the intersecting hash rectangle is a geographic hash rectangle that intersects with the boundary of the target area, the highest level geographic hash rectangle represents the largest area, and the lowest level geographic hash rectangle represents the smallest area.

[0121] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for generating a geographic fence, characterized in that: include: Search for intersecting hash rectangles of the target area in descending order; For the intersecting hash rectangles of each level being searched, after finding the intersecting hash rectangle of the current level, determining a target intersecting hash rectangle based on the intersecting hash rectangle of the current level and the target accuracy; as well as Determine a fence hash code corresponding to the target area based on the target intersection hash rectangle, and generate a geo-fence of the target area based on the fence hash code; The intersecting hash rectangle is a geographic hash rectangle that intersects with the boundary of the target area. The highest-level geographic hash rectangle represents the largest area, and the lowest-level geographic hash rectangle represents the smallest area.

2. The method for generating a geographic fence according to claim 1, characterized in that: The step of searching for intersecting hash rectangles of the target area in order from high to low levels includes: When searching for the intersecting hash rectangles of the current level, determining whether each geographic hash rectangle within the intersecting hash rectangle of the previous level intersects with the boundary of the target area; and The intersecting hash rectangle of the current level is determined based on the determination result.

3. The method for generating a geographic fence according to claim 1, characterized in that: The determining of the target intersection hash rectangle based on the intersection hash rectangle of the current level and the target accuracy includes: determining a boundary distance threshold based on the target accuracy; When the minimum distance between each position point of each intersecting hash rectangle of the current level and the boundary of the target area is less than the boundary distance threshold, the search is terminated, and each intersecting hash rectangle found is determined as the target intersecting hash rectangle; and When the minimum distance between each position point of each intersecting hash rectangle of the current level and the boundary of the target area is not less than the boundary distance threshold, continue searching, and determine the target intersecting hash rectangle based on the minimum distance between each position point of each intersecting hash rectangle of the next level and the boundary of the target area.

4. The method for generating a geographic fence according to claim 1, characterized in that: The target intersecting hash rectangle includes each of the intersecting hash rectangles found, and determining the fence hash code corresponding to the target area based on the target intersecting hash rectangle includes: Obtaining the geographic hash codes of each target intersection hash rectangle and the edge hash rectangles in the same domain as each target intersection hash rectangle to obtain the target hash code; and Obtain the fence hash code based on the target hash code; Among them, the edge hash rectangles in the same domain of each target intersection hash rectangle are geographic hash rectangles at the same level as the current target intersection hash rectangle and located in the intersection area of ​​the previous level target intersection hash rectangle of the current target intersection hash rectangle and the target area.

5. The method for generating a geographic fence according to claim 4, characterized in that: The obtaining the fence hash code based on the target hash code includes: The encoded data of the last bit of the target hash code is converted into hexadecimal data to obtain a hexadecimal conversion hash code, and the fence hash code is obtained based on the hexadecimal conversion hash code.

6. The method for generating a geographic fence according to claim 1, characterized in that: The generating the geo-fence of the target area based on the fence hash code comprises: The fence hash code is encrypted to obtain the geographic fence.

7. A geographic fence matching method, characterized in that: include: Obtaining a hash code to be matched based on the geographic hash code of the location point to be matched; as well as The matching result between the location point to be matched and the geo-fence is determined based on the hash code to be matched and the fence hash code corresponding to the geo-fence, and the geo-fence is the geo-fence described in any one of claims 1 to 6.

8. The geographic fence matching method according to claim 7, characterized in that: The determining a matching result between the location point to be matched and the geo-fence based on the hash code to be matched and the fence hash code corresponding to the geo-fence includes: In order of the value of n from small to large, searching in sequence whether the hash codes corresponding to the first n characters of the hash code to be matched exist in the fence hash code, where 1<n≤m, and m is the number of characters of the hash code to be matched; when the search result corresponding to the first n characters is that the hash codes corresponding to the first n characters do not exist in the fence hash code, determining that the matching result is not a match; and When the retrieval result corresponding to the first n characters is that the hash code corresponding to the first n characters exists in the fence hash code, it is determined whether the to-be-matched location point matches the geographic fence based on the retrieval result corresponding to the first n+1 characters.

9. A geographic fence generation device, characterized in that: include: A search module is used to search for intersecting hash rectangles of the target area in descending order of levels; A target intersection hash rectangle acquisition module is used to determine a target intersection hash rectangle based on the intersection hash rectangle of the current level and the target accuracy after finding the intersection hash rectangle of the current level for the intersection hash rectangles of each level; as well as A geo-fence generation module, used to determine a fence hash code corresponding to the target area based on the target intersection hash rectangle, and generate a geo-fence of the target area based on the fence hash code; The intersecting hash rectangle is a geographic hash rectangle that intersects with the boundary of the target area. The highest-level geographic hash rectangle represents the largest area, and the lowest-level geographic hash rectangle represents the smallest area.

10. A geographic fence matching device, characterized in that: include: A code acquisition module, used for acquiring a hash code to be matched based on a geographic hash code of a location point to be matched; as well as A matching module is used to determine the matching result between the location point to be matched and the geo-fence based on the hash code to be matched and the fence hash code corresponding to the geo-fence, and the geo-fence is the geo-fence described in any one of claims 1 to 6.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements the geo-fence generation method as described in any one of claims 1 to 6, or implements the geo-fence matching method as described in any one of claims 7 to 8.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, it implements the geo-fence generation method as described in any one of claims 1 to 6, or implements the geo-fence matching method as described in any one of claims 7 to 8.

Citation Information

Cited By

  • A tail-aware gated dual-view sequential recommendation method for long-tail data distribution

    CN122796297A