Data query method, electronic device, and storage medium

By performing density clustering on candidate latitude and longitude information in the offline cache database, the problems of high query cost and slow response in existing technologies are solved, and efficient business data query is achieved.

CN116450748BActive Publication Date: 2025-11-28HUBEI QIGUANG TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310252423.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-15
Publication Date
2025-11-28
Estimated Expiration
2043-03-15

AI Technical Summary

Technical Problem

In the process of querying business data related to geographic location information, existing technologies require obtaining regional codes through third-party platforms, resulting in high query costs and slow response times, and are also limited by QPS (Queries Per Second).

Method used

Density clustering is performed on candidate latitude and longitude information in the offline cache database to determine the density clustering of spatial points corresponding to the latitude and longitude information, and to determine the region code corresponding to the latitude and longitude information. By setting the region code, the candidate information is updated based on the density clustering results.

Benefits of technology

This reduces the number of queries to third-party platforms, lowers the cost of querying business data, and improves query efficiency and response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116450748B_ABST
    Figure CN116450748B_ABST
Patent Text Reader

Abstract

The application discloses a data query method, an electronic device and a storage medium, and relates to the technical field of data processing. The method comprises the following steps: performing density clustering on spatial points corresponding to each candidate latitude and longitude information in an offline cache database, wherein the offline cache database stores a plurality of candidate latitude and longitude information and area codes corresponding to each candidate latitude and longitude information; updating the number of candidate latitude and longitude information based on the density clustering result; receiving first latitude and longitude information sent by a first terminal; matching the first latitude and longitude information with candidate latitude and longitude information in the offline cache database; determining candidate latitude and longitude information matched with the first latitude and longitude information, taking an area code corresponding to the candidate latitude and longitude information as an area code corresponding to the first latitude and longitude information; and sending service data associated with the area code to the first terminal. The method provided in the application improves the query efficiency, reduces the query cost, and simplifies the storage scale of latitude and longitude data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to a data query method, an electronic device and a storage medium. BACKGROUND

[0002] In a query process of business data related to geographic location information, a region code of a current location needs to be queried according to a longitude and a latitude of a location where a mobile terminal is located, and then corresponding business data needs to be queried according to the region code.

[0003] In the process of converting the longitude and the latitude into the region code, a third-party platform often needs to be used for implementation. On the one hand, a large number of unnecessary paid accesses are generated by obtaining the region code through the third-party platform, which increases a query cost of the business data. On the other hand, the third-party platform is provided with a Queries Per Second (QPS), so that the query of the business data is limited by access, is time-consuming and slow in response. SUMMARY

[0004] In a first aspect, the present application provides a data query method, comprising:

[0005] performing density clustering on spatial points corresponding to each candidate longitude and latitude information in an offline cache database, wherein the offline cache database stores a plurality of candidate longitude and latitude information and region codes corresponding to each candidate longitude and latitude information;

[0006] updating a number of the candidate longitude and latitude information based on a density clustering result;

[0007] receiving first longitude and latitude information sent by a first terminal;

[0008] matching the first longitude and latitude information with candidate longitude and latitude information in the offline cache database;

[0009] determining candidate longitude and latitude information matched with the first longitude and latitude information, and taking a region code corresponding to the candidate longitude and latitude information as a region code corresponding to the first longitude and latitude information;

[0010] sending business data associated with the region code to the first terminal.

[0011] In some embodiments, the determining candidate longitude and latitude information matched with the first longitude and latitude information, and taking a region code corresponding to the candidate longitude and latitude information as a region code corresponding to the first longitude and latitude information, comprises:

[0012] determine the three-dimensional coordinates of the spatial point corresponding to the first latitude and longitude information and the three-dimensional coordinates of the spatial points corresponding to each candidate latitude and longitude information based on the conversion relationship between the latitude and longitude information of the spatial points and the three-dimensional coordinates;

[0013] determine the geodesic distances between the spatial point corresponding to the first latitude and longitude information and the spatial points corresponding to each candidate latitude and longitude information based on the three-dimensional coordinates of the spatial point corresponding to the first latitude and longitude information and the three-dimensional coordinates of the spatial points corresponding to each candidate latitude and longitude information;

[0014] form a first set with all the spatial points whose geodesic distances are less than or equal to a first preset distance threshold, and determine a first spatial point corresponding to the minimum geodesic distance in the first set;

[0015] determine that the candidate latitude and longitude information corresponding to the first spatial point matches the first latitude and longitude information, and encode the region corresponding to the candidate latitude and longitude information as the region code corresponding to the first latitude and longitude information.

[0016] In some embodiments, the method further comprises:

[0017] receiving second latitude and longitude information sent by a second terminal;

[0018] determining that the geodesic distances between the spatial point corresponding to the second latitude and longitude information and the spatial points corresponding to each candidate latitude and longitude information are all greater than a first preset distance threshold;

[0019] sending the second latitude and longitude information to a third-party platform;

[0020] receiving the region code corresponding to the second latitude and longitude information sent by the third-party platform;

[0021] sending the business data associated with the region code corresponding to the second latitude and longitude information to the second terminal, and storing the second latitude and longitude information and the region code corresponding to the second latitude and longitude information in the offline cache database.

[0022] In some embodiments, the method further comprises:

[0023] receiving third latitude and longitude information sent by a third terminal;

[0024] sending the third latitude and longitude information to a third-party platform;

[0025] determining that the region code corresponding to the third latitude and longitude information sent by the third-party platform has not been received;

[0026] form a second set with the spatial points corresponding to each candidate latitude and longitude information, and determine a second spatial point corresponding to the minimum geodesic distance in the second set;

[0027] determining that candidate latitude and longitude information corresponding to the second spatial point matches the third latitude and longitude information, and encoding a region corresponding to the candidate latitude and longitude information as a region corresponding to the third latitude and longitude information;

[0028] sending service data associated with the region corresponding to the third latitude and longitude information to the third terminal.

[0029] In some embodiments, the density clustering of the spatial points corresponding to each candidate latitude and longitude information in the offline cache database comprises: determining that the number of candidate latitude and longitude information in the offline cache database is greater than a preset threshold value;

[0030] determining the spatial points corresponding to each candidate latitude and longitude information;

[0031] taking each spatial point as a center, determining a clustering region corresponding to each spatial point based on a preset radius, and determining the number of all spatial points in the clustering region corresponding to each spatial point as the density of each spatial point;

[0032] In the current order of magnitude simplification process, the clustering region corresponding to the spatial point with the maximum density is taken as the current clustering region;

[0033] density clustering all spatial points in the current clustering region.

[0034] In some embodiments, the density clustering of all spatial points in the current clustering region and the updating of the number of candidate latitude and longitude information based on the density clustering result comprise:

[0035] determining a cluster center point of the current clustering region and an average distance of each spatial point in the current clustering region to the cluster center point;

