Reverse geocoding method and device
Through the combination of ray method and R-tree data structure, the GeoHash algorithm's accuracy and boundary processing problems in inverse geocoding are solved, and an inverse geocoding method with high precision and low maintenance costs is realized.
Patent Information
- Application Number
- CN202411133979.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-10
AI Technical Summary
The existing GeoHash algorithm is difficult to achieve high precision and accurately deal with boundary problems in inverse geocoding, resulting in inaccurate position information after latitude and longitude coordinate conversion, and the encoding accuracy is limited by the string length, which makes dynamic maintenance cost high.
The ray method and R-tree data structure are used to obtain the target latitude and longitude coordinates, find overlapping data of multiple rectangular areas, and use the ray method to filter out the actual geographical areas to avoid boundary problems, and support dynamic insertion, deletion and update of geographical location information.
High-precision inverse geocoding is realized, which avoids the problem of distance between location information and actual geographical location, reduces dynamic maintenance costs, and improves query efficiency and accuracy.
Smart Images

Figure CN119106662A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of positioning technology, and more specifically, to a reverse geocoding method and device. Background Art
[0002] With the development of technology and the popularization of geographic information system (GIS), reverse geocoding is increasingly used in daily life and business. Reverse geocoding refers to converting given geographic coordinates (such as longitude and latitude coordinates) into specific location information (such as country, province, city, street, etc.). It is widely used in map services, navigation, location services and various location-based applications.
[0003] At present, most reverse geocoding is implemented using the GeoHash algorithm, which converts two-dimensional longitude and latitude coordinates into one-dimensional strings and queries the corresponding location information based on the strings. However, the GeoHash algorithm is limited by the length of the encoded string, the accuracy is difficult to meet the requirements, and the accuracy of different regions varies greatly. In addition, the GeoHash algorithm is difficult to handle boundary issues, because a grid of GeoHash coding usually spans multiple geographic regions or regional boundaries. When a longitude and latitude coordinate is located between adjacent grids, the location information corresponding to the grid that is closer to the longitude and latitude coordinate may be determined based on the longitude and latitude coordinate, while the location information corresponding to the grid is far away from the actual geographical location corresponding to the longitude and latitude, resulting in inaccuracy in reverse geocoding.
[0004] Therefore, how to achieve reverse geocoding with high accuracy and accurate handling of boundary issues needs to be solved urgently. Summary of the invention
[0005] The present application provides a reverse geocoding method and device, which can achieve reverse geocoding with high accuracy and can accurately handle boundary problems.
[0006] In a first aspect, a reverse geocoding method is provided, comprising: obtaining target longitude and latitude coordinates; searching for data of multiple target rectangular areas corresponding to the target longitude and latitude coordinates from a first data structure, the multiple target rectangular areas including an overlapping first area, the target longitude and latitude coordinates being located in the first area; using a ray method to check multiple geographic areas corresponding to the multiple target rectangular areas to obtain a first geographic area, the multiple target rectangular areas corresponding one-to-one to the multiple geographic areas, the target longitude and latitude coordinates being located in the first geographic area; and outputting first geographic location information corresponding to the first geographic area.
[0007] Based on the above scheme, the data of multiple rectangular areas corresponding to the target longitude and latitude coordinates can be quickly obtained through the first data structure. At this time, the target area is located in the first area where the multiple rectangular areas corresponding to the multiple geographical areas overlap. The geographical areas corresponding to the multiple rectangular areas are screened using the ray method to obtain the first geographical area where the target longitude and latitude coordinates are located. The first geographical area corresponds to the first geographical location information. Compared with the Geohash method, the boundary problem caused when the target longitude and latitude coordinates are near the boundary of the geographical area is avoided, because the first geographical area is the area covered by the geographical object in the actual space (that is, the area where the geographical location information is located). Therefore, it can effectively avoid the geographical location corresponding to the obtained target longitude and latitude coordinates being far away from the actual geographical location, so that the location information of the obtained target longitude and latitude coordinates is more accurate.
[0008] In combination with the first aspect, in some implementations of the first aspect, the first data structure supports insertion, deletion, and update of data of a rectangular area corresponding to the geographic area corresponding to the geographic location information.
[0009] Based on the above scheme, the first data structure can support the insertion, deletion and update of data of the rectangular area corresponding to the geographical area corresponding to the geographical location information, and timely handle the changes of the geographical location information. Compared with the encoding method of Geohash, the dynamic maintenance cost is lower.
[0010] In combination with the first aspect, in certain implementations of the first aspect, a ray method is used to screen multiple geographical areas corresponding to the multiple target rectangular areas to obtain a first geographical area, including: making a ray pass through the multiple geographical areas according to the location of the target latitude and longitude coordinates, so that the ray forms an intersection with the contour boundaries of the multiple geographical areas; and screening out the first geographical area according to the number of intersections formed with the contour boundaries of the multiple geographical areas.
[0011] Based on the above scheme, a ray can be made through the location of the longitude and latitude coordinates to cross multiple geographical areas corresponding to multiple rectangular areas, and the geographical area corresponding to the longitude and latitude coordinates can be further determined by the number of intersections between the ray and the contour boundary of the geographical area, so that the precise geographical location information of the geographical area corresponding to the longitude and latitude coordinates can be obtained subsequently.
[0012] In combination with the first aspect, in some implementations of the first aspect, the first geographical area is a geographical area among the multiple geographical areas, and the number of intersections formed by the ray and the contour boundaries of the multiple geographical areas is an odd number.
[0013] Based on the above scheme, when the number of intersections between the ray and the contour boundary of a geographical area is an odd number, the longitude and latitude coordinates are within the geographical area, and the first geographical area corresponding to the longitude and latitude coordinates is the geographical area, so that the first geographical location information corresponding to the longitude and latitude coordinates can be accurately obtained subsequently.
[0014] In combination with the first aspect, in some implementations of the first aspect, the target rectangular area is an area of a first rectangle, and the first rectangle can frame the outline boundary of the geographical area corresponding to the target longitude and latitude coordinates.
[0015] Based on the above scheme, since the target rectangular area is the smallest rectangular area that frames the outline boundary of the geographical area, the geographical area corresponding to the rectangular area is a unique geographical area, so the geographical location information of the geographical area corresponding to the rectangular area is also unique. When the longitude and latitude coordinates are located in the overlapping area of multiple rectangular areas, the ray method is used to check the unique geographical area corresponding to each rectangle, and the geographical location information of the unique geographical area can be obtained, thereby obtaining the precise geographical location of the longitude and latitude coordinates.
[0016] In combination with the first aspect, in certain implementations of the first aspect, the first data structure is an R-tree, the data of the multiple target rectangular areas are stored in leaf nodes of the R-tree, and each leaf node of the R-tree corresponds to a geographical area.
[0017] Based on the above scheme, when the first data structure is an R-tree, the data of the rectangular area corresponding to the geographic area can be stored in the leaf nodes of the R-tree, so that the data of the rectangular area stored in the leaf nodes corresponding to the longitude and latitude coordinates can be searched from the R-tree according to the longitude and latitude coordinates, so as to subsequently obtain the first geographic location information, which can be compatible with the existing data structure.
[0018] In a second aspect, a reverse geocoding device is provided, which includes: an acquisition module for acquiring target longitude and latitude coordinates; a processing module for searching data of multiple target rectangular areas corresponding to the target longitude and latitude coordinates from a first data structure, the multiple target rectangular areas including an overlapping first area, and the target longitude and latitude coordinates are located in the first area; the processing module is also used to use a ray method to check multiple geographic areas corresponding to the multiple target rectangular areas to obtain a first geographic area, the multiple target rectangular areas correspond one-to-one to the multiple geographic areas, and the target longitude and latitude coordinates are located in the first geographic area; an output module is used to output first geographic location information corresponding to the first geographic area.
[0019] In a third aspect, a reverse geocoding device is provided, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed on the processor, the method provided in the first aspect is executed.
[0020] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is run on a computer, the method provided in the first aspect is executed.
[0021] According to a fifth aspect, a computer program product is provided. When the computer program product is run, the method provided in the first aspect is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A schematic flowchart of a reverse geocoding method 100 provided in an embodiment of the present application.
[0023] Figure 2 A schematic diagram of multiple geographic regions and an MBR surrounding each geographic region.
[0024] Figure 3 It is a schematic diagram of the data in a rectangular area.
[0025] Figure 4 is a schematic diagram of a first data structure.
[0026] Figure 5 Schematic diagram of multiple geographic areas for ray casting.
[0027] Figure 6 A schematic flowchart of a reverse geocoding method 200 provided in an embodiment of the present application.
[0028] Figure 7 A schematic structural block diagram of a reverse geocoding device 300 provided in an embodiment of the present application.
[0029] Figure 8 A reverse geocoding device 400 is also provided for the embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to facilitate understanding of the embodiments of the present application, the following points are first explained.
[0031] First, "at least one" shown in the present application refers to one or more, and "multiple" refers to more than two (including two). In addition, in the embodiments of the present application, "first", "second" and various digital numbers (for example, "#1", "#2", etc.) are only for the convenience of description, and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of each process below does not mean 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 the present application. It should be understood that the objects described in this way can be interchanged under appropriate circumstances so as to be able to describe the schemes other than the embodiments of the present application. In addition, in the embodiments of the present application, words such as "S210" are only marks made for the convenience of description, and the order of execution steps is not limited.
[0032] Second, in the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0033] Third, in the embodiments of the present application, "under the circumstances", "when", and "if" can sometimes be used interchangeably. It should be pointed out that when the distinction between them is not emphasized, the meanings they intend to express are consistent.
[0034] Fourth, the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0035] Fifth, in the embodiments of the present application, “of” and “corresponding” can sometimes be used interchangeably. It should be pointed out that when the distinction between them is not emphasized, the meanings they intend to express are consistent.
[0036] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0037] In order to facilitate understanding of the embodiments of the present application, the basic concepts involved in the embodiments of the present application are first introduced.
[0038] 1. Reverse geocoding: Reverse geocoding is a process of converting geographic coordinates (such as longitude and latitude coordinates) into corresponding location information (such as country, province, city, street, etc.). Its basic idea is to map geographic coordinates to a certain area or geographic entity in geographic space. It is an important function in geographic information system (GIS) and is widely used in map services, navigation, location services and various location-based applications. For example, in map services, map service providers use reverse geocoding to convert the longitude and latitude coordinates provided by users into specific location information, thereby realizing map marking and display; in location services, reverse geocoding is used to obtain detailed address information of the user's current location, so that users can more accurately grasp their location.
[0039] 2. Minimum bounding rectangle (MBR): It is used to describe the minimum rectangular enclosing box of a set of objects (such as points, lines, polygons, etc.) in two-dimensional space. It is a rectangular box that can completely enclose a given geometric object and is the smallest of all the rectangular boxes that enclose the geometric object. It is usually defined by a pair of boundary point coordinates, namely the coordinates of the lower left corner and the upper right corner of the rectangle. It can also be called the minimum enclosing rectangle.
[0040] 3. Location information: Information describing a region or a geographic entity in geographic space. Location information can include country, province, city, district, road, house number, point of interest (POI), etc. Province information, city information, district and county information can be accurately described.
[0041] For example, the country information may include the latitude and longitude outlines, country names, country codes, country center point coordinate data, etc. of various countries in the world.
[0042] Exemplarily, the provincial information may include the latitude and longitude outlines of each administrative province in China, the province name, the provincial administrative division code, the provincial center point coordinate data, etc.
[0043] Exemplarily, city information may include the latitude and longitude outlines of each city, the city code, the city administrative division code, the city center point coordinate data, the name of the country where the city is located, the city country code, the name of the province where the city is located, the city province administrative division code, etc.
[0044] Exemplarily, the district and county information may include the latitude and longitude contours of each district and county, the district and county name, the district and county administrative division code, the district and county center point coordinate data, the name of the province where the district and county is located, the administrative division code of the province where the district and county is located, the name of the city where the district and county is located, the administrative division code of the city where the district and county is located, etc.
[0045] Exemplarily, the road information may include the longitude and latitude sequence of the road, the road name, the name of the province where the road is located, the name of the city where the road is located, the name of the district or county where the road is located, the longitude and latitude of the center point of the road, the administrative division code to which the road belongs, etc.
[0046] Exemplarily, the house number information may include the house number name, the name of the province where the house number is located, the name of the city where the house number is located, the name of the district or county where the house number is located, the longitude and latitude of the house number, the administrative division code to which the house number belongs, etc.
[0047] For example, POI information may include basic information such as name, address, telephone number, coordinates, and classification, and may also include value-added information such as evaluation, consumption level, special recommendations, whether there are parking spaces, and whether credit cards can be used.
[0048] It should be noted that the location information described in this application may also be referred to as geographic location information, address information, geographic space information, etc., and this application does not limit this.
[0049] At present, reverse geocoding usually uses the GeoHash algorithm to convert longitude and latitude coordinates into the above location information. GeoHash is essentially a way of spatial indexing. Its basic principle is to understand the earth as a two-dimensional plane and recursively decompose the plane into smaller sub-blocks (or "grids"), each of which has the same code within a certain longitude and latitude range. The GeoHash algorithm divides longitude and latitude into grids and assigns a unique GeoHash value to each grid, which makes it easy to encode and retrieve geographic locations. The basic steps for reverse geocoding using the GeoHash algorithm are as follows:
[0050] 1. Convert the target longitude and latitude coordinates into a one-dimensional GeoHash string. The similarity between the GeoHash strings indicates the distance of the geographical location. The more similar the strings are, the closer the geographical location is. For example, the GeoHash strings in urban areas are similar, and the GeoHash strings in suburban areas are also similar, while the GeoHash strings between urban areas and suburban areas are less similar. In addition, different character lengths indicate different ranges. The longer the string, the more accurate the range.
[0051] 2. Use the GeoHash string to query the geographic location database or online map service to obtain the corresponding geographic location information.
[0052] 3. Parse the query results and extract the required geographic location information, such as city information, district and county information, etc.
[0053] However, there are many disadvantages in using the GeoHash algorithm for reverse geocoding to obtain location information, as follows:
[0054] Disadvantage 1: Since GeoHash encoding divides the area into regular rectangles and encodes each rectangle, it will cause boundary problems when querying location information. For example, point A is in grid A, and there are two restaurants near A. When A queries the restaurant, he will find that the GeoHash string of the restaurant that is actually farther away is consistent with the string of grid A, because the restaurant that is actually farther away is on the same grid as A, while the GeoHash string of the restaurant that is actually closer is inconsistent with the string of grid A. It can be seen that when a certain longitude and latitude coordinate is located between adjacent grids, the location information corresponding to the grid that is closer may be determined based on the longitude and latitude coordinates, and the location information corresponding to the grid is far away from the actual geographical location corresponding to the longitude and latitude, resulting in inaccuracy in reverse geocoding. This problem often occurs near the grid boundary.
[0055] Disadvantage 2: GeoHash encoding often uses Z-order curves (or Peano space-filling curves) for encoding, which has a mutation type. At each corner of the letter Z, there may be sequential mutations, making the encoded strings adjacent but the actual distances far apart. In other words, geographically close geographical areas are far apart in the graph.
[0056] Disadvantage 3: The accuracy of GeoHash encoding is limited by the length of the encoding string. As the accuracy increases, the length of the encoding string increases, but the accuracy is not always sufficient to meet actual needs, especially when more detailed geographic location information is needed in urban environments.
[0057] Disadvantage 4: GeoHash encoding divides the earth's surface into grids, but the sizes of these grids are not uniform in different regions of the earth. For example, near the equator, where the latitude lines are closer, the grid size will be smaller, while near the poles, the grid size will be larger, which will lead to large differences in accuracy in different regions.
[0058] Disadvantage 5: Geographic location information may change over time, such as new buildings, road reconstruction, etc. GeoHash encoding itself does not provide a mechanism to handle the update of geographic data, so additional management and maintenance work is required, and the cost of dynamic maintenance is high.
[0059] Therefore, how to achieve reverse geocoding with high accuracy and accurate handling of boundary issues needs to be solved urgently.
[0060] Based on the above problems, the present application provides a reverse geocoding method, which can quickly obtain data of multiple rectangular areas corresponding to the target longitude and latitude coordinates through a first data structure. At this time, the target area is located in the first area where the multiple rectangular areas corresponding to the multiple geographical areas overlap. The geographical areas corresponding to the multiple rectangular areas are screened using the ray method to obtain the first geographical area where the target longitude and latitude coordinates are located. The first geographical area corresponds to the first geographical location information. Compared with the Geohash method, the boundary problem caused when the target longitude and latitude coordinates are near the boundary of the geographical area is avoided, because the first geographical area is the area covered by the geographical object in the actual space, so it can effectively avoid the geographical location corresponding to the obtained target longitude and latitude coordinates being far away from the actual geographical location, so that the location information of the obtained target longitude and latitude coordinates is more accurate.
[0061] Figure 1 The present invention provides a schematic flow chart of a reverse geocoding method 100, which includes the following steps:
[0062] S110, obtaining the target longitude and latitude coordinates.
[0063] The target longitude and latitude coordinates may also be the coordinates of a positioning point. The positioning point may be the location of the positioning object. The location may include longitude coordinates and latitude coordinates in a geographic coordinate system.
[0064] The target longitude and latitude coordinates can be obtained in a variety of ways, for example, through electronic devices with positioning functions used in daily life (such as terminal devices). When the user needs to determine the current location of his or her own, the terminal device can be turned on to query the current location. The terminal device can obtain the real longitude and latitude of the current location through the built-in positioning through the global positioning system (GPS) function or the Beidou positioning function; or the terminal device can call the positioning software and initiate a request to the positioning software to obtain the real longitude and latitude of the current location, thereby obtaining the target longitude and latitude coordinates.
[0065] For another example, the target longitude and latitude coordinates may be received from other electronic devices, for example, the target longitude and latitude coordinates located by the electronic device of the user who needs rescue may be received.
[0066] Among them, the terminal device is a user-side device with wireless transceiver functions, which can be a fixed device, a mobile device, a handheld device (such as a mobile phone), a wearable device (such as a watch), a vehicle-mounted device, or a wireless device built into the above devices (for example, a communication module, a modem, or a chip system, etc.), without limitation.
[0067] It should be noted that the above-mentioned terminal device for obtaining the target longitude and latitude coordinates is only an example. The target longitude and latitude coordinates can also be obtained based on other devices with positioning functions, such as network devices that integrate or connect modules, services or systems with positioning functions, etc., without limitation.
[0068] S120. Searching for data of a plurality of target rectangular areas corresponding to the target longitude and latitude coordinates from the first data structure, the plurality of target rectangular areas including an overlapping first area, and the target longitude and latitude coordinates are located in the first area.
[0069] In one embodiment, data of a target rectangular area corresponding to the target longitude and latitude coordinates are searched from the first data structure, and the target longitude and latitude coordinates are located in the target rectangular area.
[0070] The first data structure is a data structure that can store multi-dimensional geographic location information. The first data structure is used to organize and manage data consisting of multi-dimensional geographic areas (for example, location points in a multi-dimensional space, the outline shape of an irregular multi-dimensional geographic area, etc.). The data consisting of these multi-dimensional geographic areas are called data areas. The internal nodes of the first data structure correspond to an internal area within the space managed by the entire first data structure, and the internal area can be referred to as an "area". The area can be a geometric object of any shape, such as a rectangular shape. One area corresponds to one geographic area, for example, a rectangular area corresponds to one geographic area. The geographic area is the area covered by actual geographic objects / geographic entities (which can be called "spatial objects") in space.
[0071] In one embodiment, the first data structure supports insertion, deletion and update of data of a rectangular area corresponding to the geographic area corresponding to the geographic location information.
[0072] The first data structure includes data of rectangular areas of all spatial objects that need to be indexed. Exemplarily, the spatial object can be a geographical area or a geographical coordinate point. In order to facilitate indexing and storage, an MBR can be used to frame each geographical area, and one MBR just surrounds one geographical area.
[0073] Figure 2 FIG. 1 is a schematic diagram of multiple geographical areas and the MBR surrounding each geographical area. Figure 2 As shown, an irregular geometric shape represents a geographical area, which is an area enclosed by the outline boundary of a physical spatial object in geography. Each geographical area has its own geographical location information, such as Figure 2 One of the geometric shapes shown in the figure is the outline of C. The area enclosed by the geometric shape is the geographical area of C. C can be the geographical location information such as the country, province, city, district, county, road, house number, POI, etc. mentioned above. The geographical location information can also be called geographical location data.
[0074] It can be understood that a geographic location information represents the name of a geographic area. In this application, the geographic area of the geographic location information (such as C) can be referred to as the geographic area corresponding to the geographic location information, the geographic area represented by the geographic location information, or the geographic area marked by the geographic location information. This application does not limit this.
[0075] In one embodiment, the target rectangular area is a first rectangular area, and the first rectangle can frame the outline boundary of the geographical area corresponding to the target longitude and latitude coordinates.
[0076] exist Figure 2 In the figure, a rectangle is used to frame the geographical area corresponding to the geographical location information, and a geographical area is exactly framed by a rectangle. As can be seen from the figure, the rectangular frame can exactly frame the contour boundary of an irregular geographical area. For example, the contour boundary of the geographical area C in the figure is exactly framed by a rectangular frame. Figure 2 In the above example, we can get the 12 smallest rectangular boxes that enclose the geographical areas of C to N. In addition, to facilitate retrieval, several rectangular boxes that are closer can be enclosed by a larger rectangular box, for example Figure 2 Rectangular frame A is used to frame the smallest rectangular frames that frame the geographical areas of C, D, E, F, K, and L, and rectangular frame B is used to frame the smallest rectangular frames that frame the geographical areas of G, H, I, J, M, and N. The rectangular frames corresponding to A to N in the above can all be regarded as an MBR. Rectangular frames A and B are MBRs with larger coverage. For the sake of convenience, rectangles A and B are called the first MBR, and C to N are the smallest MBRs in each first MBR. The smallest MBR is the circumscribed rectangle that just frames the geographical area. All the first MBRs together include all objects in the space. An area framed by a rectangle is called a rectangular area, and the range of a rectangular area is greater than or equal to the range of a geographical area. The 12 smallest rectangular frames corresponding to C to N are all examples of the first rectangle.
[0077] The first data structure can be a tree-like data structure, in which a node in the first data structure is shaped like a branch and a leaf on a tree. The information stored in each node of the first data structure includes a node level, which indicates the depth of the node in the tree, with the root node having the highest level and the leaf node having the lowest level. The information stored in each node of the first data structure also includes a node capacity, which indicates the maximum number of entries that can be stored in each node, and the entries are used to record references to data or references to child nodes. The information stored in each node of the first data structure also includes used space, that is, the number of entries that a node has stored. Among them, an entry usually contains the following information:
[0078] 1. Data in a rectangular area (i.e., MBR), which can completely contain the data points represented by the entry or all data points in the subnodes, such as the rectangular area corresponding to A and the rectangular area corresponding to C in the above.
[0079] 2. Data reference or child node reference: For a leaf node, it is a reference to a data record. Each leaf node corresponds to the smallest rectangular area, such as the rectangular area corresponding to C in the above. The data record represents the actual data record, that is, the geographic location information, such as C. For a non-leaf node, it is a reference to the child node of the non-leaf node. Each non-leaf node corresponds to a rectangular area covering part / all of the smallest rectangular area, such as the rectangular area corresponding to A. The child node can be another internal node or a leaf node, such as the leaf node corresponding to the rectangular area of C. Through this reference, the first data structure can perform further search or insertion operations in its subtree.
[0080] Exemplarily, the data of the rectangular area corresponding to C and the geographical location information C corresponding to the rectangular area are stored as an entry in the leaf node of the first data structure. When the target longitude and latitude coordinates are located in the rectangular area corresponding to C, and because the rectangular area corresponding to C is within the rectangular area corresponding to A, when searching the first data structure according to the target longitude and latitude coordinates, the node corresponding to the rectangular area of A is first obtained, referred to as the A node. The A node is a non-leaf node. According to the reference of the child node in the entry stored in the A node, the child nodes corresponding to the rectangular areas of C, D, E, F, K, and L are pointed to, referred to as the C node, D node, E node, F node, K node, and L node. These nodes correspond to the smallest rectangular area that can just frame the spatial object, so these nodes are all leaf nodes. Traverse the leaf nodes C, D, E, F, K, and L to obtain the C node corresponding to the target longitude and latitude coordinates. According to the reference of the data in the entry of the C node, the geographical location information corresponding to the C node (i.e., C) can be obtained. Since each geographical location information corresponds to a geographical area, the geographical area corresponding to the C is also obtained when C is obtained.
[0081] Figure 3 It is a schematic diagram of rectangular area data. Usually two points can be used to define a rectangle, so each rectangular area can be represented by two points on the diagonal of the rectangle, the lower left and upper right points of the rectangle can be used to represent the rectangular area, or the upper right and lower left points can be used to represent the rectangular area. Figure 3 As shown, the rectangular area corresponding to A can be represented by the lower left point (x1, y1) and the upper right point (x2, y2).
[0082] Figure 4 It is a schematic diagram of the first data structure. The data of the rectangular areas corresponding to A and B are stored in the root node, and the data of the rectangular areas corresponding to the geographical areas of C to D are stored in the child nodes. Each node corresponds to a rectangular area and a disk page. The disk page of the child node stores the smallest rectangular areas corresponding to all the child nodes (for example, the rectangular areas corresponding to the geographical areas of C, D, E, F, K, and L). One child node corresponds to one smallest rectangular area. As can be seen from the above, one rectangular area corresponds to one geographical area, so one child node corresponds to one geographical area. The disk page of the root node stores the data of the circumscribed rectangular areas (for example, rectangular area A and rectangular area B) that surround all spatial objects. As shown Figure 4 As shown, a hierarchical structure is adopted for the storage of spatial geographic location data, for example, the topmost is a root node, and each root node has multiple child nodes.
[0083] Understandably, Figure 4 Just an example, Figure 3The geographical areas of C, D, E, F, K, and L can also be represented by a second-largest rectangle that is smaller than the rectangular area of A but larger than the rectangular area corresponding to C. The second-largest rectangle is used to frame part of the rectangular areas corresponding to the geographical areas of C, D, E, F, K, and L (for example, the rectangular areas corresponding to C, D, and E). In other words, a layer of nodes can be added between the root node and the above-mentioned child nodes. For example, the rectangular areas corresponding to C, D, and E are framed by rectangle #1, and the area framed by rectangle #1 is called rectangular area #1. The rectangular areas corresponding to F, K, and L are framed by rectangle #2, and the area framed by rectangle #2 is called rectangular area #2. The present application can also store the data of rectangular area #1 and the data of rectangular area #2 as the first child node in a disk page, and store the data of the rectangular areas corresponding to C / D / E below rectangular area #1 as the second child nodes in a disk page. A second child node corresponds to the data of a smallest rectangular area (for example, the data of the rectangular area corresponding to C). The present application does not limit this.
[0084] It can be seen that the child node corresponding to the smallest rectangular area (such as the second child node) is the lowest-level leaf node, and the root node is the highest-level node. The level of the child node between the root node and the leaf node (such as the first child node) is between the root node and the leaf node, that is, in the above example, the order of the node levels is that the root node is higher than the first child node and higher than the second child node. It can be understood that the child nodes between the root node and the leaf node also have their levels. For example, a third child node can be added between the first child node and the second child node. The rectangular area corresponding to the third child node is the rectangular area #3 that frames C and D. Then the first child node has a higher level than the third child node and higher than the second child node. For the sake of simplicity, examples are not given one by one.
[0085] An area enclosed by a rectangle is a rectangular area. When dividing rectangular areas, the rectangular areas that are close to each other can be divided into the same rectangular area, which is called rectangular area #1. Then the adjacent rectangular area #1 can be divided into the same larger rectangular area, and so on for higher-level rectangular area division until only two largest rectangular areas are left. These two largest areas include all geographic objects in the space. The data of the rectangular areas divided at each level are stored in the corresponding disk pages. The root node stores the data of the two largest rectangular areas, such as the data of rectangular area A and the data of rectangular area B. The child nodes store the data of the rectangular areas corresponding to C, D, E, F, K, and L under rectangular area A and the data of the rectangular areas corresponding to G, H, I, J, M, and N under rectangular area B, respectively, for easy search.
[0086] Exemplarily, according to the target longitude and latitude coordinates, the root node in the first data structure is searched, and the root node includes the data of the rectangular area A and the data of the rectangular area B, and it is determined whether the target longitude and latitude coordinates are in the rectangular area A or in the rectangular area B. For example, if the target longitude and latitude coordinates are in the rectangular area A, the rectangular area A corresponding to the target longitude and latitude coordinates is obtained when the root node is searched. Next, the child nodes C, D, E, F, K, and L pointed to by the root node storing the rectangular area A are traversed, and each child node stores the rectangular area corresponding to the child node (for example, the rectangular area corresponding to C / D / E / F / K / L), and one or more rectangular areas in C, D, E, F, K, and L corresponding to the target longitude and latitude coordinates are searched from the C, D, E, F, K, and L child nodes, that is, it is determined which one or more rectangular areas corresponding to C, D, E, F, K, and L the target longitude and latitude coordinates fall into. For example, if the target longitude and latitude coordinates are located in the rectangular area corresponding to C, then a rectangular area corresponding to the target longitude and latitude coordinates found from the first data structure is the rectangular area corresponding to C. For another example, if the target longitude and latitude coordinates are located in the rectangular area corresponding to E, then a rectangular area corresponding to the target longitude and latitude coordinates found from the first data structure is the rectangular area corresponding to E.
[0087] It can be understood that C~N in the example are the geographical location information (or geographical names) of geographical areas, and each geographical area corresponds to a minimum rectangular area. The rectangular boundary box of the minimum rectangular area can just frame the outline boundary of each geographical area. For the sake of convenience, the rectangular area corresponding to the geographical areas C~N in the example (that is, the minimum rectangular area) is called the rectangular area corresponding to C~N / the rectangular area of C~N.
[0088] When multiple geographic areas border each other, or when the outline boundaries of multiple geographic areas overlap, there will be overlapping areas between the multiple rectangular areas corresponding to the multiple geographic areas, such as Figure 4 The overlapping area between the rectangular area corresponding to K and the rectangular area corresponding to D in Figure 4 The data in the overlapping area between the rectangular area corresponding to K and the rectangular area corresponding to L can be called boundary data. When the target longitude and latitude coordinates are located in the overlapping area, there will be multiple data of the rectangular area corresponding to the target longitude and latitude coordinates found from the first data structure. For example, the target longitude and latitude coordinates are located in the overlapping area between the rectangular area corresponding to K and the rectangular area corresponding to L, then the two rectangular areas corresponding to the target longitude and latitude coordinates are the rectangular area corresponding to K and the rectangular area corresponding to D. The overlapping area between the rectangular area corresponding to K and the rectangular area corresponding to D is an example of the first area.
[0089] In one embodiment, the first data structure may be an R-tree. The first data structure may use an R-tree to store the geographical location information.
[0090] Optionally, the first data structure may also be an R+ tree (R+-Tree) or an R* tree (R*-Tree).
[0091] R-tree divides spatial objects by range. Each node corresponds to a region and a disk page. The disk page of a non-leaf node stores the region range of all its child nodes. The regions of all child nodes of a non-leaf node fall within its region range. The disk page of a leaf node stores the bounding rectangle of all spatial objects within its region range. R-tree supports dynamic insertion, deletion, and update of MBR data corresponding to geographic location information.
[0092] R-tree is a tree data structure used to process multidimensional spatial data, and is used to access spatial data composed of two-dimensional or higher-dimensional regional objects. R-tree is a balanced tree. There are two types of nodes on the tree: leaf nodes and non-leaf nodes. Each node consists of several index items. For leaf nodes, the index item is in the form of (Index, Obj_ID). Among them, Index represents the minimum circumscribed rectangle MBR surrounding the spatial object (for example, the rectangle corresponding to C~N), and Obj_ID identifies a spatial object (for example, C~N). For a non-leaf node, its index item is in the form of (Index, Child_Pointer). Child_Pointer points to the child node of the node. Index still refers to a rectangular area that surrounds the minimum rectangular area of all index item MBRs on the child node.
[0093] R-tree uses a hierarchical structure to divide the space into multiple largest MBRs (such as rectangle A or rectangle B). These largest MBRs add up to include all objects in the space. When searching (or searching / querying / indexing, etc.), these large MBRs are searched first, and then the nodes in the largest MBR are searched (such as C, D, E, F, K, L leaf nodes under A non-leaf node). The smallest MBR that meets the requirements (such as the rectangles corresponding to C, D, E, F, K, L) can be quickly retrieved. The search of R-tree is similar to the search of map. An R-tree can be regarded as a map, which consists of area A and area B. Area A consists of areas C, D, E, F, K, and L, and area B consists of areas G, H, I, J, M, and N. When querying the R-tree, the MBR that meets the requirements is searched by continuously narrowing the scope, for example, searching from area A to areas C, D, E, F, K, and L, and then traversing areas C, D, E, F, K, and L to obtain the MBR that meets the target longitude and latitude coordinates. Since the MBRs in the R-tree are intersecting (for example, the rectangle corresponding to K and the rectangle corresponding to D), when the target longitude and latitude coordinates fall into the intersecting area (that is, the area where the rectangular area corresponding to K overlaps with the rectangular area corresponding to D), there may be multiple MBRs that meet the requirements finally obtained from the R-tree search.
[0094] For example, Figure 4 The rectangular areas A and B in the image are stored in non-leaf nodes, and the rectangular boxes corresponding to C~N are stored in leaf nodes. When searching, search from non-leaf nodes first, that is, start with A and B, determine one of A and B, and then filter the child nodes pointed to by Child_Pointer in A and B. For example, after determining node A, filter the child nodes C, D, E, F, K, and L pointed to by node A. As can be seen from the above, Figure 4 C, D, E, F, K, and L in the figure are the smallest MBRs that enclose the space object. Figure 4The child nodes C, D, E, F, K, and L in are leaf nodes. Traverse the leaf nodes C, D, E, F, K, and L to determine one or more leaf nodes. Each of the one or more leaf nodes stores a minimum MBR. Therefore, the one or more leaf nodes correspond to one or more geographic location information one by one, and the one or more geographic location information corresponding to the target longitude and latitude coordinates can be obtained. The one or more geographic location information corresponds to one or more geographic areas one by one. Therefore, one or more geographic areas corresponding to the one or more geographic location information can also be obtained according to the target longitude and latitude coordinates. For example, the leaf nodes corresponding to the target longitude and latitude coordinates are C / D / E / F / K / L, or the leaf nodes corresponding to the target longitude and latitude coordinates are K and D, or the leaf nodes corresponding to the target longitude and latitude coordinates are K and L. When there are two leaf nodes corresponding to the target longitude and latitude coordinates, the target longitude and latitude coordinates are located in the overlapping area of two rectangular areas.
[0095] R+ tree is an optimized spatial index data structure. As a variant of R-tree, it improves the query efficiency of spatial data by avoiding child node overlap and allowing multiple insertions of spatial objects. In order to avoid child node overlap, R+ tree allows the same spatial object (such as the geographic area corresponding to C~N) to be inserted into multiple leaf nodes. When a spatial object intersects with multiple child nodes, the spatial object is cut into multiple parts so that each part only intersects with one child node. In addition, the nodes of R+ tree do not intersect with each other. R+ tree also supports dynamic insertion, deletion and update of MBR data corresponding to geographic location information.
[0096] R* tree is also a variant of R-tree. R* tree allows rectangular overlap like R tree, but in the construction algorithm, R* tree not only considers the "area" of index space, but also considers the overlap of index space. This method improves the node insertion and splitting algorithm, and uses the "forced reinsert" method to optimize the tree structure. R* tree also supports dynamic insertion, deletion and update of MBR data corresponding to geographic location information.
[0097] Optionally, a first data structure is initialized and constructed.
[0098] S130: Use a ray method to check multiple geographical areas corresponding to the multiple target rectangular areas to obtain a first geographical area, the multiple target rectangular areas correspond to the multiple geographical areas one by one, and the target longitude and latitude coordinates are located in the first geographical area.
[0099] Specifically, according to the position of the target longitude and latitude coordinates, a ray is made to pass through the multiple geographical areas, so that the ray forms an intersection with the contour boundaries of the multiple geographical areas; according to the number of intersections formed with the contour boundaries of the multiple geographical areas, the first geographical area is obtained by screening, and the first geographical area is a geographical area among the multiple geographical areas in which the number of intersections formed by the ray with the contour boundaries of the multiple geographical areas is an odd number.
[0100] The ray method determines whether point P falls within an area Z by scanning rays in a 360-degree direction drawn from a point P. When the number of intersections between the ray drawn from point P and the boundary of area Z is an odd number, point P is within area Z; when the number of intersections between the ray drawn from point P and the boundary of area Z is an even number, point P is outside area Z.
[0101] Figure 5 Schematic diagram of multiple geographic areas for ray casting. Figure 5 As shown, if the target longitude and latitude coordinates are coordinate point #1, coordinate point #1 is located in the overlapping area of the rectangular area corresponding to K and the rectangular area corresponding to D. Therefore, the rectangular area obtained from the first data structure according to S120 is the rectangular area corresponding to K and the rectangular area corresponding to D, wherein the rectangular area corresponding to K corresponds to the geographical area of K, and the rectangular area corresponding to D corresponds to the geographical area of D. A ray is drawn from coordinate point #1 as the starting point. The ray enters the geographical area of D and then passes through the geographical area of D, that is, the ray has two intersection points with the contour boundary of the geographical area of D (such as Figure 5 ), one of the intersection points is on the boundary line between K's geographical area and D's geographical area, so the ray has only one intersection point with the contour boundary of K's geographical area, from which it can be determined that coordinate point #1 is in K's geographical area, but not in D's geographical area. The ray method is then used to obtain K's geographical area corresponding to coordinate point #1, and K's geographical area is an example of the first geographical area.
[0102] For another example, if the target longitude and latitude coordinates are coordinate point #2, coordinate point #2 is located in the overlapping area of the rectangular area corresponding to K and the rectangular area corresponding to L. According to S120, the rectangular areas obtained from the first data structure are the rectangular areas corresponding to K and the rectangular areas corresponding to L. Using the ray method, a ray is drawn with coordinate point #2 as the starting point. The ray enters the geographical area of K and then passes through the geographical area of K. Therefore, the coordinate point has two intersection points with the contour boundary of the geographical area of K, but only one intersection point with the contour boundary of the geographical area of L. Therefore, coordinate point #2 is in the geographical area of L, but not in the geographical area of K. Therefore, the ray method is used to obtain the geographical area of L corresponding to coordinate point #1. The geographical area of L is an example of the first geographical area.
[0103] It can be understood that C~N in this application represents the geographic location information of a certain entity object in space, that is, the location information mentioned above. The C~N can be information such as country, province, city, district, county, road, house number, POI, etc.
[0104] S140: Output first geographical location information corresponding to the first geographical area.
[0105] The first geographical area, such as the geographical area of K or the geographical area of L, can be obtained by step S130. It can be seen that one geographical area corresponds to one geographical location information (or referred to as geographical location name / geographic object name / spatial object name, etc.). For example, the geographical location information corresponding to the geographical area of K is K, and K is the geographical location information corresponding to the geographical area of K; and the geographical location information corresponding to the geographical area of L is L, and L is the geographical location information corresponding to the geographical area of L. K / L are both examples of the first geographical location information.
[0106] In one way, step S120 shows that, in one way, a target rectangular area corresponding to the target longitude and latitude coordinates is found from the first data structure, such as a rectangular area corresponding to C, a rectangular area corresponding to E, etc. Each rectangular area corresponds to a geographic area, such as a rectangular area corresponding to C corresponds to a geographic area of C, and each geographic area corresponds to a geographic location information, such as the geographic location information corresponding to the geographic area of C is C. Therefore, the first geographic area can also be a geographic area corresponding to the target rectangular area, and the first geographic location information can also be a geographic location information corresponding to the geographic area. C / E are both examples of the first geographic location information.
[0107] It should be noted that the target longitude and latitude coordinates will also be located in the area where rectangular area A overlaps with rectangular area B, such as Figure 2 As shown, the geographical area of F, the geographical area of G and part of the geographical area of D fall into the overlapping area. According to step S120, rectangular area A and rectangular area B are obtained. If the target longitude and latitude coordinates are in the geographical area of F / geographical area of G / geographical area of D covered by the overlapping area, the ray method can still be used to check the three geographical areas of F, G and D to obtain the geographical area where the target longitude and latitude coordinates are located, thereby obtaining the geographical location information corresponding to the geographical area. The ray method can be used when there are multiple rectangular area data, and it is not limited to use only when there are multiple minimum rectangular areas (i.e., rectangular areas that just frame the geographical area). The examples in the above embodiments are only for schematic illustration.
[0108] Figure 6 A schematic flowchart of a reverse geocoding method 200 provided in an embodiment of the present application.
[0109] Figure 6 for Figure 1 A specific embodiment of Figure 6 A reverse geocoding method 200 is provided in which the first data structure is an R-tree, comprising the following steps:
[0110] S210, obtaining the target longitude and latitude coordinates.
[0111] S220, determine whether to initialize and construct an R-tree.
[0112] S230 , if the R-tree is to be constructed by initialization, then an R-tree is constructed, and the R-tree includes data of rectangular areas corresponding to all spatial objects to be searched. The constructed R-tree can refer to S120 in method 100 .
[0113] S240: If it is not necessary to initialize and construct an R-tree, the target longitude and latitude coordinates are entered, and the data of the rectangular area is obtained from the existing R-tree.
[0114] The rectangular area corresponds to the geographical area one by one, and the geographical area corresponds to the geographical location information, so the geographical location information corresponds to the rectangular area.
[0115] Therefore, obtaining the target latitude and longitude coordinates can obtain the geographical area corresponding to the rectangular area.
[0116] It can be known from method 100 that, among all geographic regions corresponding to all geographic location information in space, data of a rectangular region corresponding to each geographic region is stored in a leaf node of the R-tree, so each leaf node corresponds to a geographic region, and the geographic region corresponds to the geographic location information of the geographic region. When reverse geocoding is required, the leaf node corresponding to the target longitude and latitude coordinates can be found by searching the R-tree, that is, the target longitude and latitude coordinates are located in the rectangular region corresponding to the target longitude and latitude coordinates, and the rectangular region corresponds to the geographic region, so the geographic region corresponding to the target longitude and latitude coordinates can be obtained, and the geographic region corresponds to the geographic location information, so the geographic location information corresponding to the target longitude and latitude coordinates can also be obtained.
[0117] Specifically, according to the target longitude and latitude coordinates, recursively search for suitable non-leaf nodes starting from the root node until the leaf node, traverse the leaf nodes, and then obtain the data of the rectangular area corresponding to the target longitude and latitude coordinates.
[0118] It can be understood that by obtaining the data of the rectangular area, the data of the geographical area corresponding to the rectangular area can be obtained, and the geographical location information of the geographical area corresponding to the rectangular area can also be obtained.
[0119] It should be noted that the geographic location information in this application can also be referred to as geographic location information data, geographic data, location data, spatial data, etc. It can be understood that these data are data that carry geographic location information, and this application does not limit the name of the data.
[0120] S250: Determine whether the number of data in the rectangular area obtained by the query is 0. If it is 0, end the reverse geocoding.
[0121] In one method, the location information of the target latitude and longitude coordinates can be inserted into the R-tree as a new spatial object, and the appropriate non-leaf nodes are selected step by step downward according to the rectangular area corresponding to the spatial object until the non-leaf node in the previous layer of the leaf node, and then the spatial object is inserted as a new leaf node under the non-leaf node.
[0122] S260. When the number of data in the rectangular area obtained by the query is not 0, determine whether the number of data in the rectangular area is 1. If it is 1, output the geographic location information of the geographic area corresponding to the 1 rectangular area, and use the geographic location information for geocoding.
[0123] S270. When the number of data in the rectangular area obtained by the query is not 1, that is, the number of data in the rectangular area is greater than 1, the geographical areas corresponding to these rectangular areas are checked by using the ray method to obtain the first geographical area corresponding to the target longitude and latitude coordinates, output the first geographical location information corresponding to the first geographical area, and use the first geographical location information for geocoding.
[0124] The specific implementation of using the ray method to check the geographical area corresponding to the rectangular area can be found in step S130 of method 100, which will not be described in detail here.
[0125] In the present application, the data of the rectangular area corresponding to the target longitude and latitude coordinates can be quickly screened through the R-tree. When the amount of data in the rectangular area is greater than 1, that is, the location of the target longitude and latitude coordinates is located in the overlapping area of the rectangular areas corresponding to multiple leaf nodes, the ray method can be used to screen the multiple geographic areas corresponding to the multiple rectangular areas to accurately obtain the geographic location information of a geographic area corresponding to the target longitude and latitude coordinates, that is, to obtain the precise location information of the target longitude and latitude coordinates, which effectively solves the problems existing in the Geohash algorithm, and can accurately query the geographic location information without any complex logic and additional logic overhead, and efficiently and quickly query the geographic location information that meets the requirements, thereby maintaining the accuracy of the index; in addition, it can also support the insertion, deletion and update of the data of the rectangular area corresponding to the geographic area corresponding to the geographic location information, and promptly handle the changes in the geographic location information to maintain the timeliness of the index.
[0126] The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0127] In the various embodiments of the present application, unless otherwise specified or provided for in any logical conflict, the terms and / or descriptions between the different embodiments are consistent and may be referenced to each other, and the technical features in the different embodiments may be combined to form new embodiments according to their inherent logical relationships.
[0128] Figure 7 The schematic structural block diagram of a reverse geocoding device 300 provided in an embodiment of the present application, the device 300 may include an acquisition module 310, a processing module 320, and an output module 330.
[0129] The acquisition module 310 is used to acquire the longitude and latitude coordinates of the target.
[0130] The processing module 320 is used to search for data of multiple target rectangular areas corresponding to the target longitude and latitude coordinates from a first data structure, the multiple target rectangular areas include an overlapping first area, and the target longitude and latitude coordinates are located in the first area; and is also used to use a ray method to check multiple geographical areas corresponding to the multiple target rectangular areas to obtain a first geographical area, the multiple target rectangular areas correspond one-to-one to the multiple geographical areas, and the target longitude and latitude coordinates are located in the first geographical area.
[0131] The output module 330 is used to output first geographical location information corresponding to the first geographical area.
[0132] Figure 8 A reverse geocoding device 400 is also provided for the embodiment of the present application, including a processor 410 , a memory 420 , a bus interface 430 , and a user interface 440 .
[0133] Optionally, the reverse geocoding device 400 can be applied to the reverse geocoding method in the embodiment of the present application, and the processor 410 implements the corresponding processes in each method of the reverse geocoding method embodiment when executing, which will not be described here for brevity.
[0134] Optionally, the reverse geocoding device 400 also includes a computer program stored in the memory and executable on the processor, and when the computer program runs on the processor 410, the processor 410 executes the corresponding processes in the various methods of the embodiments of the present application, which will not be described in detail here for the sake of brevity.
[0135] exist Figure 8In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by processor 410 and various circuits of memory represented by memory 420 are linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described in this application. The bus interface 430 provides an interface. For different user devices, the user interface 440 may also be an interface that can be connected to external or internal devices, and the connected devices include but are not limited to keypads, displays, speakers, microphones, joysticks, etc.
[0136] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program.
[0137] Optionally, the computer-readable storage medium can be applied to the reverse geocoding method in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes in the various methods in the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0138] An embodiment of the present application also provides a computer program product, including computer program instructions.
[0139] Optionally, the computer program product can be applied to the reverse geocoding method in the embodiments of the present application, and the computer program instructions enable the computer to execute the corresponding processes in the various methods in the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0140] The embodiment of the present application also provides a computer program.
[0141] Optionally, the computer program can be applied to the reverse geocoding method in the embodiments of the present application. When the computer program runs on a computer, the computer executes the corresponding processes in the various methods in the embodiments of the present application. For the sake of brevity, they are not described here.
[0142] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0143] It should be understood that the specific examples in this article are only intended to help those skilled in the art better understand the embodiments of the present application, rather than to limit the scope of the embodiments of the present application.
[0144] It should also be understood that the various implementation methods described in this specification can be implemented individually or in combination, and the embodiments of the present application are not limited to this.
[0145] Unless otherwise stated, all technical and scientific terms used in the embodiments of the present application are the same as the meanings generally understood by those skilled in the art of the technical field of the application. The terms used in the present application are only for the purpose of describing specific embodiments, and are not intended to limit the scope of the present application. The singular forms "a kind of", "above" and "the" used in the embodiments of the present application and the appended claims are also intended to include majority forms, unless the context clearly indicates other meanings. In addition, the terms "first", "second" etc. are only used for description purposes, and cannot be interpreted as indicating or suggesting relative importance.
[0146] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0147] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0148] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0149] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0150] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A reverse geocoding method, characterized in that: include: Get the target latitude and longitude coordinates; Searching for data of a plurality of target rectangular areas corresponding to the target longitude and latitude coordinates from a first data structure, wherein the plurality of target rectangular areas include an overlapping first area, and the target longitude and latitude coordinates are located in the first area; Using a ray method, multiple geographical areas corresponding to the multiple target rectangular areas are checked to obtain a first geographical area, the multiple target rectangular areas correspond to the multiple geographical areas one by one, and the target longitude and latitude coordinates are located in the first geographical area; The first geographical location information corresponding to the first geographical area is output.
2. The method according to claim 1, characterized in that The first data structure supports dynamic insertion, deletion and update of data of a rectangular area corresponding to the geographical area corresponding to the geographical location information.
3. The method according to claim 1 or 2, characterized in that: Using a ray method to screen multiple geographical areas corresponding to the multiple target rectangular areas to obtain a first geographical area includes: Drawing a ray to cross the multiple geographical areas according to the location of the target latitude and longitude coordinates, so that the ray forms an intersection with the contour boundaries of the multiple geographical areas; The first geographical area is obtained by screening out according to the number of intersections formed with the contour boundaries of the multiple geographical areas.
4. The method according to claim 3, characterized in that The first geographical area is a geographical area among the multiple geographical areas, and the number of intersection points formed by the ray and the contour boundaries of the multiple geographical areas is an odd number.
5. The method according to any one of claims 1 to 4, characterized in that The target rectangular area is an area of a first rectangle, and the first rectangle can frame the outline boundary of the geographical area corresponding to the target longitude and latitude coordinates.
6. The method according to any one of claims 1 to 5, characterized in that The first data structure is an R-tree, the data of the multiple target rectangular areas are stored in leaf nodes of the R-tree, and each leaf node of the R-tree corresponds to a geographical area.
7. A reverse geocoding device, characterized in that: The device comprises: An acquisition module is used to obtain the target longitude and latitude coordinates; A processing module, configured to search for data of a plurality of target rectangular areas corresponding to the target longitude and latitude coordinates from a first data structure, wherein the plurality of target rectangular areas include an overlapping first area, and the target longitude and latitude coordinates are located in the first area; The processing module is further used to use a ray method to screen multiple geographical areas corresponding to the multiple target rectangular areas to obtain a first geographical area, the multiple target rectangular areas correspond to the multiple geographical areas one by one, and the target longitude and latitude coordinates are located in the first geographical area; The output module is used to output the first geographical location information corresponding to the first geographical area.
8. A reverse geocoding device, characterized in that: The reverse geocoding device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program runs on the processor, the method according to any one of claims 1 to 6 is executed.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is run on a computer, the method according to any one of claims 1 to 6 is executed.
Citation Information
Cited By
City code verification method and device, vehicle and computer program product
CN119782592A
