Geographic target query method and device, electronic equipment and storage medium
By quickly filtering out the target points of the specified query range using the latitude and longitude information of the geographical target, the problem of increasing system burden and storage demand caused by frequent updates of data in the existing technology is solved, and an efficient and simple geographical target query method is achieved.
Patent Information
- Application Number
- CN202411681884.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-18
AI Technical Summary
When the existing geographic target query method processes frequently updated data, it needs to rebuild the index, increase the system burden, and requires additional storage space and maintenance costs, which is more complex.
通过利用地理目标的经纬度信息,快速筛选出指定查询范围的目标点,无需使用复杂的数据结构。具体步骤包括获取查询条件和地理目标的经纬度信息,利用参照目标的经纬度信息和查询条件确定查询范围,并根据候选目标的经纬度信息确定在查询范围内的地理目标。
It achieves rapid screening of geographical targets, reduces the need for computing distances, avoids the use of complex data structures, reduces system burden and storage requirements, and is easy to integrate with existing systems.
Smart Images

Figure CN119474246A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to positioning query technology, and in particular to a geographic target query method, device, electronic equipment and storage medium. Background Art
[0002] In geographic information system and location service applications, it is often necessary to query other target points within a certain range near a fixed point. The existing implementation solutions mainly include brute force search method and spatial index method. The brute force search method needs to traverse all points on the map and calculate the distance between each point and the given reference point to screen the target points that meet the conditions. The calculation is large and the efficiency is low. In remote areas or areas with infrequent updates, there will be problems of inaccurate and incomplete data. The spatial index method usually uses spatial index structures such as R-tree and quadtree to quickly locate points in the target area. However, if the data changes frequently, the index needs to be rebuilt for each update, which increases the system burden and requires additional storage space and maintenance costs, and the implementation complexity is relatively high. Summary of the invention
[0003] Based on this, the present invention provides a geographic target query method, device, electronic device and storage medium, which can use the latitude and longitude information of the geographic target to quickly filter out target points in a specified query range without using a complex data structure.
[0004] In a first aspect, the present invention provides a geographic target query method, comprising:
[0005] Obtain query conditions and latitude and longitude information of each geographic target, where the geographic targets include reference targets and candidate targets;
[0006] Determine the query scope using the latitude and longitude information of the reference target and the query conditions;
[0007] The geographical targets within the query range are determined based on the latitude and longitude information of each candidate target.
[0008] Furthermore, the query range is determined by using the latitude and longitude information of the reference target and the query condition, including:
[0009] With the reference target as the center, the boundaries of the query range are calculated and confirmed using the latitude and longitude information of the reference target and the query conditions.
[0010] Furthermore, the boundary of the query range includes a longitude boundary and a latitude boundary, and determining the query range using the latitude and longitude information of the reference target and the query condition includes:
[0011] Calculate the longitude and latitude boundaries using the longitude and latitude information of the reference target and the query radius;
[0012] Determine the vertices of the query range based on the longitude and latitude boundaries.
[0013] Further, calculating the longitude boundary using the longitude and latitude information of the reference target and the query radius includes:
[0014] Calculate the longitude offset as follows:
[0015]
[0016] in, Indicates the longitude offset, represents the query radius, represents the average radius of the Earth, Indicates the latitude of the reference target;
[0017] The longitude boundary of the query range is the longitude of the reference target ± .
[0018] Further, calculating the latitude boundary using the latitude and longitude information of the reference target and the query radius includes:
[0019] The latitude offset is calculated as follows:
[0020]
[0021] in, Indicates the latitude offset, represents the query radius, represents the average radius of the Earth;
[0022] The latitude boundary of the query range is the latitude of the reference target ± .
[0023] Furthermore, the vertices of the query range determined according to the longitude boundary and the latitude boundary include:
[0024] Let the latitude and longitude information of the reference target be expressed as , represents the longitude of the reference target, represents the latitude of the reference target, and the vertices of the query range are represented as , , , .
[0025] Furthermore, the geographical targets within the query range are determined according to the latitude and longitude information of each candidate target, including:
[0026] The latitude and longitude information of each candidate target is compared with the boundary of the query range, and the geographical targets whose latitude is within the latitude boundary of the query range and whose longitude is within the longitude boundary of the query range are determined as query results.
[0027] In a second aspect, the present invention provides a geographic target query device, comprising:
[0028] A data acquisition module is used to obtain query conditions and latitude and longitude information of each geographic target, where the geographic targets include reference targets and candidate targets;
[0029] A query range determination module, used to determine the query range using the latitude and longitude information of the reference target and the query condition;
[0030] The geographic target determination module determines the geographic targets within the query range based on the latitude and longitude information of each candidate target.
[0031] In a third aspect, the present invention provides an electronic device, comprising a memory storing computer executable instructions and a processor, wherein when the computer executable instructions are executed by the processor, the device executes each step of the geographic target query method provided in the first aspect.
[0032] In a fourth aspect, the present invention provides a readable storage medium storing a computer executable program, which, when executed, can implement the various steps of the geographic target query method provided in the first aspect.
[0033] It can be seen from the above technical solutions that the present invention has the following beneficial effects:
[0034] The present invention provides a geographic target query method, which uses the latitude and longitude information of a reference point and a query condition to determine a specified area, and then determines that the geographic targets in the specified area are query results that need to be presented according to the latitude and longitude information of each candidate target, and quickly screens each geographic target on the map based on the latitude and longitude range, without the need to calculate the distance to the reference target one by one for judgment, without the need for a complex data structure, and is simpler to implement; the calculation efficiency of using the latitude and longitude information is higher, and the number of points that need to accurately calculate the distance can be reduced; the query method provided by the present invention has a small memory occupancy, does not need to configure additional index storage space, is easy to integrate with an existing system, and has no special requirements for the data storage format. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0036] Figure 1 is a flowchart of a geographic target query method provided by an embodiment of the present invention;
[0037] Figure 2 is a schematic diagram of a query range provided by an embodiment of the present invention;
[0038] Figure 3 is a structural diagram of a geographic target query device provided by an embodiment of the present invention;
[0039] Figure 4 This is a diagram of the electronic device architecture provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] Longitude and latitude are spherical coordinate systems based on the earth's surface. They are applicable to the entire world. Any location on the earth can be accurately identified using longitude and latitude without considering different projection methods or coordinate system conversions. Most geographic information systems (GIS), navigation equipment, and map services use longitude and latitude coordinates by default, so longitude and latitude can be easily connected to these systems. In addition, longitude and latitude can be accurate to multiple decimal places, achieving centimeter-level spatial accuracy, which is suitable for geographic applications with different precision requirements. Due to the universality of longitude and latitude, it is more efficient and convenient to use longitude and latitude as a unified standard in cross-platform, cross-regional, and cross-language systems, and no coordinate conversion is required when sharing data sets.
[0042] Based on the advantages of longitude and latitude in representing geographic location, the following embodiments of the present invention provide a geographic target query method, device, electronic device and storage medium, which use the longitude and latitude information of the geographic target to quickly filter out target points in a specified query range without using a complex data structure.
[0043] See also Figure 1 An embodiment of the present invention provides a geographic target query method, comprising the following steps:
[0044] Step S110: Acquire query conditions and longitude and latitude information of each geographic target, where the geographic targets include reference targets and candidate targets.
[0045] In this step, the reference target is the center point of the query, that is, the reference target is used as the query center or base point, and the candidate targets that meet specific conditions are screened based on the geographical location of a certain reference target. The candidate targets usually include various geographical target points that have been recorded by the system in addition to the reference target in the geographic information system, such as landmark buildings, restaurants, schools, hospitals, etc. Query conditions are usually used to filter candidate targets. Usually, conditions such as query radius, target type, and accuracy requirements can be set. For example, the query condition can be all geographical target points within a certain distance from the reference target, or multiple query conditions can be used in combination, such as restaurants and stores within a certain distance from the reference target. It can also be filtered by keywords, such as geographical target points named "XXX" within a certain distance from the reference target.
[0046] The latitude and longitude information of geographic targets can be obtained by using the API interfaces of existing map databases to obtain the latitude and longitude of eligible geographic targets, or by directly querying the stored geographic data from the database (such as PostGIS, MongoDB geographic query) to extract candidate targets by specifying filtering conditions such as reference points and radius.
[0047] In a further embodiment, the candidate targets may be further screened, for example, only restaurants with high scores, places closer to the reference target, stores with business hours in a certain time period, etc. are retained.
[0048] Step S120: Determine the query range using the latitude and longitude information of the reference target and the query conditions.
[0049] In this step, the latitude and longitude information of the reference target and the query condition are used to determine the boundary of the query range, and the boundary is used to define the specified query range, and the reference target is used as the reference point of the query range. The query radius is used as the query condition, which is usually used to define the range extending outward from the reference target, or the azimuth is used as the query condition, for example, within 1km north of the reference target.
[0050] In a further embodiment, the boundaries of the query range include longitude boundaries and latitude boundaries, which are calculated using the longitude and longitude information of the reference target and the query radius, and the vertices of the query range are determined based on the longitude boundaries and latitude boundaries.
[0051] Specifically, this embodiment uses the latitude and longitude of the reference target and the query conditions to define an approximately rectangular query range. According to a given query radius, the offset relative to the latitude and longitude of the reference target is calculated to determine the coordinates of the four vertices of the query range. The coordinates mentioned in this embodiment are represented by longitude and latitude information.
[0052] The calculation of longitude offset is: , the latitude offset is , Indicates the longitude offset, Indicates the latitude offset, represents the query radius, represents the average radius of the Earth, Indicates the latitude of the reference target, then the longitude boundary of the query range is the longitude of the reference target ± , the latitude boundary is the latitude of the reference target ± .
[0053] From the calculation expression of longitude offset, we can know that this expression is used to calculate the change in longitude corresponding to a specific distance along the latitude line at a given latitude. When moving a straight line distance r along the latitude circle at latitude lat, the longitude difference is actually the central angle corresponding to the distance r, and the angle = radians × 180° / , radian = arc length / circle radius, arc length is the query radius r, then the radius of the latitude circle where the reference target is located is R×cos(lat). As the latitude increases, cos(lat) becomes smaller, resulting in a larger change in longitude corresponding to the same distance, and the longitude lines in high latitudes are closer.
[0054] Similarly, the calculation expression of latitude offset is used to calculate the latitude change corresponding to a specific distance along the meridian. Latitude offset = query radius r center angle, and center angle = radians * (180° / ), because the radius r is on the longitude, the radian corresponding to r = r / earth radius R.
[0055] like Figure 2 As shown in the figure, the query boundary is represented by an approximate rectangular area enclosed by the minimum longitude line, the maximum longitude line, the maximum latitude line, and the minimum latitude line. Figure 2 The four red dots in the figure represent the vertices of the query range. Let the latitude and longitude information of the reference target be expressed as , the vertices of the query range determined by the above embodiment are respectively expressed as , , , , the boundaries of the query range are defined by four vertices.
[0056] Step S130: Determine the geographical targets within the query range according to the latitude and longitude information of each candidate target.
[0057] In this step, the longitude and latitude of each candidate target are determined to be within the defined query range boundary. Targets within the boundary are within the query range. Specifically, the longitude and latitude information of each candidate target can be compared with the boundary of the query range to determine that the geographical targets whose latitude is within the latitude boundary of the query range and whose longitude is within the longitude boundary of the query range are the query results.
[0058] The above-mentioned embodiments provide a geographic target query method, which uses the latitude and longitude information of the reference point and the query conditions to determine the specified area, and then determines the geographic targets in the specified area as the query results that need to be presented based on the latitude and longitude information of each candidate target. The geographic targets on the map are quickly screened based on the latitude and longitude range. There is no need to calculate the distance to the reference target one by one to make a judgment, and no complex data structure is required. The implementation is simpler, and there is no need to configure additional index storage space. It is easy to integrate with existing systems and has no special requirements for data storage formats.
[0059] The above method disclosed can be implemented by using various forms of equipment, so the present invention also discloses a geographic target query device corresponding to the above method, and a specific embodiment is given below for detailed description.
[0060] like Figure 3 As shown, an embodiment of the present invention provides a geographic target query device, including:
[0061] The data acquisition module 302 is used to acquire the query conditions and the longitude and latitude information of each geographical target, where the geographical targets include reference targets and candidate targets;
[0062] A query range determination module 304, used to determine the query range using the latitude and longitude information of the reference target and the query condition;
[0063] The geographic target determination module 306 determines the geographic targets within the query range according to the latitude and longitude information of each candidate target.
[0064] The implementation principle and technical effects of the device provided in the embodiments of the present application are the same as those of the aforementioned method embodiments. For the sake of brief description, for matters not mentioned in the device embodiments, reference may be made to the corresponding contents in the aforementioned method embodiments.
[0065] The methods and related devices mentioned in the above embodiments are described with reference to the method flow charts and / or structural diagrams provided in the embodiments of the present application. Specifically, each process and / or block in the method flow charts and / or structural diagrams, as well as the combination of processes and / or blocks in the flow charts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0066] The following embodiments are described by taking the method applied to a computer device as an example. It can be understood that the computer device can be any device with computing and processing functions, and can be but not limited to a server or a personal laptop computer, etc. In one embodiment, the computer device can be an application server, and the application server can be a server for running an application to be tested.
[0067] See also Figure 4 , which shows a hardware block diagram of an electronic device, the electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0068] like Figure 4 As shown, the electronic device includes: at least one processor 1, at least one communication interface 2, at least one memory 3 and at least one communication bus 4;
[0069] In the embodiment of the present application, the number of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 is at least one, and the processor 1, the communication interface 2, and the memory 3 communicate with each other through the communication bus 4;
[0070] The processor 1 may be a central processing unit CPU, or an application-specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention, etc.;
[0071] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), etc., such as at least one disk memory;
[0072] The memory stores a program, and the processor can call the program stored in the memory, and the program is used to: implement each processing flow of the aforementioned geographic target query solution.
[0073] An embodiment of the present invention further provides a readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the processing flow of the geographic target query solution provided in the above embodiment and / or any possible implementation method in combination with the embodiment is implemented.
[0074] The above-mentioned embodiments have described the present invention in particular detail with respect to possible scenarios, and those skilled in the art will recognize that the present invention can be practiced through other embodiments. The specific naming of components, the capitalization of terms, attributes, data structures, or any other programming or structural aspects are not mandatory or important, and the mechanisms or features of the present invention may have different names, forms, or procedures. The system may be implemented by a combination of hardware and software (as described), entirely by hardware elements, or entirely by software elements. The specific division of functions between the various system components described herein is exemplary only and not mandatory; on the contrary, the functions performed by a single system component may be performed by multiple components, or the functions performed by multiple components may be performed by a single component.
[0075] Those skilled in the art should understand that the various steps of the above disclosed method can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented with program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0076] These computing device executable programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors, and these computing programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0077] Certain aspects of the present invention include process steps and instructions described herein in the form of algorithms. It should be noted that the process steps and instructions of the present invention can be implemented in software, firmware and / or hardware, and when implemented by software, it can be downloaded, stored on different platforms used by various operating systems and operated from the platforms.
[0078] Those skilled in the art will understand that the structures shown in the accompanying drawings are merely block diagrams of partial structures related to the scheme of the present application, and do not constitute a limitation on the terminal device to which the scheme of the present application is applied. The specific terminal device may include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
[0079] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "possible design" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0080] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A geographic target query method, characterized in that: include: Acquire query conditions and latitude and longitude information of each geographic target, wherein the geographic target includes a reference target and a candidate target; Determine the query range using the latitude and longitude information of the reference target and the query condition; The geographical target within the query range is determined according to the latitude and longitude information of each candidate target.
2. The method according to claim 1, characterized in that: Determining the query range by using the latitude and longitude information of the reference target and the query condition includes: Taking the reference target as the center, the boundary of the query range is calculated using the latitude and longitude information of the reference target and the query conditions.
3. The method according to claim 2, characterized in that The boundary of the query range includes a longitude boundary and a latitude boundary. Determining the query range using the latitude and longitude information of the reference target and the query condition includes: Calculating the longitude boundary and the latitude boundary using the longitude and latitude information of the reference target and the query radius; The vertex of the query range is determined according to the longitude boundary and the latitude boundary.
4. The method according to claim 3, characterized in that Calculating the longitude boundary using the longitude and latitude information of the reference target and the query radius includes: Calculate the longitude offset as follows: in, Indicates the longitude offset, represents the query radius, represents the average radius of the Earth, Indicates the latitude of the reference target; The longitude boundary of the query range is the longitude of the reference target ± .
5. The method according to claim 3, characterized in that: Calculating the latitude boundary using the latitude and longitude information of the reference target and the query radius includes: The latitude offset is calculated as follows: in, Indicates the latitude offset, represents the query radius, represents the average radius of the Earth; The latitude boundary of the query range is the latitude of the reference target ± .
6. The method according to claim 3, characterized in that The vertices of the query range determined according to the longitude boundary and the latitude boundary include: Let the latitude and longitude information of the reference target be expressed as , represents the longitude of the reference target, represents the latitude of the reference target, and the vertices of the query range are represented as , , , .
7. The method according to claim 3, characterized in that Determining the geographical targets within the query range according to the latitude and longitude information of each candidate target includes: The latitude and longitude information of each candidate target is compared with the boundary of the query range, and the geographical targets whose latitude is within the latitude boundary of the query range and whose longitude is within the longitude boundary of the query range are determined as query results.
8. A geographic target query device, characterized in that: include: A data acquisition module is used to obtain query conditions and latitude and longitude information of each geographic target, where the geographic targets include reference targets and candidate targets; A query range determination module, used to determine the query range using the latitude and longitude information of the reference target and the query condition; The geographic target determination module determines the geographic targets within the query range based on the latitude and longitude information of each candidate target.
9. An electronic device, characterized in that: The device comprises a memory storing computer executable instructions and a processor, and when the computer executable instructions are executed by the processor, the device executes the geographic target query method as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that: A computer executable program is stored, and when the program is executed, the geographic target query method as described in any one of claims 1 to 7 can be implemented.