[0036] in the current clustering region, determining a spatial point with a poor arc length less than or equal to the average distance from the cluster center point as a cluster point, and determining a region code corresponding to the cluster center point based on region codes corresponding to all cluster points;

[0037] deleting all cluster points, and updating the cluster center point and the spatial points other than the cluster points as spatial points in the current clustering region;

[0038] updating the offline cache database based on candidate latitude and longitude information corresponding to each spatial point in the updated current clustering region and region codes corresponding to each spatial point.

[0039] In some embodiments, the determination of the region code corresponding to the cluster center point based on region codes corresponding to all cluster points comprises:

[0040] counting frequencies of region codes corresponding to all the cluster points;

[0041] taking the region code corresponding to the highest frequency as the region code corresponding to the cluster center point.

[0042] In some embodiments, the taking, in the current sub-order magnitude simplification process, the cluster region corresponding to the spatial point with the maximum density as the current cluster region comprises:

[0043] determining a set of merging points based on all the cluster points in the last order magnitude simplification process;

[0044] removing the set of merging points from the set of spatial points to be clustered corresponding to the last order magnitude simplification process to obtain an initial set of spatial points corresponding to the current sub-order magnitude simplification process;

[0045] adding the cluster center point in the last order magnitude simplification process to the initial set of spatial points to obtain a set of spatial points to be clustered corresponding to the current sub-order magnitude simplification process;

[0046] determining a set of reserved points based on the cluster center point in the last order magnitude simplification process and the spatial points other than the cluster points, and determining the density of each spatial point in the set of reserved points;

[0047] determining a set of influence points based on the intersection of the set of merging points and the set of spatial points to be clustered corresponding to the current sub-order magnitude simplification process;

[0048] for any spatial point in the set of influence points, determining a first intersection of the spatial points in the cluster region corresponding to the any spatial point and the set of merging points, removing the spatial points in the first intersection from the cluster region corresponding to the any spatial point, and taking the difference between the initial density of the any spatial point and the number of spatial points in the first intersection as a first density of the any spatial point;

[0049] determining that the distance between the cluster center point in the last order magnitude simplification process and the any spatial point is less than or equal to the preset radius, adding the cluster center point to the cluster region corresponding to the any spatial point, and updating the first density of the any spatial point to obtain a second density of the any spatial point;

[0050] updating the initial density of each spatial point in the set of influence points to the second density;

[0051] in the set of spatial points to be clustered corresponding to the current sub-order magnitude simplification process, taking the cluster region corresponding to the spatial point with the maximum density as the current cluster region.

[0052] In a second aspect, the present application provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the data query method of any of the above.

[0053] In a third aspect, the present application provides an electronic device comprising a memory and a processor, wherein the memory has stored thereon a computer program, and the processor is configured to execute the data query method by the computer program. BRIEF DESCRIPTION OF DRAWINGS

[0054] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0055] In order to more clearly illustrate the technical solutions of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings described below are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0056] Figure 1 The flowchart of the data query method provided by an embodiment of the present application is shown in the figure;

[0057] Figure 2 The latitude and longitude coordinate conversion diagram provided by an embodiment of the present application is shown in the figure;

[0058] Figure 3 The flowchart of the cluster deduplication provided by an embodiment of the present application is shown in the figure;

[0059] Figure 4 The process diagram of the cluster deduplication provided by an embodiment of the present application is shown in the figure;

[0060] Figure 5 The flowchart of the data query method provided by another embodiment of the present application is shown in the figure;

[0061] Figure 6 The structural diagram of the electronic device provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0062] In order to make the person skilled in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.

[0063] It is to be understood that the terms "first", "second", and the like, used in the description and in the claims, are used as identifiers for distinguished objects and do not necessarily have to follow a specific sequential order. It is to be understood that the use of such terms can be interchanged in order to describe the embodiments of the present application, unless otherwise specifically noted, in whatever order, in the context of the present application. Furthermore, the terms "comprise", "comprising", "have", "having", "include", "including", and their syntactic conjugates are intended to cover a process, method, system, product, or apparatus that comprises a series of steps or units not necessarily following a strict order unless specifically noted as such in the context of the present application.

[0064] The terminal to which the present application relates includes various handheld devices, vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to a wireless modem with satellite communication functions, such as a mobile phone, a tablet, a desktop notebook, and a smart device that can run an application program, including a central control console of a smart car, etc. Specifically, it can refer to a user equipment (UE), an access terminal, a user unit, a user station, a mobile station, a mobile station, a remote station, a remote terminal, a mobile device, a user terminal, a terminal, a wireless communication device, a user agent, or a user device.

[0065] The terminal can also be a satellite phone, a smart phone, a wireless data card, a wireless modem, a machine type communication device, which can be a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (WLL) station, a personal digital assistant (PDA), a handheld device with wireless communication functions, a computing device, or other processing devices connected to a wireless modem, a vehicle-mounted device, or a wearable device, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, a terminal device in 5G network or future communication network, etc.

[0066] Figure 1 is a flowchart of a data query method provided by an embodiment of the present application, as shown in the figure, the method comprises steps 110, 120, 130, 140, 150 and 160. The method flowchart steps are merely as one possible implementation of the present application. Figure 1

[0067] Step 110, density clustering is performed on the spatial points corresponding to each candidate latitude and longitude information in the offline cache database, the offline cache database stores a plurality of candidate latitude and longitude information, and the region code corresponding to each candidate latitude and longitude information.

[0068] Specifically, the execution subject of the data query method provided by the embodiment of the present application is a data query device, which can be a hardware device independently arranged in a terminal, or a software program running in the terminal. For example, when the terminal is a mobile phone, the data query device can be embodied as a query software application program in the mobile phone.

[0069] The candidate latitude and longitude information is used to match the latitude and longitude information sent by the terminal to determine the region code corresponding to the latitude and longitude information. The region code can be an administrative code, or a self-defined location code in business data, etc.

[0070] A large amount of candidate latitude and longitude information is stored in the offline cache database. The candidate latitude and longitude information can be obtained directly through a map software; it can also be obtained through public data or manual search; it can also be obtained in each business query process.

[0071] Density can be understood as the density of candidate latitude and longitude information. If the candidate latitude and longitude information is converted into spatial points, the density can be the number of all spatial points in the clustering region corresponding to the spatial points.

[0072] The density clustering method can be used to cluster and remove the candidate latitude and longitude information stored in the offline cache database, so as to realize data simplification.

[0073] Step 120, updating the number of candidate latitude and longitude information based on the density clustering result.

[0074] Specifically, the density clustering result refers to the candidate latitude and longitude information that needs to be deleted and the candidate latitude and longitude information that needs to be retained determined after the density clustering method is used to calculate the candidate latitude and longitude information. According to the density clustering result, the candidate latitude and longitude information stored in the offline cache database can be deleted or retained, so as to update the number of candidate latitude and longitude information.

