Area search method and device, electronic equipment and readable storage medium
By converting Geohash-encoded latitude and longitude into a global grid index of decimal values, the target search range is constructed, solving the problem that the Geohash indexing method cannot identify adjacent regions in regional searches, and achieving fast and accurate identification of adjacent regions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2022-11-07
- Publication Date
- 2026-04-21
AI Technical Summary
The existing Geohash indexing method cannot accurately identify adjacent regions with the same precision in regional search scenarios, resulting in search accuracy and efficiency failing to meet business requirements.
The GeoHashIndex is used to construct the target search range by converting the binary strings of latitude and longitude encoded by Geohash into decimal values, and to identify the adjacency relationships of Geohash grids at arbitrary precision.
It enables rapid and accurate identification of adjacent regions with Geohash encoding precision, meeting business needs and improving search efficiency and accuracy.
Smart Images

Figure CN115658836B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of big data processing technology, and more specifically, to a method, apparatus, electronic device, and readable storage medium for regional search. Background Technology
[0002] Geohash is a geocoding method that encodes two-dimensional latitude and longitude coordinates into a one-dimensional string, serving as a globally unique identifier. It can represent point data in a database. Through Geohash encoding, spatially adjacent locations may share the same prefix in their encoding, giving it a significant advantage in solving the problem of searching for nearby locations. However, in regional search scenarios, when the Geohash indexing method searches for surrounding Geohash values, the conventional approach is to determine the identity based on common substring prefixes. This method cannot guarantee the identification of adjacent regions with the same Geohash precision, and its accuracy and efficiency cannot meet business requirements. Summary of the Invention
[0003] One objective of this invention is to provide a region search method, apparatus, electronic device, and readable storage medium for quickly and accurately identifying adjacent regions with the same Geohash precision, thereby meeting business requirements. Embodiments of this invention can be implemented as follows:
[0004] In a first aspect, the present invention provides a region search method, the method comprising:
[0005] Obtain the Geohash code of the region where the target point of interest is located;
[0006] Determine the global grid index corresponding to the Geohash code; the global grid index is composed of the decimal values of the binary strings corresponding to longitude and latitude respectively; the global grid index is used to identify the adjacency relationship of Geohash grids at any precision;
[0007] Based on the precision of the Geohash encoding and the global grid index, the target search range is constructed;
[0008] All target global grid indices within the target search range are determined, and the regions represented by the Geohash codes corresponding to all target global grid indices are taken as the adjacent regions of the target interest point in terms of the precision of the Geohash codes.
[0009] In a second aspect, the present invention provides a region search device, comprising:
[0010] The acquisition module is used to obtain the Geohash code of the region where the target point of interest is located;
[0011] A determination module is used to determine the global grid index corresponding to the Geohash code; the global grid index is composed of decimal values of binary strings corresponding to longitude and latitude; the global grid index is used to identify the adjacency relationship of Geohash grids at any precision at that precision;
[0012] A construction module is used to construct the target search range based on the global grid index;
[0013] The search module is used to determine all target global grid indices within the target search range, and to take the regions represented by the Geohash codes corresponding to all target global grid indices as adjacent regions of the target interest point in terms of the precision of the Geohash codes.
[0014] Thirdly, the present invention provides an electronic device including a processor and a memory, the memory storing a computer program executable by the processor, the processor being able to execute the computer program to implement the method described in the first aspect.
[0015] Fourthly, the present invention provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0016] The region search method, apparatus, electronic device, and readable storage medium provided by this invention first obtain the Geohash code of the region where the target point of interest is located, and then determine the global grid index corresponding to the Geohash code. Since the global grid index provided by this invention can identify the adjacency relationship of Geohash grids at any precision, a target search range is constructed based on the precision of the Geohash code and the global grid index. Then, all target global grid indices located within the target search range are found, and the regions represented by the Geohash codes corresponding to these target global grid indices are taken as the adjacent regions of the region where the target point of interest is located at the precision of the Geohash code. The entire process can quickly identify the adjacent regions of a certain region at a certain precision, meeting business requirements. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1This represents the precision corresponding to different lengths of Geohash encoding;
[0019] Figure 2 A schematic flowchart illustrating the region search method provided in an embodiment of the present invention;
[0020] Figure 3 A schematic flowchart of step S102 provided in an embodiment of the present invention;
[0021] Figure 4 A schematic flowchart of step S103 provided in an embodiment of the present invention;
[0022] Figure 5 A schematic diagram of a regular polygonal grid region provided in an embodiment of the present invention;
[0023] Figure 6 This is a schematic diagram of an irregular polygonal grid region provided in an embodiment of the present invention;
[0024] Figure 7 A functional block diagram of the area search device provided in an embodiment of the present invention;
[0025] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0027] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0028] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0029] In the description of this invention, it should be noted that if terms such as "upper," "lower," "inner," or "outer" are used to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship in which the product of this invention is usually placed, they are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention.
[0030] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0031] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.
[0032] Geohash is a geocoding method that uses the idea of repeatedly dividing the Earth along longitude and latitude in an alternating manner. Each division is called a subdivision, and every five subdivisions constitute a level. When the number of levels is odd, the subdivision result is similar to the first level; when the number of levels is even, the result of each subdivision is similar to the second level. This process continues until arbitrary precision is achieved. Each subdivision is represented by 0 or 1. Specifically, when dividing along the longitude direction, the left area is coded as 0, and the right area is coded as 1. When dividing along the latitude direction, the lower area is coded as 0, and the upper area is coded as 1. Then, the binary code of every five subdivisions is converted into a base-32 code, represented by 0-9 and lowercase English letters excluding a, i, l, and o. This is the Geohash code for a certain grid level.
[0033] From the above, we can infer that Geohash strings near a point (but not absolutely) have a common string prefix, and the longer the common string prefix, the closer the two points are. However, based on the common string prefix, it cannot be guaranteed that a Geohash grid can be found to be a neighboring Geohash grid with the same precision.
[0034] For example, wx4endz and wx4enfb are two adjacent Geohash codes at Geohash 7 precision. However, using the common string prefix, we can only identify that wx4endz and wx4enfb are adjacent at Geohash 5 precision, within a range of 4890m*4890m. This identification result has too large an error. Moreover, in actual search scenarios, it is only meaningful to find adjacent Geohash codes at the same Geohash 7 precision for a given Geohash code. Therefore, the search method based on the common string prefix cannot guarantee that the search results can meet business requirements.
[0035] To better understand the above issues, we will use a ride-hailing scenario as an example.
[0036] When hailing a taxi, a passenger has a GPS location or Geohash code. To search for nearby vehicles, there are currently two methods:
[0037] The first method involves estimating the distance from the location point to find the vehicle closest to the passenger. This method requires calculating the distance between all vehicles and the passenger, and the calculation cost is equal to the number of passengers multiplied by the number of vehicles. This method is computationally intensive and has low search efficiency.
[0038] The second method is to search based on common string prefixes, but this method has a large search error and cannot meet business needs.
[0039] For example, Figure 1 To illustrate the precision corresponding to different lengths of Geohash encoding, if the passenger's Geohash7 is wx4endz and vehicle A's Geohash7 is wx4enfb, wx4endz and wx4enfb are actually adjacent in terms of Geohash7 precision, meaning vehicle A can be found within a 153m*153m range. However, since their first 5 characters are the same, it means that vehicle A needs to be searched within a 25 square kilometer area, resulting in a very large error. Similarly, using the passenger's Geohash6 precision will not find vehicle A because the last character of the first 6 characters is different.
[0040] In other words, the platform couldn't find the car at all within the Geohash 6 precision range. The principle that the longer the common string prefix, the closer the two are, might not be able to find the target. In other words, the car that was actually closest to the passenger was not assigned to the passenger. This shows that the Geohash-based indexing method leads to inaccurate searches. If the platform chooses to search within the Geohash 5 precision range, it can find the car, but it needs to calculate the distance between all vehicles and passengers within a 25 square kilometer area to finally determine that vehicle A is the closest, which has a larger error. This shows that the Geohash-based indexing method sacrifices computational performance for accuracy.
[0041] In summary, it can be seen that in regional search scenarios, when the Geohash indexing method searches for surrounding Geohashes, the conventional approach is to determine the identity based on common substring prefixes. This method cannot guarantee the identification of adjacent regions with the same Geohash precision, and its accuracy and efficiency are not suitable for business needs.
[0042] To address the aforementioned technical problems, this invention first provides a "global grid index" (GeoHashIndex), which is the decimal representation of the binary string corresponding to Geohash.
[0043] In this embodiment of the invention, based on the underlying principle of Geohash: for the latitude interval [-90, 90] and the longitude interval [-180, 180], by continuously dividing the interval into two, the binary strings of latitude and longitude can be obtained, such as the Geohash string: wx4endz, and the binary strings of latitude and longitude are respectively: 10111000110001011 and 110100101011010111.
[0044] Unlike Geohash encoding, this embodiment of the invention directly converts the binary strings of latitude and longitude into decimal values. For example, the decimal value of 10111000110001011 is 94603, and the decimal value of 110100101011010111 is 215767. The obtained decimal values are then used as a global grid index corresponding to Geohash. That is, the global grid index GeoHashIndex corresponding to wx4endz is (94603, 215767), where 94603 is the latitude index (x in the coordinate system) and 215767 is the longitude index (y in the coordinate system).
[0045] Therefore, the global grid index can be represented as: GeoHashIndex(geoHashLatIndex, geoHashLonIndex), where geoHashLatIndex and geoHashLonIndex correspond to the latitude index and longitude index, respectively. GeoHashIndex is a unique global grid index corresponding to Geohash. Directly saving GeoHashIndex can serve as the basis for fast search in the embodiments of this invention.
[0046] Based on the global grid index provided in this invention, it is possible to directly determine whether a Geohash code is an adjacent Geohash code at different Geohash precisions based on the numerical difference between the latitude and longitude indices. For example, it is known that wx4endz and wx4enfb are two adjacent Geohash codes at Geohash7 precision. The global grid index corresponding to wx4endz is (94603, 215767), and the stored global grid index corresponding to wx4enfb is (94603, 215768). It can be seen that their... The latitude indices are the same, while the longitude indices differ by one value. Based on the underlying principle of Geohash, the values in the global grid index are the decimal values of the binary strings obtained by dividing latitude and longitude. Since the latitude differs by one value, wx4endz and wx4enfb can be considered adjacent in Geohash7 precision. It can be seen that the global grid index proposed in this embodiment of the invention can be used to identify the adjacent relationship of Geohash grids at the target precision. The target precision can be any precision such as Geohash5, Geohash6, or Geohash7.
[0047] Based on the "global grid index" provided in this embodiment of the invention, this embodiment of the invention provides a regional search method, please refer to [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic flowchart illustrating a region search method provided in an embodiment of the present invention. The region search method may include:
[0048] S101, obtain the Geohash code of the region where the target point of interest is located.
[0049] S102, Determine the global grid index corresponding to the Geohash code; the global grid index is composed of the decimal values of the binary strings corresponding to the longitude and latitude of the region; the global grid index is used to identify the adjacency relationship of Geohash grids at any precision;
[0050] S103, based on the precision of Geohash encoding and a global grid index, constructs the target search range;
[0051] S104, determine all global grid indices of targets within the target search range, and take the region represented by the Geohash code corresponding to all global grid indices of targets as the adjacent region of the target interest point in terms of the precision of the Geohash code.
[0052] In the above-described region search method, the Geohash code of the region where the target point of interest is located is first obtained. Then, the global grid index corresponding to the Geohash code is determined. Since the global grid index provided in this embodiment of the invention can identify the adjacency relationship of Geohash grids at any precision, the target search range is constructed based on the precision of the Geohash code and the global grid index. Then, all target global grid indices within the target search range are found, and the regions represented by the Geohash codes corresponding to these target global grid indices are taken as the adjacent regions of the region where the target point of interest is located at the precision of the Geohash code. The whole process can quickly identify the adjacent regions of a certain region at a certain precision, thus meeting business requirements.
[0053] The following is a detailed description of steps S101 to S104.
[0054] In step S101, the Geohash code of the region where the target point of interest is located is obtained.
[0055] In this embodiment of the invention, the target point of interest can be a public place such as a hospital, school, or park, or it can be the location of a passenger in a ride-hailing scenario; there is no limitation here.
[0056] Understandably, based on the longitude and latitude corresponding to the current point of interest, the Geohash code corresponding to the target point of interest can be determined.
[0057] As an optional implementation, Geohash can be calculated in real time based on the longitude and latitude corresponding to the target point of interest to obtain the Geohash code. As another optional implementation, the target study area (which includes the area where the target point of interest is located) can be divided in advance to obtain multiple Geohash codes. Then, based on the longitude and latitude corresponding to the target point of interest, the Geohash grid corresponding to the target point of interest can be determined from the multiple Geohash codes.
[0058] In step S102, the global grid index corresponding to the Geohash code is determined.
[0059] The global grid index consists of decimal values of binary strings corresponding to the longitude and latitude of each region.
[0060] In this embodiment of the invention, the global grid index includes a longitude index and a latitude index. The longitude index is a decimal value obtained by converting the binary string corresponding to the longitude to decimal, and the latitude index is a decimal value obtained by converting the binary string corresponding to the latitude to decimal.
[0061] The differences between the global grid index and the Geohash index are:
[0062] Differences in representation: The Geohash index converts the binary code of every 5 divisions into a base-32 code, using 0-9 and lowercase English letters except a, i, l, and o, while the global grid index in this application converts all the obtained binary codes into decimal codes.
[0063] Functional differences: The Geohash index can identify the adjacency relationship of Geohash grids at the first precision and the second precision based on a common string prefix. The first precision is less than the second precision. The global grid index can identify the adjacency relationship of Geohash grids at a certain precision.
[0064] In this embodiment of the invention, in order to determine the global grid index corresponding to the Geohash code, this embodiment of the invention provides an implementation method: that is, based on the Geohash code, the global grid index corresponding to the Geohash code is determined from a pre-generated global grid index table.
[0065] It is understood that embodiments of the present invention can pre-generate a global grid index table, which is used to maintain the correspondence between Geohash codes and global grid indexes.
[0066] As an optional implementation, all Geohash codes corresponding to the target research area can be converted in advance to obtain their respective global grid index tables. When the Geohash code corresponding to the target point of interest is determined, the global grid index is directly matched based on the Geohash code from the global grid index table to obtain the global grid index.
[0067] As another alternative implementation method, it can also be based on Figure 3 The implementation shown calculates the global grid index in real time. Figure 3 A schematic flowchart of step S102 provided in an embodiment of the present invention:
[0068] S102-1. Determine the number of segments based on the precision of the Geohash encoding.
[0069] It's understandable that the equator is about 40,000 kilometers long, and the Earth is actually an irregular sphere. However, for the sake of simplicity, if we assume that each degree of latitude is approximately equal to 222 kilometers, then the number of degrees after 17 divisions of latitude is 180 / 2^17, and the number of degrees after 18 divisions of longitude is 360 / 2^18 = 180 / 2^17. The precision of longitude is 40,000,000 / 2^18, which is approximately 153 meters. Since 153 meters corresponds to the precision of Geohash 7, we can determine that the number of divisions is: 17 divisions for latitude and 18 divisions for precision.
[0070] S102-2. Divide the preset longitude range and preset latitude range based on the number of divisions to obtain the binary strings corresponding to the longitude and latitude of the target area.
[0071] In this embodiment of the invention, the preset longitude range is -180 degrees to 180 degrees, and the preset latitude range is -90 degrees to 90 degrees. During the division process, longitude starts at [-180, 180], and latitude starts at [-90, 90]. Each time, the interval is divided in half. If the output coordinate is less than either end of the range, it is encoded as 0, and the next interval uses the left half; if it is greater, it is encoded as 1, and the next interval uses the right half. This process continues, and the longer the code, the closer it is to the coordinate value, and thus the more accurate it is.
[0072] For example, the Geohash encoding is wx4endz. After the latitude is divided into 17 parts, the corresponding binary string is 10111000110001011, and after the longitude is divided into 18 parts, the corresponding binary string is 110100101011010111.
[0073] S102-3. Convert the binary strings corresponding to longitude and latitude into decimal values respectively, and use the two decimal values as the global grid index corresponding to the Geohash encoding.
[0074] Continuing with the example above, the binary string 10111000110001011 is converted to the decimal value 94603, and the binary string 110100101011010111 is converted to the decimal value 215767. Therefore, the global grid index corresponding to wx4endz is (94603, 215767).
[0075] Once the global grid index corresponding to the Geohash code is determined, step S103 can be executed.
[0076] In step S103, the target search range is constructed based on the precision of Geohash encoding and the global grid index.
[0077] As an optional implementation, step S103 can be carried out according to... Figure 4 To execute, Figure 4 A schematic flowchart of step S103 provided in an embodiment of the present invention:
[0078] S103-1, Obtain the target search radius.
[0079] In this embodiment of the invention, the target search radius can be set according to actual search needs, such as 3km, 5km, etc., and is not limited here.
[0080] S103-2. The ratio between the target search radius and the precision of the Geohash encoding is used as the number of grid layers to be searched.
[0081] S103-3. Construct the target search range based on the number of grid layers to be searched and the global grid index;
[0082] The target search range is: xN<=x'<=x+N, and yN<=y'<=y+N;
[0083] Where x and y represent the latitude and longitude indices of the global grid index, respectively; N represents the number of grid layers to be searched; and x' and y' represent the latitude and longitude indices of the target global grid index, respectively.
[0084] For example, the map grid area represented by the above target search range, such as Figure 5 As shown, Figure 5 This is a schematic diagram of a regular polygonal grid region provided in an embodiment of the present invention, wherein (x, y) is the global grid index corresponding to the Geohash code of the region where the target point of interest is located, and the map grid adjacent to (x, y) is exactly a standard rectangular shape, that is, the region formed by the adjacent map grids searched within the above target search range is a regular rectangular shape.
[0085] As another implementation, embodiments of the present invention can also determine the target search range within a defined polygonal grid area to quickly solve the problem of searching for areas within special polygonal grids, that is, the area formed by adjacent map grids searched within the target search range has an irregular polygonal shape. The above step S103 may also include the following steps:
[0086] a1: Defines a predefined polygonal mesh region; the polygonal mesh region contains the region represented by the Geohash code;
[0087] a2: Construct the target search range based on the shape of the polygonal grid region and the global grid index.
[0088] For example, an embodiment of the present invention provides an implementation scenario, such as... Figure 6 As shown, Figure 6 This is a schematic diagram of an irregular polygonal grid region according to an embodiment of the present invention. The corresponding target search range can be expressed as: x-1<=x'<=x+1,y'=y, and x'=x,y<=y'<=y+1.
[0089] It is understandable that, for different polygonal grid regions, a target search range matching the obtained global grid index can be constructed. The map grids searched from the target search range are adjacent to the map grids corresponding to the target point of interest.
[0090] In this embodiment of the application, the polygonal grid area is the shape formed by stitching together multiple map grids. It may be any shape such as square, cross, straight, or T. Different shapes correspond to different target search ranges.
[0091] S104, determine all global grid indices of targets within the target search range, and take the region represented by the Geohash code corresponding to all global grid indices of targets as the adjacent region of the target interest point in terms of the precision of the Geohash code.
[0092] In this embodiment of the application, the region composed of adjacent regions and the region represented by Geohash encoding can be as follows: Figure 5 As shown, this is a regular polygonal grid area; it can also be like... Figure 6 As shown, this is an irregular polygonal grid area.
[0093] To better understand the significant advantages of the above search process compared to conventional search methods, let's assume we want to search for adjacent Geohashes within a 3km radius or a specially defined area around a target point of interest. Then:
[0094] The conventional search method is as follows: 3000m / 150m is approximately 20, so the number of grid layers to be searched is 20. The corresponding decoded string is obtained by decoding with Geohash and then extended by 20 layers, and then encoded into a 20-layer Geohash string (this Geohash can be obtained through the general processing method of Geohash, which is denoted as algo). This calculation is very cumbersome.
[0095] Using the region search method provided in this embodiment of the invention: directly obtain the global grid index (x, y) corresponding to the Geohash code of the target point of interest, and then construct the target search range as follows: x-20<=x'<=x+20 and y-20<=x'<=y+20. This allows finding all (x', y') that satisfy the above conditions in the Poi table. The regions represented by the Geohash codes of these (x', y') are adjacent to the regions represented by the Geohash codes of the target point of interest, as shown in... Figure 6 As shown.
[0096] In an optional implementation, when calculating distances, a rough estimate can also be made based on the global grid index. For example, with Geohash7 accuracy, the difference in latitude is (x'-x)*153m, and the difference in longitude is (y'-y)*153m.
[0097] In an optional implementation, after finding neighboring areas, it can also be applied to actual ride-hailing scenarios. That is, when the target point of interest is the location of a passenger within the area, vehicles located in neighboring areas are assigned to the passenger; the location is sent to one of the vehicles so that the vehicle can reach the location.
[0098] Based on the same inventive concept, embodiments of the present invention also provide a region search device, see [link to relevant documentation]. Figure 7 , Figure 7 This is a functional block diagram of a region search device provided in an embodiment of the present invention. The region search device 200 can be stored in the operating system (OS) of the electronic device 300 in the form of software or firmware.
[0099] like Figure 7 As shown, the area search device 200 may include: an acquisition module 210, a determination module 220, a construction module 230, and a search module 240.
[0100] Module 210 is used to obtain the Geohash code of the region where the target point of interest is located;
[0101] The determination module 220 is used to determine the global grid index corresponding to the Geohash code; the global grid index is composed of the decimal values of the binary strings corresponding to longitude and latitude respectively; the global grid index is used to identify the adjacency relationship of Geohash grids at any precision.
[0102] Module 230 is used to construct the target search range based on the global grid index;
[0103] The search module 240 is used to determine all global grid indices of targets within the target search range, and to take the regions represented by the Geohash codes corresponding to all global grid indices of targets as adjacent regions of the target interest point in terms of the precision of the Geohash codes.
[0104] It is understandable that the acquisition module 210, the determination module 220, the construction module 230, and the search module 240 can be executed collaboratively. Figure 2 Each step in the process is used to achieve the corresponding technical effect.
[0105] In an optional implementation, the determining module 220 is used to: determine the number of segments based on the precision of the Geohash encoding; divide a preset longitude range and a preset latitude range based on the number of segments to obtain binary strings of longitude and latitude corresponding to the Geohash encoding; convert the binary strings of longitude and latitude into a decimal value respectively, and use the two decimal values obtained as the global grid index corresponding to the Geohash encoding.
[0106] In an optional implementation, the determining module 220 is used to: determine the global grid index corresponding to the Geohash code from a pre-generated global grid index table based on the Geohash code.
[0107] In an optional implementation, the construction module 230 is used to obtain the target search radius; the ratio between the target search radius and the precision of the Geohash encoding is used as the number of grid layers to be searched; and the target search range is constructed based on the number of grid layers to be searched and the global grid index; the target search range is: xN<=x'<=x+N, and yN<=y'<=y+N; where x and y represent the latitude index and longitude index in the global grid index, respectively; N represents the number of grid layers to be searched; and x' and y' represent the latitude index and longitude index in the target global grid index, respectively.
[0108] In an optional implementation, the construction module 230 is used to determine a predefined polygonal grid region; the polygonal grid region contains the region represented by the Geohash code; and the target search range is constructed based on the shape of the polygonal grid region and the global grid index.
[0109] In an optional implementation, the area search device 200 may also be configured with a module for assigning vehicles located in adjacent areas to passengers when the target point of interest is the location of a passenger within the area; and sending the location to one of the vehicles so that the vehicle can reach the location.
[0110] Please see Figure 8 , Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. The electronic device 300 can be used to execute the region search method provided in the embodiment of the present invention. As an optional embodiment, the electronic device 300 may be, but is not limited to, a tablet computer, a personal computer, a smart terminal, etc.
[0111] like Figure 8 As shown, the electronic device 300 may include a memory 301, a processor 302, a communication interface 303, and a bus 304. The memory 301, processor 302, and communication interface 303 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0112] Optionally, bus 304 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 8 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.
[0113] In this embodiment of the invention, the processor 302 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in this embodiment of the invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this embodiment of the invention can be directly manifested as execution by the hardware processor, or execution by a combination of hardware and software modules within the processor. The software modules may reside in the memory 301, and the processor 302 reads the program instructions from the memory 301 and, in conjunction with its hardware, completes the steps of the aforementioned methods.
[0114] In this embodiment of the invention, the memory 301 can be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or it can be volatile memory, such as RAM. The memory can also be 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. The memory in this embodiment of the invention can also be a circuit or any other device capable of implementing storage functions, used to store instructions and / or data.
[0115] The memory 301 can be used to store software programs and modules, such as the instructions / modules of the area search device 200 provided in this embodiment of the invention. These can be stored in the memory 301 in the form of software or firmware, or embedded in the operating system (OS) of the electronic device 300. The processor 302 executes various functional applications and data processing by executing the software programs and modules stored in the memory 301. The communication interface 303 can be used for signaling or data communication with other node devices.
[0116] Understandable. Figure 8 The structure shown is for illustrative purposes only; the electronic device 300 may also include components that are more advanced than those shown. Figure 8 The more or fewer components shown, or having the same Figure 8 The different configurations shown. Figure 8 The components shown can be implemented using hardware, software, or a combination thereof.
[0117] Based on the above embodiments, this application also provides a storage medium storing a computer program, which, when executed by a computer, causes the computer to perform the region search method provided in the above embodiments.
[0118] Based on the above embodiments, this application also provides a computer program that, when run on a computer, causes the computer to execute the region search method provided in the above embodiments.
[0119] Based on the above embodiments, this application also provides a chip for reading a computer program stored in a memory and executing the region search method provided in the above embodiments.
[0120] This application also provides a computer program product, including instructions that, when run on a computer, cause the computer to execute the region search method provided in the above embodiments.
[0121] This application describes embodiments of methods, apparatus (systems), and computer program products according to embodiments of this application with reference to flowchart illustrations and / or block diagrams. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by instructions. These instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0122] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0123] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0124] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A region search method, characterized in that, The method includes: Obtain the Geohash code of the region where the target point of interest is located; Determine the global grid index corresponding to the Geohash code; the global grid index is composed of the decimal values of the binary strings corresponding to longitude and latitude respectively; the global grid index is used to identify the adjacency relationship of Geohash grids at any precision; Obtain the target search radius; The ratio between the target search radius and the precision of the Geohash encoding is used as the number of grid layers to be searched; Based on the number of grid layers to be searched and the global grid index, a target search range is constructed; the target search range is: ; Wherein, x and y represent the latitude index and longitude index in the global grid index, respectively; N represents the number of grid layers to be searched; and stated These respectively represent the latitude and longitude indexes in the target global grid index; All target global grid indices within the target search range are determined, and the regions represented by the Geohash codes corresponding to all target global grid indices are taken as the adjacent regions of the target interest point in terms of the precision of the Geohash codes.
2. The region search method according to claim 1, characterized in that, Determining the global grid index corresponding to the Geohash encoding includes: The number of segments is determined based on the precision of the Geohash encoding. Based on the number of divisions, the preset longitude range and the preset latitude range are divided to obtain the binary strings of longitude and latitude corresponding to the Geohash encoding; The binary strings of the longitude and latitude are each converted into a decimal value, and the two decimal values are used as the global grid index corresponding to the Geohash code.
3. The region search method according to claim 1, characterized in that, Determining the global grid index corresponding to the Geohash encoding includes: Based on the Geohash encoding, the global grid index corresponding to the Geohash encoding is determined from a pre-generated global grid index table.
4. The region search method according to claim 1, characterized in that, Based on the global grid index, construct the target search range, including: Determine a predefined polygonal grid region; the polygonal grid region contains the region represented by the Geohash encoding; The target search range is constructed based on the shape of the polygonal grid region and the global grid index.
5. The region search method according to claim 1, characterized in that, The method includes: When the target point of interest is the location of a passenger within the area where the target point of interest is located, a vehicle located in the adjacent area is assigned to the passenger; The location is sent to one of the vehicles so that the vehicle arrives at the location.
6. A region search device, characterized in that, include: The acquisition module is used to obtain the Geohash code of the region where the target point of interest is located; The determination module is used to determine the global grid index corresponding to the Geohash encoding; The global grid index is composed of decimal values of binary strings corresponding to longitude and latitude; the global grid index is used to identify the adjacency relationship of Geohash grids at any precision. A construction module is used to obtain the target search radius; the ratio between the target search radius and the precision of the Geohash encoding is used as the number of grid layers to be searched; based on the number of grid layers to be searched and the global grid index, a target search range is constructed; the target search range is: Wherein, x and y represent the latitude index and longitude index in the global grid index, respectively; N represents the number of grid layers to be searched; and stated These respectively represent the latitude and longitude indexes in the target global grid index; The search module is used to determine all target global grid indices within the target search range, and to take the regions represented by the Geohash codes corresponding to all target global grid indices as adjacent regions of the target interest point in terms of the precision of the Geohash codes.
7. The area search device according to claim 6, characterized in that, The determining module is specifically used for: The number of segments is determined based on the precision of the Geohash encoding. Based on the number of divisions, the preset longitude range and the preset latitude range are divided to obtain the binary strings of longitude and latitude corresponding to the Geohash encoding; The binary strings of the longitude and latitude are each converted into a decimal value, and the two decimal values are used as the global grid index corresponding to the Geohash code.
8. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a computer program executable by the processor, the processor being able to execute the computer program to implement the method of any one of claims 1 to 5.
9. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 5.