Position relationship determination method and apparatus, and computer-readable storage medium
Patent Information
- Application Number
- CN202310842175.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-10
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-07-10
AI Technical Summary
[0003]该方案中需要进行图形学算法计算,计算所需的时间较长,导致确定目标位置与目标区域之间的位置关系的速度较慢
Smart Images

Figure CN116866838B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and in particular to methods, apparatus and computer-readable storage media for determining positional relationships. Background Technology
[0002] To determine the positional relationship between a target location and a target region, one existing method is based on a computer graphics algorithm and a Cartesian product matrix between the target location and the target region to determine the positional relationship between them.
[0003] This approach requires computation using computer graphics algorithms, which takes a long time and results in a slow speed in determining the positional relationship between the target location and the target area. Summary of the Invention
[0004] This application provides a method, apparatus, and computer-readable storage medium for determining positional relationships, which can reduce the time required to determine the positional relationship between a target location and a target area, and improve the speed of determining the positional relationship between a target location and a target area.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] Firstly, a method for determining positional relationships is provided. The method includes: obtaining the target GeoHash code of the target location and the positional information of the target region boundary; the precision of the target GeoHash code is a preset precision; dividing the target region into multiple GeoHash grid sets according to the positional information of the target region boundary, resulting in multiple GeoHash grid code sets; each GeoHash grid code set corresponds to a different precision, the precision of the first GeoHash grid code set is the preset precision, and the first GeoHash grid code set is the GeoHash grid code set with the highest corresponding precision among the multiple GeoHash grid code sets; determining the positional relationship between the target location and the target region based on the target GeoHash code and the multiple GeoHash grid code sets.
[0007] Based on this scheme, multiple GeoHash grid encoding sets of the target region are obtained based on the location information of the target region boundary. The positional relationship between the target and the target region is determined according to the target GeoHash encoding and the multiple GeoHash grid encoding sets. Compared with existing schemes that determine the positional relationship between the target location and the target region based on graphics algorithms and the Cartesian product matrix between the target location and the target region, this application's scheme, by dividing the target region into multiple GeoHash grids of different precision, can minimize the number of GeoHash grids in the target region, thereby reducing the number of calculations and ultimately reducing the time required to determine the positional relationship between the target location and the target region, thus improving the speed of determining the positional relationship between the target location and the target region.
[0008] In conjunction with the first aspect, in some embodiments of the first aspect, the target region is divided into multiple GeoHash grid encoding sets based on the location information of the target region boundary to obtain multiple GeoHash grid encoding sets, including: determining the location information of the minimum bounding rectangle of the target region based on the location information of the target region boundary and a spatial function; and dividing the target region into multiple GeoHash grid sets based on the location information of the target region boundary and the location information of the minimum bounding rectangle to obtain multiple GeoHash grid encoding sets.
[0009] Based on this scheme, it is possible to divide the target area into multiple GeoHash grid sets according to the location information of the target area boundary, thereby obtaining multiple GeoHash grid encoding sets.
[0010] In conjunction with the first aspect, in some embodiments of the first aspect, the target region is divided into multiple GeoHash grid sets based on the location information of the target region boundary and the location information of the minimum bounding rectangle, resulting in multiple GeoHash grid encoding sets. This includes: determining the initial precision corresponding to the second GeoHash grid encoding set based on the side length of the long side of the minimum bounding rectangle; the second GeoHash grid encoding set is the GeoHash grid encoding set with the lowest corresponding precision among the multiple GeoHash grid encoding sets, and the second GeoHash grid encoding set is included in the multiple GeoHash grid encoding sets, with a side length not exceeding three times the grid length corresponding to the initial precision; and dividing the target region into multiple GeoHash grid sets based on the location information of the target region boundary, the location information of the minimum bounding rectangle, and the initial precision, resulting in multiple GeoHash grid encoding sets.
[0011] Based on this scheme, it is possible to divide the target region into multiple GeoHash grid sets according to the location information of the target region boundary and the location information of the minimum bounding rectangle, thereby obtaining multiple GeoHash grid encoding sets.
[0012] In conjunction with the first aspect, in some embodiments of the first aspect, determining the positional relationship between a target location and a target region based on a target GeoHash code and multiple GeoHash grid code sets includes: comparing a specified GeoHash code in the target GeoHash code with each GeoHash grid code in each GeoHash grid code set to obtain multiple comparison results; the precision of the specified GeoHash code is the same as the precision corresponding to each GeoHash grid code set; and determining the positional relationship between the target location and the target region based on the multiple comparison results.
[0013] Based on this scheme, it is possible to determine the positional relationship between the target location and the target region according to the target GeoHash code and multiple GeoHash grid code sets.
[0014] Secondly, a positional relationship determination apparatus is provided for implementing the positional relationship determination method of the first aspect described above. This positional relationship determination apparatus includes modules, units, or means corresponding to the above method. These modules, units, or means can be implemented in hardware, software, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions.
[0015] In conjunction with the second aspect, in some embodiments of the second aspect, the positional relationship determination device includes: an acquisition module and a processing module; the acquisition module is used to acquire the target GeoHash code of the target location and the positional information of the target region boundary; the precision of the target GeoHash code is a preset precision; the processing module is used to divide the target region into multiple GeoHash grid sets according to the positional information of the target region boundary, thereby obtaining multiple GeoHash grid code sets; each GeoHash grid code set corresponds to a different precision, the precision of the first GeoHash grid code set is the preset precision, and the first GeoHash grid code set is the GeoHash grid code set with the highest corresponding precision among the multiple GeoHash grid code sets; the processing module is also used to determine the positional relationship between the target location and the target region according to the target GeoHash code and the multiple GeoHash grid code sets.
[0016] In conjunction with the second aspect, in some embodiments of the second aspect, the processing module is used to divide the target region into multiple GeoHash grid encoding sets based on the location information of the target region boundary, thereby obtaining multiple GeoHash grid encoding sets, including: determining the location information of the minimum bounding rectangle of the target region based on the location information of the target region boundary and a spatial function; dividing the target region into multiple GeoHash grid sets based on the location information of the target region boundary and the location information of the minimum bounding rectangle, thereby obtaining multiple GeoHash grid encoding sets.
[0017] In conjunction with the second aspect, in some embodiments of the second aspect, the processing module is further configured to divide the target region into multiple GeoHash grid sets based on the location information of the target region boundary and the location information of the minimum bounding rectangle, thereby obtaining multiple GeoHash grid encoding sets, including: determining the initial precision corresponding to the second GeoHash grid encoding set based on the side length of the long side of the minimum bounding rectangle; the second GeoHash grid encoding set is the GeoHash grid encoding set with the lowest corresponding precision among the multiple GeoHash grid encoding sets, and the second GeoHash grid encoding set is included in the multiple GeoHash grid encoding sets, with a side length not exceeding 3 times the grid length corresponding to the initial precision; dividing the target region into multiple GeoHash grid sets based on the location information of the target region boundary, the location information of the minimum bounding rectangle, and the initial precision, thereby obtaining multiple GeoHash grid encoding sets.
[0018] In conjunction with the second aspect, in some embodiments of the second aspect, the processing module is further configured to determine the positional relationship between the target location and the target region based on the target GeoHash code and multiple GeoHash grid code sets, including: comparing a specified GeoHash code in the target GeoHash code with each GeoHash grid code in each GeoHash grid code set to obtain multiple comparison results; the precision of the specified GeoHash code is the same as the precision corresponding to each GeoHash grid code set; and determining the positional relationship between the target location and the target region based on the multiple comparison results.
[0019] Thirdly, a positional relationship determination apparatus is provided, comprising: at least one processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method provided by the first aspect and any possible implementation thereof.
[0020] Fourthly, a computer-readable storage medium is provided, wherein when instructions in the computer-readable storage medium are executed by a processor of a positional relationship determination device, the positional relationship determination device is enabled to perform the method provided by the first aspect and any possible implementation thereof.
[0021] Fifthly, a computer program product containing instructions is provided that, when run on a computer, enables the computer to perform the methods provided in the first aspect and any possible implementation thereof.
[0022] In a sixth aspect, a chip system is provided, comprising: a processor and an interface circuit; the interface circuit being configured to receive a computer program or instructions and transmit them to the processor; the processor being configured to execute the computer program or instructions to cause the chip system to perform the methods provided in the first aspect and any possible embodiments thereof.
[0023] The technical effects of any one of the second to sixth aspects can be found in the technical effects of the different embodiments of the first aspect described above, and will not be repeated here. Attached Figure Description
[0024] Figure 1 This application provides a schematic diagram of the architecture of a positional relationship determination system;
[0025] Figure 2 A flowchart illustrating a method for determining positional relationships provided in this application;
[0026] Figure 3 An example diagram of a set of multiple GeoHash grids provided in this application;
[0027] Figure 4 A flowchart illustrating yet another method for determining positional relationships provided in this application;
[0028] Figure 5 A flowchart illustrating yet another method for determining positional relationships provided in this application;
[0029] Figure 6 A flowchart illustrating yet another method for determining positional relationships provided in this application;
[0030] Figure 7 A flowchart illustrating yet another method for determining positional relationships provided in this application;
[0031] Figure 8 A schematic diagram of a positional relationship determination device provided in this application;
[0032] Figure 9 A schematic diagram of another positional relationship determination device provided in this application. Detailed Implementation
[0033] In the description of this application, unless otherwise stated, "multiple" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0034] Furthermore, to facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.
[0035] In this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being better or more advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner to facilitate understanding.
[0036] It is understood that the term "embodiment" used throughout the specification means that a specific feature, structure, or characteristic related to an embodiment is included in at least one embodiment of this application. Therefore, various embodiments throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It is understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0037] It is understood that in this application, "when," "if," and "if" all refer to the corresponding processing that will be carried out under certain objective circumstances, and are not limited to a specific time, nor do they require that there must be a judgment action when implemented, nor do they imply any other limitations.
[0038] It is understood that some optional features in the embodiments of this application can be implemented independently in certain scenarios without relying on other features, such as the current solution on which they are based, to solve the corresponding technical problems and achieve the corresponding effects. Alternatively, they can be combined with other features as needed in certain scenarios. Correspondingly, the apparatus given in the embodiments of this application can also implement these features or functions, which will not be elaborated here.
[0039] In this application, unless otherwise specified, the same or similar parts between the various embodiments can be referred to each other. In the various embodiments and implementation methods of the various embodiments in this application, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments and between the implementation methods of the various embodiments are consistent and can be mutually referenced. The technical features in different embodiments and between the implementation methods of the various embodiments can be combined according to their inherent logical relationships to form new embodiments, implementation methods, implementation methods, or implementation approaches. The following embodiments of this application do not constitute a limitation on the scope of protection of this application.
[0040] Figure 1 This is a schematic diagram of the architecture of a positional relationship determination system provided in this application. The technical solutions of the embodiments of this application can be applied to... Figure 1 The positional relationship determination system shown is as follows: Figure 1 As shown, the position relationship determination system 10 includes a position relationship determination device 11 and an electronic device 12.
[0041] The location relationship determination device 11 is directly or indirectly connected to the electronic device 12. The connection can be wired or wireless, and this application embodiment does not limit the connection.
[0042] The position relationship determination device 11 can be used to receive data from the electronic device 12.
[0043] Electronic device 12 can be used to send data to location relationship determination device 11.
[0044] It should be noted that the position relationship determination device 11 and the electronic device 12 can be independent devices or integrated into the same device; this application does not make specific limitations in this regard.
[0045] When the position determination device 11 and the electronic device 12 are integrated into the same device, the communication method between the position determination device 11 and the electronic device 12 is the communication between modules within the device. In this case, the communication process between the two is the same as that when the position determination device 11 and the electronic device 12 are independent of each other.
[0046] In the following embodiments provided in this application, the position relationship determination device 11 and the electronic device 12 are described as being set up independently of each other.
[0047] In practical applications, the position relationship determination method provided in this application embodiment can be applied to the position relationship determination device 11, or to the devices included in the position relationship determination device 11.
[0048] The position relationship determination method provided in this application embodiment will be described below with reference to the accompanying drawings, taking the application of the position relationship determination method to the position relationship determination device 11 as an example.
[0049] Figure 2 A flowchart illustrating a method for determining positional relationships provided in this application is shown below. Figure 2 As shown, the method includes the following steps:
[0050] S201, The location relationship determination device obtains the target GeoHash code of the target location and the location information of the target area boundary.
[0051] The target GeoHash encoding precision is a preset precision.
[0052] It should be noted that the preset precision can be GeoHash level 7, or GeoHash level 8, or GeoHash level 9. Of course, the preset precision can also have other levels of precision, and this application does not make any specific restrictions on this.
[0053] Taking GeoHash level 7 precision as an example, the target GeoHash code can be wx4gjk3, wx4gjk4, or wx4gjk5. This application does not impose any specific restrictions on this.
[0054] The target area can be a city, an industrial park, or a scenic area. Of course, the target area can also be other areas, and this application does not impose any specific restrictions on this.
[0055] The location information of the boundary can be the latitude and longitude of multiple key points on the boundary.
[0056] As one possible implementation method, combined Figure 1 The location relationship determination device receives a message from an electronic device, which includes the target GeoHash code of the target location and the location information of the target area boundary. The location relationship determination device obtains the target GeoHash code of the target location and the location information of the target area boundary from the message.
[0057] As another possible implementation method, combined with Figure 1 The location relationship determination device receives a message from an electronic device, which includes the latitude and longitude of the target location and the location information of the target area boundary. The location relationship determination device obtains the location information of the target area boundary from the message and converts the latitude and longitude of the target location into the target GeoHash code.
[0058] It should be noted that, in this possible implementation, the specific implementation scheme of the location relationship determination device converting the latitude and longitude of the target location into the target GeoHash code can refer to existing schemes, and will not be described in this application.
[0059] S202, The positional relationship determination device divides the target area into multiple GeoHash grid sets based on the positional information of the target area boundary, and obtains multiple GeoHash grid encoding sets.
[0060] Each GeoHash grid encoding set has a different precision. The precision of the first GeoHash grid encoding set is a preset precision. The first GeoHash grid encoding set is the GeoHash grid encoding set with the highest precision among multiple GeoHash grid encoding sets.
[0061] It should be noted that, taking the preset precision of GeoHash level 7 as an example, if there are 4 GeoHash grid encoding sets, then among the multiple GeoHash grid encoding sets, one GeoHash grid encoding set can correspond to GeoHash level 4 precision, another GeoHash grid encoding set can correspond to GeoHash level 5 precision, yet another GeoHash grid encoding set can correspond to GeoHash level 6 precision, and the first GeoHash grid encoding set corresponds to GeoHash level 6 precision.
[0062] Figure 3 An example of a collection of multiple GeoHash grids provided in this application, such as Figure 3As shown, the target area is divided into four GeoHash grid sets: GeoHash grid set A, GeoHash grid set B, GeoHash grid set C, and GeoHash grid set D. GeoHash grid set A includes four GeoHash grids with the same precision: GeoHash grid A1, GeoHash grid A2, GeoHash grid A3, and GeoHash grid A4. GeoHash grid set B includes four GeoHash grids with the same precision: GeoHash grid B1, GeoHash grid B2, GeoHash grid B3, GeoHash grid B4, GeoHash grid B5, GeoHash grid B6, GeoHash grid B7, GeoHash grid B8, GeoHash grid B9, GeoHash grid B10, GeoHash grid B11, GeoHash grid B12, GeoHash grid B13, GeoHash grid B14, GeoHash grid B15, GeoHash grid B16, GeoHash grid B17, GeoHash grid B18, GeoHash grid B1 ...9, GeoHash grid B11, GeoH 2. GeoHash grids B3 and B4, GeoHash grid set C includes 4 GeoHash grids with the same precision, namely GeoHash grid C1, GeoHash grid C2, GeoHash grid C3, and GeoHash grid C4. GeoHash grid set D includes 4 GeoHash grids with the same precision, namely GeoHash grid D1, GeoHash grid D2, GeoHash grid D3, and GeoHash grid D4. Each GeoHash grid has a unique GeoHash grid code.
[0063] As one possible implementation, the position relationship determination device determines the position information of the minimum bounding rectangle of the target region based on the position information of the target region boundary and the spatial function, and divides the target region into multiple GeoHash grid sets based on the position information of the target region boundary and the position information of the minimum bounding rectangle, thus obtaining multiple GeoHash grid encoding sets.
[0064] It should be noted that the specific implementation scheme of this possible implementation method can be referred to the relevant description in the following part of the detailed implementation method of this application, and will not be repeated here.
[0065] S203, The positional relationship determination device determines the positional relationship between the target location and the target area based on the target GeoHash code and multiple GeoHash grid code sets.
[0066] It should be noted that the positional relationship between the target location and the target area can be either that the target location is outside the target area, or that the target location is within the target area.
[0067] As one possible implementation, the positional relationship determination device compares a specified GeoHash code in the target GeoHash code with each GeoHash grid code in each GeoHash grid code set to obtain multiple comparison results, and determines the positional relationship between the target and the target area based on the multiple comparison results.
[0068] It should be noted that the specific implementation scheme of this possible implementation method can be referred to the relevant description in the following part of the detailed implementation method of this application, and will not be repeated here.
[0069] Based on this scheme, multiple GeoHash grid encoding sets of the target region are obtained based on the location information of the target region boundary. The positional relationship between the target and the target region is determined according to the target GeoHash encoding and the multiple GeoHash grid encoding sets. Compared with existing schemes that determine the positional relationship between the target location and the target region based on graphics algorithms and the Cartesian product matrix between the target location and the target region, this application's scheme, by dividing the target region into multiple GeoHash grids of different precision, can minimize the number of GeoHash grids in the target region, thereby reducing the number of calculations and ultimately reducing the time required to determine the positional relationship between the target location and the target region, thus improving the speed of determining the positional relationship between the target location and the target region.
[0070] The above is a general description of the positional relationship determination method provided in this application. The following will provide a further explanation of the positional relationship determination method provided in this application in conjunction with the accompanying drawings.
[0071] In one design, Figure 4 A flowchart illustrating another method for determining positional relationships provided in this application is shown below. Figure 4 As shown, S202 provided in the specific embodiments of this application may specifically include the following steps:
[0072] S401, The positional relationship determination device determines the positional information of the minimum bounding rectangle of the target area based on the positional information of the target area boundary and the spatial function.
[0073] As one possible implementation, taking the latitude and longitude of multiple key points on the boundary as the location information of the boundary as an example, the location relationship determination device inputs the latitude and longitude of multiple key points on the boundary of the target area into a spatial function to obtain the location information of the minimum bounding rectangle of the target area.
[0074] It should be noted that the specific implementation scheme of this possible method can refer to existing schemes, and will not be described in this application.
[0075] S402, The position relationship determination device divides the target area into multiple GeoHash grid sets based on the position information of the target area boundary and the position information of the minimum bounding rectangle, and obtains multiple GeoHash grid encoding sets.
[0076] As one possible implementation, the position relationship determination device determines the initial precision of the second GeoHash grid encoding set with the lowest precision among multiple GeoHash grid encoding sets based on the side length of the longest side of the minimum bounding rectangle. Based on the position information of the target region boundary, the position information of the minimum bounding rectangle, and the initial precision, the target region is divided into multiple GeoHash grid sets, thus obtaining multiple GeoHash grid encoding sets.
[0077] It should be noted that the specific implementation scheme of this possible implementation method can be referred to the relevant description in the following part of the detailed implementation method of this application, and will not be repeated here.
[0078] Based on this scheme, it is possible to divide the target area into multiple GeoHash grid sets according to the location information of the target area boundary, thereby obtaining multiple GeoHash grid encoding sets.
[0079] In one design, Figure 5 A flowchart illustrating another method for determining positional relationships provided in this application is shown below. Figure 5 As shown, S402 provided in the specific embodiments of this application may specifically include the following steps:
[0080] S501, The positional relationship determination device determines the initial precision corresponding to the second GeoHash grid encoding set based on the side length of the longest side of the smallest circumscribed rectangle.
[0081] The second GeoHash grid encoding set is the GeoHash grid encoding set with the lowest precision among multiple GeoHash grid encoding sets. The second GeoHash grid encoding set is included in multiple GeoHash grid encoding sets, and its side length does not exceed 3 times the grid length corresponding to the initial precision.
[0082] As one possible implementation, taking the length of the longest side of the smallest bounding rectangle as 100 kilometers (km) as an example, the position relationship determination device determines that 100km does not exceed 3 times the grid length corresponding to the initial accuracy. Based on the one-to-one correspondence between multiple accuracies and multiple grid lengths, the position relationship determination device determines that the initial accuracy can be GeoHash 4 level accuracy.
[0083] It should be noted that the specific explanation of the one-to-one correspondence between multiple precisions and multiple grid lengths can be found in existing solutions, and will not be elaborated here.
[0084] S502, The positional relationship determination device divides the target area into multiple GeoHash grid sets based on the positional information of the target area boundary, the positional information of the minimum bounding rectangle, and the initial precision, thereby obtaining multiple GeoHash grid encoding sets.
[0085] As one possible implementation, taking an initial precision of GeoHash level 4 as an example, the first step is that the position relationship determination device divides the minimum bounding rectangle into multiple GeoHash grids with a precision of GeoHash level 4 from the lower left corner to the right until the rightmost end of the minimum bounding rectangle. Then, the position relationship determination device divides the minimum bounding rectangle into a GeoHash grid with a precision of GeoHash level 4 from the GeoHash grid at the lower left corner of the minimum bounding rectangle, and then divides it into multiple GeoHash grids with a precision of GeoHash level 4 to the right again until the rightmost end of the minimum bounding rectangle. The position relationship determination device divides the minimum bounding rectangle into multiple GeoHash grids with a precision of GeoHash level 4 in sequence.
[0086] In the second step, the position relationship determination device discards the GeoHash grid outside the target area boundary and retains the GeoHash grid inside the target area boundary. Following a similar step to the first step above, the GeoHash grid on the target area boundary is divided into multiple GeoHash grids with a precision of GeoHash level 5.
[0087] The third step involves the location relationship determination device discarding the GeoHash grid outside the target area boundary and retaining the GeoHash grid inside the target area boundary. Following a similar process to the first step, the GeoHash grid on the target area boundary is divided into multiple GeoHash grids with a precision of GeoHash level 6.
[0088] In the fourth step, the positional relationship determination device discards the GeoHash grid outside the target area boundary and retains the GeoHash grid inside the target area boundary. Following a similar step to the first step above, the GeoHash grid on the target area boundary is divided into multiple GeoHash grids with a precision of GeoHash level 7.
[0089] The fifth step involves the location relationship determination device determining the GeoHash grid code of each GeoHash grid within the boundary of the target area, and grouping GeoHash grid codes with the same precision into the same GeoHash grid code set, resulting in 4 GeoHash grid code sets.
[0090] Based on this scheme, it is possible to divide the target region into multiple GeoHash grid sets according to the location information of the target region boundary and the location information of the minimum bounding rectangle, thereby obtaining multiple GeoHash grid encoding sets.
[0091] In one design, Figure 6 A flowchart illustrating another method for determining positional relationships provided in this application is shown below. Figure 6 As shown, S203 provided in the specific embodiments of this application may specifically include the following steps:
[0092] S601, the position relationship determination device compares the specified GeoHash code in the target GeoHash code with each GeoHash grid code in each GeoHash grid code set to obtain multiple comparison results.
[0093] The precision of the GeoHash encoding is specified to be the same as the precision corresponding to each GeoHash grid encoding set.
[0094] It should be noted that if the precision of a GeoHash grid encoding set is GeoHash level 4, then the precision of the specified GeoHash encoding to be compared with the GeoHash grid encoding in that GeoHash grid encoding set is also GeoHash level 4. For example, if the target GeoHash encoding is wx4gjk3, then the specified GeoHash encoding is wx4g.
[0095] If a GeoHash grid encoding set corresponds to a precision of GeoHash level 5, then the precision of the specified GeoHash encoding compared with the GeoHash grid encoding in that GeoHash grid encoding set is also GeoHash level 5. For example, if the target GeoHash encoding is wx4gjk3, then the specified GeoHash encoding is wx4gj.
[0096] The comparison result can be either that the specified GeoHash code is the same as the GeoHash grid code, or that the specified GeoHash code is not the same as the GeoHash grid code.
[0097] As one possible implementation, the positional relationship determination device compares each GeoHash grid code in each GeoHash grid code set with the corresponding specified GeoHash code in the target GeoHash code, and obtains multiple comparison results.
[0098] As another possible implementation, the positional relationship determination device compares each GeoHash grid code in each GeoHash grid code set with a specified GeoHash code in the target GeoHash code set in ascending order of precision, until a comparison result shows that the specified GeoHash code is the same as the GeoHash grid code, resulting in multiple comparison results. Alternatively, it continues until the comparison of each GeoHash grid code in the entire GeoHash grid code set with the specified GeoHash code in the target GeoHash code is completed, resulting in multiple comparison results.
[0099] S602, The positional relationship determination device determines the positional relationship between the target position and the target area based on multiple comparison results.
[0100] As one possible implementation, if among multiple comparison results the specified GeoHash code and the GeoHash grid code are different, the positional relationship determination device determines the positional relationship between the target location and the target area as the target location is outside the target area. If among multiple comparison results the specified GeoHash code and the GeoHash grid code are the same, the positional relationship determination device determines the positional relationship between the target location and the target area as the target location is within the target area.
[0101] Based on this scheme, it is possible to determine the positional relationship between the target location and the target region according to the target GeoHash code and multiple GeoHash grid code sets.
[0102] Figure 7 A flowchart illustrating another method for determining positional relationships provided in this application is shown below. Figure 7 As shown, the method for determining positional relationships includes the following steps:
[0103] S701, The position relationship determination device obtains the target GeoHash code of the target position.
[0104] It should be noted that the specific description of S701 can be found in the relevant description of S201 above, and will not be repeated here.
[0105] S702, The position relationship determination device acquires the position information of the target area boundary.
[0106] It should be noted that the specific description of S702 can be found in the relevant description of S201 above, and will not be repeated here.
[0107] S703, The positional relationship determination device determines the positional information of the minimum bounding rectangle of the target area based on the positional information of the target area boundary and the spatial function.
[0108] It should be noted that the specific description of S703 can be found in the relevant description of S401 above, and will not be repeated here.
[0109] S704, The positional relationship determination device determines the initial precision corresponding to the second GeoHash grid encoding set based on the side length of the longest side of the smallest circumscribed rectangle.
[0110] It should be noted that the specific description of S704 can be found in the relevant description of S501 above, and will not be repeated here.
[0111] S705, the position relationship determination device divides the target area into multiple GeoHash grid sets based on the position information of the target area boundary, the position information of the minimum bounding rectangle, and the initial precision, thereby obtaining multiple GeoHash grid encoding sets.
[0112] It should be noted that the specific description of S705 can be found in the relevant description of S502 above, and will not be repeated here.
[0113] S706, the position relationship determination device compares the specified GeoHash code in the target GeoHash code with each GeoHash grid code in each GeoHash grid code set to obtain multiple comparison results.
[0114] It should be noted that the specific description of S706 can be found in the relevant description of S601 above, and will not be repeated here.
[0115] S707, The positional relationship determination device determines the positional relationship between the target position and the target area based on multiple comparison results.
[0116] It should be noted that the specific description of S707 can be found in the relevant description of S602 above, and will not be repeated here.
[0117] The above mainly describes the solution provided by the embodiments of this application from the perspective of the position relationship determination device executing the position relationship determination method. To achieve the above functions, the position relationship determination device includes hardware structures and / or software modules corresponding to each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0118] This application embodiment can divide the position relationship determination device into functional modules according to the above method example. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. Optionally, the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation. Furthermore, "module" here can refer to an application-specific integrated circuit (ASIC), a circuit, a processor and memory executing one or more software or firmware programs, integrated logic circuits, and / or other devices that can provide the above functions.
[0119] When using functional module division Figure 8 A schematic diagram of a positional relationship determination device is shown. Figure 8 As shown, the position relationship determination device 80 includes an acquisition module 801 and a processing module 802.
[0120] In some embodiments, the position relationship determination device 80 may further include a storage module ( Figure 8 (Not shown in the image) is used to store program instructions and data.
[0121] The acquisition module 801 is used to acquire the target GeoHash code of the target location and the location information of the target region boundary; the precision of the target GeoHash code is a preset precision. The processing module is used to divide the target region into multiple GeoHash grid sets according to the location information of the target region boundary, thereby obtaining multiple GeoHash grid code sets; each GeoHash grid code set corresponds to a different precision, the precision of the first GeoHash grid code set is the preset precision, and the first GeoHash grid code set is the GeoHash grid code set with the highest precision among the multiple GeoHash grid code sets. The processing module is also used to determine the positional relationship between the target location and the target region based on the target GeoHash code and the multiple GeoHash grid code sets.
[0122] Optionally, the processing module 802 is used to divide the target region into multiple GeoHash grid encoding sets based on the location information of the target region boundary, thereby obtaining multiple GeoHash grid encoding sets, including: determining the location information of the minimum bounding rectangle of the target region based on the location information of the target region boundary and the spatial function; dividing the target region into multiple GeoHash grid sets based on the location information of the target region boundary and the location information of the minimum bounding rectangle, thereby obtaining multiple GeoHash grid encoding sets.
[0123] Optionally, the processing module 802 is further configured to divide the target region into multiple GeoHash grid sets based on the location information of the target region boundary and the location information of the minimum bounding rectangle, thereby obtaining multiple GeoHash grid encoding sets, including: determining the initial precision corresponding to the second GeoHash grid encoding set based on the side length of the long side of the minimum bounding rectangle; the second GeoHash grid encoding set is the GeoHash grid encoding set with the lowest corresponding precision among the multiple GeoHash grid encoding sets, and the second GeoHash grid encoding set is included in the multiple GeoHash grid encoding sets, with a side length not exceeding 3 times the grid length corresponding to the initial precision; dividing the target region into multiple GeoHash grid sets based on the location information of the target region boundary, the location information of the minimum bounding rectangle, and the initial precision, thereby obtaining multiple GeoHash grid encoding sets.
[0124] Optionally, the processing module 802 is further configured to determine the positional relationship between the target location and the target region based on the target GeoHash code and multiple GeoHash grid code sets, including: comparing a specified GeoHash code in the target GeoHash code with each GeoHash grid code in each GeoHash grid code set to obtain multiple comparison results; the precision of the specified GeoHash code is the same as the precision corresponding to each GeoHash grid code set; and determining the positional relationship between the target location and the target region based on the multiple comparison results.
[0125] All relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0126] When the functions of the above modules are implemented in hardware... Figure 9 A schematic diagram of a positional relationship determination device is shown. Figure 9 As shown, the position relationship determination device 90 includes a processor 901, a memory 902, and a bus 903. The processor 901 and the memory 902 can be connected via the bus 903.
[0127] Processor 901 is the control center of the position determination device 90. It can be a single processor or a collective term for multiple processing elements. For example, processor 901 can be a general-purpose central processing unit (CPU) or other general-purpose processors. Among them, the general-purpose processor can be a microprocessor or any conventional processor.
[0128] As one embodiment, processor 901 may include one or more CPUs, for example Figure 9 CPU 0 and CPU 1 are shown in the diagram.
[0129] The memory 902 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0130] As one possible implementation, the memory 902 can exist independently of the processor 901. The memory 902 can be connected to the processor 901 via a bus 903 and is used to store instructions or program code. When the processor 901 calls and executes the instructions or program code stored in the memory 902, it can implement the positional relationship determination method provided in the embodiments of this application.
[0131] In another possible implementation, the memory 902 can also be integrated with the processor 901.
[0132] Bus 903 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0133] It should be pointed out that, Figure 9 The structure shown does not constitute a limitation on the positional relationship determining device 90. Except... Figure 9 In addition to the components shown, the positional relationship determining device 90 may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0134] As an example, combined Figure 8The functions implemented by the acquisition module 801 and the processing module 802 in the position relationship determination device 80 are the same as those of the acquisition module 801 and the processing module 802. Figure 9 The processor 901 in it has the same function.
[0135] Optional, such as Figure 9 As shown, the position relationship determination device 90 provided in this application embodiment may further include a communication interface 904.
[0136] Communication interface 904 is used to connect with other devices via a communication network. This communication network can be Ethernet, a wireless access network, a wireless local area network (WLAN), etc. Communication interface 904 may include a receiving unit for receiving data and a transmitting unit for transmitting data.
[0137] In one possible implementation, the communication interface 904 in the position relationship determination device 90 provided in this application embodiment can also be integrated into the processor 901, and this application embodiment does not specifically limit this.
[0138] As a possible product form, the position relationship determination device of this application embodiment can also be implemented using the following: one or more field programmable gate arrays (FPGAs), programmable logic devices (PLDs), controllers, state machines, gate logic, discrete hardware components, any other suitable circuits, or any combination of circuits capable of performing the various functions described throughout this application.
[0139] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional units is used as an example. In practical applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the device can be divided into different functional units to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0140] This application also provides a computer-readable storage medium storing a computer program or instructions thereon, which, when executed, causes a computer to perform the various steps in the method flow shown in the above method embodiments.
[0141] Embodiments of this application provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform the various steps in the method flow shown in the above-described method embodiments.
[0142] This application provides a chip system, including: a processor and an interface circuit; the interface circuit is used to receive computer programs or instructions and transmit them to the processor; the processor is used to execute the computer programs or instructions so that the chip system performs each step in the method flow shown in the above method embodiments.
[0143] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing, or any other form of computer-readable storage medium in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in a purpose-specific ASIC. In the embodiments of this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0144] Since the position relationship determination device, computer-readable storage medium, and computer program product provided in this embodiment can be applied to the position relationship determination method provided in this embodiment, the technical effects that can be obtained can also be referred to the above method embodiments. The embodiments of this application will not be repeated here.
[0145] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, the disclosure, and the appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0146] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
Claims
1. A method for determining positional relationships, characterized in that, The method includes: Obtain the target GeoHash code of the target location and the location information of the target region boundary; the precision of the target GeoHash code is a preset precision; The position information of the minimum bounding rectangle of the target region is determined based on the position information of the target region boundary and the spatial function. The initial precision of the second GeoHash grid encoding set is determined based on the side length of the longest side of the minimum bounding rectangle; the second GeoHash grid encoding set is the GeoHash grid encoding set with the lowest precision among the plurality of GeoHash grid encoding sets, and the second GeoHash grid encoding set is included in the plurality of GeoHash grid encoding sets, wherein the side length does not exceed 3 times the grid length corresponding to the initial precision; The minimum bounding rectangle is divided into multiple GeoHash grids of first precision using the initial precision. GeoHash grids located outside the target region are discarded, while GeoHash grids located within the target region are retained. GeoHash grids located on the boundary of the target region are recursively divided according to higher precision. GeoHash grids generated by the recursive division outside the target region are discarded, while GeoHash grids generated by the recursive division within the target region are retained. This process continues until the recursive division reaches the preset precision, resulting in multiple GeoHash grid encoding sets. Each GeoHash grid encoding set corresponds to a different precision. The precision of the first GeoHash grid encoding set is the preset precision, and the first GeoHash grid encoding set is the GeoHash grid encoding set with the highest precision among the multiple GeoHash grid encoding sets. The positional relationship between the target location and the target region is determined based on the target GeoHash code and the multiple GeoHash grid code sets.
2. The method according to claim 1, characterized in that, Determining the positional relationship between the target location and the target region based on the target GeoHash code and the multiple GeoHash grid code sets includes: The specified GeoHash code in the target GeoHash code is compared with each GeoHash grid code in each GeoHash grid code set to obtain multiple comparison results; the precision of the specified GeoHash code is the same as the precision corresponding to each GeoHash grid code set. The positional relationship between the target location and the target region is determined based on the multiple comparison results.
3. A device for determining positional relationships, characterized in that, The positional relationship determination device includes: an acquisition module and a processing module; The acquisition module is used to acquire the target GeoHash code of the target location and the location information of the target region boundary; the precision of the target GeoHash code is a preset precision; The processing module is used to determine the position information of the minimum bounding rectangle of the target region based on the position information of the target region boundary and the spatial function. The processing module is further configured to determine the initial precision corresponding to the second GeoHash grid encoding set based on the side length of the longest side of the minimum bounding rectangle; the second GeoHash grid encoding set is the GeoHash grid encoding set with the lowest precision among the plurality of GeoHash grid encoding sets, the second GeoHash grid encoding set is included in the plurality of GeoHash grid encoding sets, and the side length does not exceed 3 times the grid length corresponding to the initial precision; The processing module is further configured to: divide the minimum bounding rectangle into multiple GeoHash grids of first precision with the initial precision; discard GeoHash grids located outside the target region; retain GeoHash grids located within the target region; recursively divide the GeoHash grids located on the boundary of the target region according to higher precision, so as to discard the GeoHash grids generated by the recursive division located outside the target region and retain the GeoHash grids generated by the recursive division located within the target region, until the recursive division reaches the preset precision, thereby obtaining multiple GeoHash grid encoding sets; each GeoHash grid encoding set corresponds to a different precision, the precision corresponding to the first GeoHash grid encoding set is the preset precision, and the first GeoHash grid encoding set is the GeoHash grid encoding set with the highest corresponding precision among the multiple GeoHash grid encoding sets; The processing module is further configured to determine the positional relationship between the target location and the target region based on the target GeoHash encoding and the plurality of GeoHash grid encoding sets.
4. The positional relationship determination device according to claim 3, characterized in that, The processing module is further configured to determine the positional relationship between the target location and the target region based on the target GeoHash code and the plurality of GeoHash grid code sets, including: The specified GeoHash code in the target GeoHash code is compared with each GeoHash grid code in each GeoHash grid code set to obtain multiple comparison results; the precision of the specified GeoHash code is the same as the precision corresponding to each GeoHash grid code set. The positional relationship between the target location and the target region is determined based on the multiple comparison results.
5. A device for determining positional relationships, characterized in that, The positional relationship determination device includes: a processor coupled to a memory for storing programs or instructions, which, when executed by the processor, cause the device to perform the method as described in any one of claims 1 to 2.
6. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed, they cause the computer to perform the method as described in any one of claims 1 to 2.
Citation Information
Patent Citations
Spatial relationship determination method and device, computer equipment and storage medium
CN113722409A
Target object positioning method, terminal equipment and storage medium
CN115098752A