[0075] Step 130, receiving the first latitude and longitude information sent by the first terminal.

[0076] ​Specifically, the first longitude and latitude information includes longitude data and latitude data of a location where the first terminal is located.

[0077] In step 140, the first longitude and latitude information is matched with candidate longitude and latitude information in an offline cache database. The offline cache database stores a plurality of candidate longitude and latitude information and area codes corresponding to the candidate longitude and latitude information.

[0078] Specifically, the matching can include exact matching and approximate matching. For example, when the longitude and latitude information is consistent with the candidate longitude and latitude information, it can be considered that the two are exactly matched. For another example, when the difference between the longitude and latitude information and the candidate longitude and latitude information is less than a preset difference, it can be considered that the two are approximately matched.

[0079] In step 150, the candidate longitude and latitude information matched with the first longitude and latitude information is determined, and an area code corresponding to the candidate longitude and latitude information is taken as an area code corresponding to the first longitude and latitude information.

[0080] Specifically, the service data is generally associated with the area code, rather than the specific longitude and latitude information. For example, the weather data of the location where the first terminal is located is associated with the area, and if the weather data of the location needs to be queried, the area code of the area needs to be queried.

[0081] After it is determined that the first longitude and latitude information is matched with the candidate longitude and latitude information, it can be considered that the positions corresponding to the two are the same position, and therefore the area code corresponding to the candidate longitude and latitude information can be taken as the area code corresponding to the first longitude and latitude information.

[0082] In step 160, the service data associated with the area code is sent to the first terminal.

[0083] Specifically, the service data is data corresponding to a service to be queried. After the data query device determines the area code corresponding to the longitude and latitude information, the service data associated with the area code is further obtained and sent to the first terminal.

[0084] Taking the weather data as an example of the service data, it is determined that the area code corresponding to the longitude and latitude information is 1101, and the weather data associated with the area code 1101 includes: overcast weather, temperature 25℃, humidity 50%, and strong wind. The data query device sends these weather data to the terminal, and the user can view these data through the display screen of the terminal. The terminal can also broadcast these weather data in the form of voice broadcast.

[0085] The data query method provided by the embodiments of the present application can directly query the region code corresponding to the latitude and longitude information in the offline cache database, reduce the number of times of querying the region code from the third-party platform, and shorten the response time. In addition, the query of the business data is not limited by the access of the third-party platform, and the query cost of the business data can be reduced and the query efficiency of the business data can be improved. Meanwhile, the offline cache database can be efficiently simplified in order, the query rate of the business data can be improved, and the response speed of the business data query device can be improved by performing density clustering on the spatial points corresponding to each candidate latitude and longitude information in the offline cache database.

[0086] It should be noted that each embodiment of the present application can be freely combined, the order can be changed or each embodiment can be executed independently, and does not need to rely on or depend on a fixed execution order.

[0087] In some embodiments, step 150 comprises:

[0088] Based on the conversion relationship between the latitude and longitude information of the spatial point and the three-dimensional coordinates, the three-dimensional coordinates of the spatial point corresponding to the first latitude and longitude information and the three-dimensional coordinates of the spatial points corresponding to each candidate latitude and longitude information are determined;

[0089] Based on the three-dimensional coordinates of the spatial point corresponding to the first latitude and longitude information and the three-dimensional coordinates of the spatial points corresponding to each candidate latitude and longitude information, the geodesic distance between the spatial point corresponding to the first latitude and longitude information and the spatial points corresponding to each candidate latitude and longitude information is determined.

[0090] All spatial points with a geodesic distance less than or equal to a first preset distance threshold are grouped into a first set, and a first spatial point corresponding to a minimum geodesic distance is determined in the first set.

[0091] It is determined that the candidate latitude and longitude information corresponding to the first spatial point matches the first latitude and longitude information, and the region code corresponding to the candidate latitude and longitude information is taken as the region code corresponding to the first latitude and longitude information.

[0092] Specifically, the position of the spatial point can be represented by latitude and longitude information or represented by spatial three-dimensional coordinates, and the two have a conversion relationship.

[0093] In order to determine the candidate latitude and longitude information matched with the first latitude and longitude information, the data query device calculates the distance between the spatial point corresponding to the first latitude and longitude information and the spatial point corresponding to each candidate latitude and longitude information, sets a first preset distance threshold, groups the spatial points corresponding to all candidate latitude and longitude information less than or equal to the first preset distance threshold into a first set, and determines the spatial point corresponding to the minimum distance in the first set, which is the first spatial point, determines the candidate latitude and longitude information corresponding to the spatial point as matching the first latitude and longitude information, and takes the region code corresponding to the candidate latitude and longitude information as the region code corresponding to the first latitude and longitude information.

[0094] The latitude and longitude data belongs to high-precision angle data, in order to improve the calculation precision of the distance between two spatial points, the latitude and longitude information corresponding to the spatial points needs to be converted into three-dimensional coordinates in a three-dimensional sphere, and then the distance between two spatial points is represented by the arc length between the two spatial points in the sphere.

[0095] For example, the latitude and longitude information of the spatial point is converted into three-dimensional coordinates of the space. The latitude and longitude information is represented in the form of latitude and longitude coordinates.

[0096] Figure 2 is a latitude and longitude coordinate conversion diagram provided by an embodiment of the present application, as shown in Figure 2 P represents a spatial point, R represents the radius of the earth, R is generally approximately 6371.0km, O is the origin, the latitude and longitude coordinates of P are (θ lng ,θ lat ), θ lng is the longitude coordinate, and θ lat is the latitude coordinate. The three-dimensional coordinates (x, y, z) of P can be obtained as follows:

[0097] (Rcosθ lng cosθ lat ,Rsinθ lng cosθ lat ,Rsinθ lat )

[0098] The calculation formula for converting the latitude and longitude coordinates into three-dimensional coordinates is as follows:

[0099] x=Rcosθ lng cosθ lat

[0100] y=Rsinθ lng cosθ lat

[0101] z=Rsinθ lat

[0102] According to the conversion relationship between the longitude and latitude information of the spatial point and the three-dimensional coordinates, the three-dimensional coordinates of the spatial point corresponding to the longitude and latitude information sent by the terminal and the three-dimensional coordinates of the spatial points corresponding to each candidate longitude and latitude information can be determined.

[0103] For example, A is a spatial point corresponding to the longitude and latitude information sent by a terminal, and B is a spatial point corresponding to a candidate longitude and latitude information. The longitude and latitude coordinates of A are (a lng ,a lat ), and the longitude and latitude coordinates of B are (b lng ,b lat ). The three-dimensional coordinates (i.e., the coordinate values of the spatial vector ) of A can be calculated as follows:

[0104] (Rcosa lng cosa lat ,Rsina lng cosa lat ,Rsina lat )

[0105] Similarly, the three-dimensional coordinates (i.e., the coordinate values of the spatial vector ) of B can be calculated as follows:

[0106] (Rcosb lng cosb lat ,Rsinb lng cosb lat ,Rsinb lat )

[0107] The length d of the space arc between the two spatial points A and B can be calculated by using the space arc calculation formula as follows:

[0108]

[0109] The data query method provided in the embodiments of the present application determines the three-dimensional coordinates of the spatial point corresponding to the first longitude and latitude information and the three-dimensional coordinates of the spatial points corresponding to each candidate longitude and latitude information by using the conversion relationship between the longitude and latitude information of the spatial point and the three-dimensional coordinates, calculates the length of the space arc between the spatial point corresponding to the first longitude and latitude information and the spatial points corresponding to each candidate longitude and latitude information, determines the first spatial point, and uses the region code corresponding to the candidate longitude and latitude information of the first spatial point as the region code corresponding to the longitude and latitude information, so that the region code corresponding to the longitude and latitude information does not need to be obtained from the third-party platform, the number of queries to the third-party platform is reduced, the query cost is reduced, and the query efficiency is improved.

[0110] In some embodiments, the method further includes:

[0111] receive second latitude and longitude information sent by a second terminal;

[0112] determine that the geodesic distances between the spatial point corresponding to the second latitude and longitude information and the spatial points corresponding to each candidate latitude and longitude information are all greater than the first preset distance threshold;

[0113] send the second latitude and longitude information to a third-party platform;

[0114] receive the area code corresponding to the second latitude and longitude information sent by the third-party platform;

[0115] send the service data associated with the area code corresponding to the second latitude and longitude information to the second terminal, and store the second latitude and longitude information and the area code corresponding to the second latitude and longitude information in the offline cache database.

[0116] Specifically, the third-party platform can be a map data platform or the like.

[0117] The second terminal sends the second latitude and longitude information to the data query apparatus. If the geodesic distances between the spatial point corresponding to the second latitude and longitude information and the spatial points corresponding to each candidate latitude and longitude information are all greater than the first preset distance threshold, that is, the spatial points corresponding to the candidate latitude and longitude information stored in the offline cache database are all far away from the spatial point corresponding to the second latitude and longitude information, the data query apparatus accesses an application programming interface (API) of the third-party platform, sends the second latitude and longitude information to the third-party platform through the API, and sends the area code corresponding to the second latitude and longitude information to the data query apparatus through the API. The data query apparatus then sends the service data associated with the area code to the second terminal.

[0118] The data query apparatus can also store the received area code and the second latitude and longitude information corresponding to the area code in the offline cache database as newly added candidate latitude and longitude information and the area code thereof.

[0119] The data query method provided by the embodiments of the present application can improve the accuracy of the area code corresponding to the latitude and longitude information obtained from the third-party platform when the geodesic distances between the spatial point corresponding to the latitude and longitude information and the spatial points corresponding to each candidate latitude and longitude information are all greater than the first preset distance threshold.

[0120] In some embodiments, the method further includes:

[0121] receiving third latitude and longitude information sent by a third terminal;

[0122] sending the third latitude and longitude information to a third-party platform;

[0123] determine that the region code corresponding to the third latitude and longitude information sent by the third-party platform is not received;

[0124] form a second set of spatial points corresponding to each candidate latitude and longitude information, and determine a second spatial point corresponding to a minimum arc length in the second set;

[0125] determine that the candidate latitude and longitude information corresponding to the second spatial point matches the third latitude and longitude information, and take the region code corresponding to the candidate latitude and longitude information as the region code corresponding to the third latitude and longitude information;

[0126] send the service data associated with the region code corresponding to the third latitude and longitude information to the third terminal.

[0127] Specifically, the third terminal sends the third latitude and longitude information to the data query device. In the case of high concurrency of user service query, if the candidate latitude and longitude information in the offline cache database does not match the third latitude and longitude information, more service data query requests will be sent to the third-party platform. Since the API of the third-party platform has a limited QPS, the query will be rejected, that is, the data query device cannot receive the region code corresponding to the third latitude and longitude information sent by the third-party platform.

[0128] In this case, the data query device can form a second set of spatial points corresponding to each candidate latitude and longitude information, calculate the arc length between the spatial point corresponding to the latitude and longitude information and each spatial point in the second set, determine the minimum arc length, and take the spatial point corresponding to the minimum arc length as the second spatial point.

[0129] determine that the candidate latitude and longitude information corresponding to the second spatial point matches the third latitude and longitude information, and take the region code corresponding to the candidate latitude and longitude information as the region code corresponding to the third latitude and longitude information, and obtain the service data according to the region code. The data query device sends the service data associated with the region code to the third terminal.

[0130] The data query method provided by the embodiment of the application provides a region code corresponding to the minimum arc length as the region code corresponding to the latitude and longitude information in the case that the service query device does not receive the region code corresponding to the latitude and longitude information sent by the third-party platform, provides degraded service for the user, and improves the user experience.

[0131] In some embodiments, the candidate latitude and longitude information stored in the offline cache database includes five pieces of information: a primary key, a longitude, a latitude, a region code, and a state. The state is divided into an added state, a to-be-clustered state, and a clustered state.

[0132] The new state is a state of candidate longitude and latitude information just stored in the offline cache database; the to-be-clustered state is an intermediate state of the new state to the clustered state; and the clustered state is a state of candidate longitude and latitude information that has been clustered. Only candidate longitude and latitude information in the clustered state can be provided to the data query device.

[0133] When the data query device is initially run, the candidate longitude and latitude information in the offline cache database is set as the clustered state by default. Because the candidate longitude and latitude information in the offline cache database is less in the early stage, the state of the candidate longitude and latitude information is set as the clustered state, which can be directly provided to the data query device for use, thereby improving the query efficiency.

[0134] With the increase of the query business of the business data processing device, the candidate longitude and latitude information stored in the offline cache database will be more and more. This not only causes the waste of the storage space of the offline cache database, but also affects the query speed of the business data, reduces the throughput of the business data processing device, and slows down the response speed.

[0135] Therefore, the order simplification method based on density clustering can be used to cluster and remove the candidate longitude and latitude information stored in the offline cache database, thereby realizing data simplification.

[0136] In some embodiments, the density clustering is performed on the space points corresponding to the candidate longitude and latitude information in the offline cache database, including:

[0137] Determining that the number of candidate longitude and latitude information in the offline cache database is greater than a preset threshold;

[0138] Determining the space points corresponding to each candidate longitude and latitude information;

[0139] Determining the clustering region corresponding to each space point based on a preset radius with each space point as the center, and determining the density of each space point as the number of all space points in the clustering region corresponding to the space point;

[0140] In the current order simplification process, the clustering region corresponding to the space point with the maximum density is taken as the current clustering region;

[0141] Performing density clustering on all space points in the current clustering region.

[0142] Specifically, generally, candidate longitude and latitude information is distributed in an aggregated manner, that is, distances between most of the candidate longitude and latitude information corresponding to spatial points are close. If distances between two spatial points are less than or equal to an average distance, region codes corresponding to the two spatial points are likely to be the same, and deleting candidate longitude and latitude information corresponding to one of the two spatial points does not affect a query result of the business data. For example, the business data is weather data, and it can be considered that weather data of two spatial points close to each other is approximately the same, and thus deleting candidate longitude and latitude information corresponding to one of the two spatial points close to each other does not affect the weather data queried.

[0143] Therefore, according to characteristics of distribution of candidate longitude and latitude information, a density calculation manner can be used to simplify the data order of magnitude of the candidate longitude and latitude information in the offline cache database, to avoid the candidate longitude and latitude information stored in an aggregated manner.

[0144] For example, the number of candidate longitude and latitude information in the offline cache database is n t , and a preset threshold is n e . The preset threshold can be set according to a storage capacity of the offline cache database and a hardware configuration and a response speed of the data query device. The preset threshold n e may be set to 100,000.

[0145] A time period can be set to simplify the order of magnitude of the offline cache database, for example, the terminal can issue an order of magnitude simplification instruction every week or every day, and the business processing device executes the instruction to simplify the order of magnitude of the offline cache database.

[0146] The order of magnitude of the offline cache database can be simplified many times until the number of candidate longitude and latitude information in the offline cache database is less than or equal to the preset threshold.

[0147] For the current time, the density of all spatial points can be calculated, the spatial points are sorted in descending order of the density values, and a spatial point with the maximum density is selected. The spatial point with the maximum density is taken as a center, and a preset radius is taken as a radius to obtain a clustering region corresponding to the spatial point with the maximum density, and the clustering region is taken as a current clustering region.

[0148] The data query method provided by the embodiment of the application can efficiently simplify the order of magnitude of the offline cache database by taking the clustering region corresponding to the spatial point with the maximum density as the current clustering region, and improve the business data query rate and the response speed of the data query device.

[0149] In some embodiments, the density clustering of all spatial points in the current clustering region and the updating of the number of candidate longitude and latitude information based on the density clustering result include:

[0150] determining a cluster center point of the current clustering region and an average distance from each spatial point in the current clustering region to the cluster center point;

[0151] In the current clustering region, spatial points with a poor arc length to the cluster center point less than or equal to the average distance are determined as cluster points, and a region code corresponding to the cluster center point is determined based on region codes corresponding to all cluster points;

[0152] All cluster points are deleted, and the cluster center point and spatial points other than the cluster points are updated as spatial points in the current clustering region;

[0153] Based on the candidate latitude and longitude information corresponding to each spatial point in the updated current clustering region and the region code corresponding to each spatial point, the offline cache database is updated.

[0154] Specifically, Figure 3 is a flowchart of the clustering deduplication provided by an embodiment of the present application, as Figure 3 shown, the offline cache database is based on the following steps to be simplified in magnitude:

[0155] Step 1, obtain the number n of candidate latitude and longitude information in the current offline cache database t , compare n t with a preset threshold n e .

[0156] If n t ≤ n e , update the state of all current candidate latitude and longitude information to the clustered state, and then end the current magnitude simplification task. If n t > n e , that is, the data amount of the current candidate latitude and longitude information is large, then go to step 2 for magnitude simplification processing.

[0157] Step 2, update all current candidate latitude and longitude information to the clustering state, and take out all candidate latitude and longitude information in the clustering state to form a set S. The taking out is because clustering needs to consume a certain amount of time, and new candidate latitude and longitude information will be written in the clustering process. After a clustering is completed, the clustered candidate latitude and longitude information can be set to the clustering state to distinguish the clustered candidate latitude and longitude information and the new candidate latitude and longitude information in the clustering process.

[0158] Step three, determine the spatial point corresponding to each candidate latitude and longitude information, take each spatial point as the center of a circle, and take the preset radius as the radius of the circle, obtain the clustering area corresponding to each spatial point, and define the number of all spatial points in the clustering area as the density of each spatial point. The preset radius can be determined according to the queried business data. For example, in weather data query, the value range of the preset radius can be selected as 10 kilometers to 20 kilometers.

[0159] Figure 4 is a process diagram of clustering deduplication provided by an embodiment of the present application, as shown in Figure 4

[0160] The preset radius is used to determine the clustering area; the clustering area is used to determine the density of the spatial point, the clustering center point and the clustering point in the clustering area; and the average distance is used to determine the clustering point and the area where the clustering point is located.

[0161] As shown in part (a) of Figure 4 , for example, taking the spatial point with the maximum density as the center of a circle and taking γ as the preset radius, the clustering area corresponding to the spatial point is determined, the set of all spatial points in the clustering area is obtained, denoted as S ′ . The number of point sets in S ′ represents the density of the spatial point.

[0162] Step four, as shown in part (b) of Figure 4 , the current clustering area is selected according to the density of the spatial point with the maximum density, and the current clustering area is denoted as s area .

[0163] Step five, the clustering center point of s area , denoted as p, can be calculated according to the three-dimensional coordinates of each spatial point, and the average distance is determined according to the geodesic distance between each spatial point in s area .

[0164] There are two ways to calculate the clustering center point:

[0165] The first way is to calculate the arithmetic mean of the three-dimensional coordinates of each spatial point in the current clustering area, and take the point corresponding to the arithmetic mean of the three-dimensional coordinates as the clustering center point.

[0166] The second way is to assume that the clustering center point exists, sum the Euclidean distances between the clustering center point and each spatial point to obtain a distance function, and obtain the derivative function by differentiating the distance function. When the derivative function takes the extreme value, the three-dimensional coordinates corresponding to the extreme value are taken as the three-dimensional coordinates of the clustering center point, so as to determine the clustering center point.

[0167] The average distance can be calculated in the following way:

[0168] The average distance is calculated by taking the spatial point with the maximum density as the center of a circle, taking the spatial point with the minimum density as the center of a circle, and taking the spatial point with the maximum density as the center of a circle.​area The set of points in the set is denoted as S. n e represents S n The point elements in the region are calculated using the following formula. area The average minor arc length from each spatial point to the aggregation center point p is denoted as l. mean .

[0169]

[0170] in, S represents n The dot element e i The length of the minor arc to p, where n represents S. n The number of points in the mid-space. The average minor arc length is used as the average distance.

[0171] Step Six, in s area In this process, cluster points and discrete points are determined. Cluster points are spatial points close to the cluster center, and discrete points are spatial points far from the cluster center (i.e., spatial points other than cluster points in the current cluster region). The specific determination method is as follows:

[0172] In s area Within, the length of the minor arc leading to the aggregation center point p is greater than l. mean The spatial point as s area For discrete points, the length of the minor arc leading to the aggregation center point p is less than or equal to l. mean The spatial point is s area The region formed by the aggregation points is denoted as S. culter This area is where the gathering point is located.

[0173] Step 7: Statistical Analysis of S culter The frequency of the region codes of all cluster points is used, and the region code corresponding to the highest frequency is used as the region code of p.

[0174] Step 8, as Figure 4 As shown in parts (c) and (d), all cluster points are deleted, and p is used instead of S. culter The original cluster points are added to the offline cache database, and the discrete points and p are added. The offline cache database is updated, and steps one through eight are repeated until n. t ≤n e .

[0175] The data query method provided in this application embodiment, based on the distribution pattern of candidate latitude and longitude information, uses point density calculation, clustering deduplication and other methods to replace cluster points with cluster center points, which can effectively deduplicate candidate latitude and longitude information in the offline cache database, avoid the clustered storage of candidate latitude and longitude information, improve the business data query rate and the response speed of the data query device.

[0176] In the above scheme, the density of each point in the new set of points to be clustered needs to be recalculated to select the point with the maximum density after each clustering, and in the entire data clustering simplification process, there are many repeated point density calculations. For this scenario, the application provides a point density recalculation optimization method based on differential data.

[0177] In some embodiments, in the current order simplification process, the clustering region corresponding to the spatial point with the maximum density is taken as the current clustering region, comprising:

[0178] Based on all the aggregation points in the last order simplification process, a set of merging points is determined;

[0179] From the set of spatial points to be clustered corresponding to the last order simplification process, the set of merging points is removed to obtain an initial set of spatial points corresponding to the current order simplification process;

[0180] The aggregation center point in the last order simplification process is added to the initial set of spatial points to obtain a set of spatial points to be clustered corresponding to the current order simplification process;

[0181] Based on the aggregation center point in the last order simplification process and the spatial points other than the aggregation points, a set of reserved points is determined, and the density of each spatial point in the set of reserved points is determined;

[0182] Based on the intersection of the set of merging points and the set of spatial points to be clustered corresponding to the current order simplification process, a set of influence points is determined;

[0183] For any spatial point in the set of influence points, a first intersection of the spatial points in the clustering region corresponding to the spatial point and the set of merging points is determined, the spatial points in the first intersection are removed from the clustering region corresponding to the spatial point, and the difference between the initial density of the spatial point and the number of spatial points in the first intersection is taken as the first density of the spatial point;

[0184] The distance between the aggregation center point in the last order simplification process and any spatial point is determined to be less than or equal to a preset radius, the aggregation center point is added to the clustering region corresponding to the spatial point, and the first density of the spatial point is updated to obtain a second density of the spatial point;

[0185] The initial density of each spatial point in the set of influence points is updated to the second density;

[0186] In the set of spatial points to be clustered corresponding to the current order simplification process, the clustering region corresponding to the spatial point with the maximum density is taken as the current clustering region.

[0187] Specifically, the specific steps of the optimization process using the method of processing only differential data (data of point density variation) include:

[0188] Step 1: When the data magnitude does not meet the requirements, simplify the data magnitude, and record all points of the to-be-clustered points as a set S all Then, the density of each point in S all is calculated (the calculation method is as described above).

[0189] The data storage format uses five attributes: a unique primary key ID, longitude, latitude, point density, and all points in the point density area (to save repeated storage of point data, an association relationship can be used in actual implementation). For example, any point in the set S al is recorded as P k , the point density is recorded as n k , and the set of associated point elements of the point density area is recorded as S k- cluster. Then, the point with the maximum point density p max_d is selected from the set S all for clustering operation. After clustering is completed, the operation for each point is as described in the following steps.

[0190] The following steps 2 to 5 are used to determine the point with the maximum density in the current magnitude simplification process.

[0191] Step 2: Processing of the merged points: the points (i.e., the aggregated points) that are merged during the clustering operation of p max_d are recorded as a set S cluster (merged point set). Each point in S cluster serves as a merged point and will not participate in subsequent clustering, so each point in S all (the set of to-be-clustered space points corresponding to the last magnitude simplification process) is removed from the set S cluster to form a new set, which is recorded as S' all (the initial set of space points corresponding to the current magnitude simplification process).

[0192] Step 3: Processing of the reserved points: the aggregated center points newly generated during the clustering operation of p max_d are recorded as a set S p (in this embodiment, only the aggregated center points are included). The discrete points in the clustering area that are not merged during the clustering operation of p max_d are recorded as S spread . The above points are collectively referred to as the reserved points and are recorded as S retain (reserved point set).

[0193] Each point in S p is added to S' all to form a new set, which is recorded as S"all (currently sub-level simplification process corresponding to the set of space points to be clustered). Further calculate the point density of each point in set S retain , to reduce the amount of calculation, can be calculated in the circular region with p max_d as the center and 2 times the preset radius γ as the radius.

[0194] Step four: for the impact point processing: in p max_d , the points that are merged away in the clustering operation process (i.e. the aggregation points), recorded as set S cluster (merging point set).

[0195] Find the intersection of the point density area of each point in S" all and S cluster , recorded as S effect (impact point set). To reduce the amount of calculation, can be found in the annular region with p max_d as the center, 1 times γ as the small circle radius, and 2 times γ as the large circle radius. effect .

[0196] Further, take a point P effect in S k , the point density is n k , the intersection of the density area of P k and S cluster is recorded as S c_e_k (the first intersection). Then remove S k from the density area set of point P c_e_k , and subtract the number of elements in set S k from the point density n k of P c_e_k as the new point density n k (first density) of P k .

[0197] At the same time, find the set in S p with a distance not greater than γ from point P k , recorded as set S pc , if set S pc is not empty, then add set S pc to the density area set of point P k .

[0198] Since in this embodiment, set S p only has the aggregation center point, here is actually to compare the distance between the aggregation center point and any point P k is less than or equal to the preset radius γ. If the condition is met, it is actually to add the aggregation center point to the density area set of point P k .

[0199] Point P k Point density n k Add set S pc The value obtained by counting the number of elements is used as point P. k New point density n k (Second density). Set S effect The points in the array are processed in the above manner. (Note: denoted as S) effect It is S″ all A subset of references to S is not a new set. effect The change is directly reflected in S″ all middle).

[0200] Step 5: From the new set S″ all Select the points with the highest point density and perform iterative clustering of the data.

[0201] The data query method provided in this application optimizes the processing by only handling differential data (data with varying point density), which simplifies the storage volume of latitude and longitude data, accelerates business calculations, and saves system computing power and power consumption.

[0202] In some embodiments, it may further include:

[0203] The current spatial point is determined based on the access order of each spatial point;

[0204] Determine that the density of the current spatial point is greater than a preset density threshold;

[0205] The clustering region corresponding to the current spatial point is taken as the current clustering region;

[0206] Perform density clustering on all spatial points in the current clustering region.

[0207] Specifically, the access order and preset density threshold for each spatial point are set. The access order of each spatial point can be the storage order of its corresponding latitude and longitude information in the offline cache database. The preset density threshold can be set as needed. For example, if it is believed that 100 spatial points are sufficient to represent the different locations within the cluster area corresponding to the current spatial point, then 100 can be set as the preset density threshold.

[0208] When visiting any spatial point, the density of that spatial point is calculated and compared with a preset density threshold. If the density of the spatial point is less than or equal to the preset density threshold, that is, the density of the spatial point is small and the simplification effect may not be obvious. Therefore, the next spatial point is visited until the density of the spatial point is greater than the preset density threshold and a better simplification effect is achieved. The spatial point with a density greater than the preset density threshold is determined as the current spatial point, and the clustering region corresponding to the current spatial point is taken as the current clustering region.

[0209] According to the current clustering region, the offline cache database is simplified in magnitude, and then it is judged whether the number of candidate latitude and longitude information in the current offline cache database is less than or equal to a preset threshold. If the number of candidate latitude and longitude information in the current offline cache database is greater than the preset threshold, the spatial point is continuously accessed and clustering is updated until the number of candidate latitude and longitude information in the current offline cache database is less than or equal to the preset threshold.

[0210] The data query method provided by the embodiment of the application can quickly simplify the offline cache database in magnitude by determining the current spatial point, taking the clustering region corresponding to the current spatial point as the current clustering region, and performing clustering update.

[0211] Figure 5 is a flowchart of the data query method provided by another embodiment of the application. As shown in Figure 5 , the data query method provided by the embodiment of the application comprises the following steps.

[0212] Step one: converting the latitude and longitude coordinates (a lng ,a lat ) uploaded by the terminal and the candidate latitude and longitude coordinates in the offline cache database into three-dimensional coordinates in a three-dimensional sphere.

[0213] Step two: calculating the geodesic distance between the spatial point A corresponding to the latitude and longitude information and each candidate latitude and longitude information corresponding to each spatial point, and filtering the candidate latitude and longitude information corresponding to the spatial point with a geodesic distance less than the average distance γ to form a set S γ , wherein the set S γ includes the spatial points corresponding to the remaining candidate latitude and longitude information.

[0214] Step three: if the set S γ is not empty, selecting the point with the minimum geodesic distance to A in the set S γ as the approximate point of A, denoted as A ′ . At this time, the region code of A ′ is considered as the region code of A. After obtaining the region code corresponding to A from the offline cache database, the associated business data query can be performed. If the set S γ is empty, step four is entered.

[0215] Step four: the set S γ is empty, that is, there is no candidate latitude and longitude information matching the latitude and longitude information in the current offline cache database, the third-party API is accessed to convert the latitude and longitude into a region code, and the latitude and longitude coordinates (a lng ,a lat) send to the third-party API and get the latitude and longitude coordinates (a lng ,a lat ) the corresponding area code. If the third-party API can normally deliver the area code to the data query device, the area code and latitude and longitude information are stored in the offline cache database, and then the business data corresponding to the area code is queried and sent to the terminal. If the third-party API cannot normally deliver the area code, for example, the third-party API service QPS is limited, step five is entered.

[0216] Step five: adopt a service degradation strategy, find the latitude and longitude point coordinates with the minimum inferior arc length from the full offline cache data, and use the area code of the latitude and longitude point coordinates as the area code of A, query the business data corresponding to the area code, and send the business data to the terminal.

[0217] The data query method provided by the embodiments of the application can produce the following technical effects:

[0218] (1) By setting the offline cache database, storing multiple candidate latitude and longitude information and the area code corresponding to each candidate latitude and longitude information in the offline cache database, the number of accesses to the third-party API can be reduced, and the query cost can be reduced.

[0219] (2) By finding the spatial point with the minimum inferior arc length in the offline cache data to provide degradation service, user experience can be improved in the case of failure of third-party service calling.

[0220] (3) According to the distribution law of the aggregation of candidate latitude and longitude information, by using density calculation, clustering and deduplication methods, using the cluster center point instead of the cluster point, the latitude and longitude information in the clustering area can be effectively deduplicated, the aggregation storage of candidate latitude and longitude information can be avoided, the candidate latitude and longitude information can be effectively simplified, the query speed of business data can be improved, and the throughput and response speed of the business processing device to the outside can be ensured.

[0221] (4) By modeling the latitude and longitude information on a three-dimensional spherical surface, converting the latitude and longitude information into three-dimensional coordinates in a three-dimensional sphere, and using three-dimensional coordinates on the spherical surface to calculate the inferior arc length, the distance between spatial points is represented by the inferior arc length, and the calculation accuracy is improved.

[0222] (5) By dividing each spatial point in the clustering area into a discrete point and a cluster point, calculating the cluster center point of the clustering area, calculating the average distance from each spatial point in the clustering area to the cluster center point, further distinguishing the cluster point and the discrete point, deleting the cluster point, and retaining the cluster center point and the discrete point, the candidate latitude and longitude information in the offline cache database can be effectively reduced.

[0223] Figure 6This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application, as shown below. Figure 6 As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630, and a communications bus 640, wherein the processor 610, the communications interface 620, and the memory 630 communicate with each other via the communications bus 640. The processor 610 can call logical commands in the memory 630 to execute a data query method, which includes:

[0224] Density clustering is performed on the spatial points corresponding to each candidate latitude and longitude information in the offline cache database. The offline cache database stores multiple candidate latitude and longitude information and the region codes corresponding to each candidate latitude and longitude information. The number of candidate latitude and longitude information is updated based on the density clustering results. The first latitude and longitude information sent by the first terminal is received. The first latitude and longitude information is matched with the candidate latitude and longitude information in the offline cache database. The candidate latitude and longitude information that matches the first latitude and longitude information is determined, and the region code corresponding to the candidate latitude and longitude information is used as the region code corresponding to the first latitude and longitude information. The business data associated with the region code is sent to the first terminal.

[0225] Furthermore, when the logical commands in the aforementioned memory can be implemented as 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 this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several commands to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0226] The processor in the electronic device provided in this application embodiment can call logical instructions in the memory to implement the above method. Its specific implementation method is the same as the aforementioned method implementation method and can achieve the same beneficial effect, which will not be repeated here.

[0227] This application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the methods provided in the above embodiments.

[0228] The specific implementation is consistent with the foregoing method implementation, and the same beneficial effects can be achieved, and thus will not be repeated here.

[0229] The embodiment of the present application provides a computer program product, comprising a computer program, and the computer program is executed by a processor to realize the method.

[0230] The apparatus embodiments described above are merely illustrative, wherein the units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, that is, can be located in one place, or can be distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme. Those skilled in the art can understand and implement without creative labor.

[0231] Through the foregoing description of the embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary universal hardware platforms, and of course, can also be realized by hardware. Based on such understanding, the foregoing technical solutions can be embodied in the form of software products, and the computer software products can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and include a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.

[0232] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data query method, characterized in that, include: Density clustering is performed on the spatial points corresponding to each candidate latitude and longitude information in the offline cache database. The offline cache database stores multiple candidate latitude and longitude information and the region code corresponding to each candidate latitude and longitude information. The number of candidate latitude and longitude information is updated based on the density clustering results; Receive the first latitude and longitude information sent by the first terminal; The first latitude and longitude information is matched with the candidate latitude and longitude information in the offline cache database; Determine candidate latitude and longitude information that matches the first latitude and longitude information, and use the region code corresponding to the candidate latitude and longitude information as the region code corresponding to the first latitude and longitude information; The service data associated with the region code is sent to the first terminal; The step of determining candidate latitude and longitude information that matches the first latitude and longitude information, and using the region code corresponding to the candidate latitude and longitude information as the region code corresponding to the first latitude and longitude information, includes: Based on the conversion relationship between latitude and longitude information of spatial points and three-dimensional coordinates, the three-dimensional coordinates of the spatial points corresponding to the first latitude and longitude information, as well as the three-dimensional coordinates of the spatial points corresponding to each candidate latitude and longitude information, are determined. Based on the three-dimensional coordinates of the spatial point corresponding to the first latitude and longitude information, and the three-dimensional coordinates of the spatial points corresponding to each candidate latitude and longitude information, the length of the minor arc between the spatial point corresponding to the first latitude and longitude information and the spatial points corresponding to each candidate latitude and longitude information is determined. A first set is formed by all spatial points whose minor arc length is less than or equal to a first preset distance threshold, and a first spatial point corresponding to the minimum minor arc length is determined in the first set. The candidate latitude and longitude information corresponding to the first spatial point is determined to match the first latitude and longitude information, and the region code corresponding to the candidate latitude and longitude information is used as the region code corresponding to the first latitude and longitude information.

2. The data query method according to claim 1, characterized in that, The method further includes: Receive the second latitude and longitude information sent by the second terminal; It is determined that the length of the minor arc between the spatial point corresponding to the second latitude and longitude information and the spatial point corresponding to each candidate latitude and longitude information is greater than the first preset distance threshold. Send the second latitude and longitude information to a third-party platform; Receive the area code corresponding to the second latitude and longitude information sent by the third-party platform; The service data associated with the area code corresponding to the second latitude and longitude information is sent to the second terminal, and the second latitude and longitude information and the area code corresponding to the second latitude and longitude information are stored in the offline cache database.

3. The data query method according to claim 1, characterized in that, The method further includes: Receive latitude and longitude information sent by a third terminal; Send the third latitude and longitude information to a third-party platform; It was determined that the area code corresponding to the third latitude and longitude information sent by the third-party platform was not received; A second set is formed by the spatial points corresponding to each candidate latitude and longitude information, and a second spatial point corresponding to the minimum minor arc length is determined in the second set; The candidate latitude and longitude information corresponding to the second spatial point is matched with the third latitude and longitude information, and the region code corresponding to the candidate latitude and longitude information is used as the region code corresponding to the third latitude and longitude information; The service data associated with the area code corresponding to the third latitude and longitude information is sent to the third terminal.

4. The data query method according to any one of claims 1 to 3, characterized in that, The density clustering of spatial points corresponding to each candidate latitude and longitude information in the offline cache database includes: The number of candidate latitude and longitude information in the offline cache database is determined to be greater than a preset threshold; Determine the spatial points corresponding to each candidate latitude and longitude information; Using each spatial point as the center and based on a preset radius, determine the clustering region corresponding to each spatial point, and determine the number of all spatial points in the clustering region corresponding to each spatial point as the density of each spatial point; In the current order of magnitude simplification process, the cluster region corresponding to the spatial point with the highest density is taken as the current cluster region; Density clustering is performed on all spatial points in the current clustering region.

5. The data query method according to claim 4, characterized in that, The steps of performing density clustering on all spatial points in the current clustering region and updating the number of candidate latitude and longitude information based on the density clustering results include: Determine the cluster center point of the current cluster region and the average distance from each spatial point in the current cluster region to the cluster center point; In the current clustering region, spatial points whose minor arc lengths to the cluster center are less than or equal to the average distance are identified as cluster points, and the region code corresponding to the cluster center is determined based on the region codes corresponding to all cluster points. Delete all cluster points, and update the cluster center point and all spatial points other than the cluster points to spatial points in the current clustering region; The offline cache database is updated based on the candidate latitude and longitude information corresponding to each spatial point in the updated current clustering region, as well as the region code corresponding to each spatial point.

6. The data query method according to claim 5, characterized in that, The step of determining the region code corresponding to the cluster center point based on the region codes corresponding to all cluster points includes: Count the frequency of the region codes corresponding to all cluster points; The region code corresponding to the highest frequency is used as the region code corresponding to the cluster center point.

7. The data query method according to claim 5, characterized in that, In the current order-of-magnitude simplification process, the clustering region corresponding to the spatial point with the highest density is taken as the current clustering region, including: Based on all the aggregation points in the previous magnitude simplification process, determine the set of merging points; Remove the set of merged points from the set of spatial points to be clustered corresponding to the previous order of magnitude simplification process to obtain the initial set of spatial points corresponding to the current order of magnitude simplification process; Add the clustering center points from the previous order-of-magnitude simplification process to the initial set of spatial points to obtain the set of spatial points to be clustered corresponding to the current order-of-magnitude simplification process; Based on the clustering center point in the previous order-of-magnitude simplification process and the spatial points other than the clustering point, determine the set of retained points and the density of each spatial point in the set of retained points. Based on the intersection of the merged point set and the set of points to be clustered in the current sub-order simplification process, the set of influencing points is determined; For any spatial point in the set of influence points, determine the first intersection of the spatial points in the cluster region corresponding to the spatial point and the set of merged points, remove the spatial points in the first intersection from the cluster region corresponding to the spatial point, and take the difference between the initial density of the spatial point and the number of spatial points in the first intersection as the first density of the spatial point. If the distance between the cluster center point in the previous simplification process and any spatial point is less than or equal to the preset radius, the cluster center point is added to the clustering region corresponding to any spatial point, and the first density of any spatial point is updated to obtain the second density of any spatial point. Update the initial density of each spatial point in the set of affected points to the second density; In the set of spatial points to be clustered corresponding to the current sub-order simplification process, the clustering region corresponding to the spatial point with the highest density is taken as the current clustering region.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data query method as described in any one of claims 1 to 7.

9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the data query method of any one of claims 1 to 7 through the computer program.

Citation Information

Patent Citations

  • Address library information processing method and device, electronic device and storage medium

    CN109635063A

  • Location service method and system, electronic equipment and storage medium

    CN114880421A