A method and device for processing spatial data

By building spatial indexes for spatial data sets and using message queues and idle threads for spatial correlation calculation, the problem of spatial data processing in the prior art consumes a large amount of computing resources, and more efficient spatial data processing is achieved.

CN114860725BActive Publication Date: 2025-03-18JINGDONG CITY BEIJING DIGITS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210454595.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2025-03-18
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

The prior art consumes a large amount of computing resources in spatial data processing, resulting in low processing efficiency, especially when processing a large number of spatial geometric objects.

Method used

By building spatial indexes for at least two types of spatial data sets and putting spatial geometry groups into the message queue, using idle threads to perform spatial correlation calculations, avoiding the comparison of uncorrelated spatial data from different spatial data sets one by one.

Benefits of technology

Effectively balance computing resources, reduce the consumption of computing resources, and improve spatial data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114860725B_ABST
    Figure CN114860725B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for spatial data processing, and relates to the field of data processing technology. A specific implementation of the method includes: obtaining at least two types of spatial data sets; constructing a spatial index for the spatial data sets; constructing a spatial geometry group according to the spatial index and at least two types of spatial data sets; putting the spatial geometry group into a message queue, and performing spatial correlation calculation on the spatial geometry group through an idle thread, wherein the idle thread is a thread for processing spatial data in the spatial data set. This implementation can effectively balance computing resources, reduce computing resource consumption, and improve spatial data processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method and device for spatial data processing. Background Art

[0002] In recent years, with the enrichment of spatial measurement methods, the improvement of measurement accuracy, and the increasing popularity of spatiotemporal sensors such as GPS, spatiotemporal data has been increasingly used. For example, we can monitor land status changes in different regions by combining and processing spatial data such as remote sensing data and surface cover data. For another example, through the associated trajectory data of taxis and the status information of the taxis themselves, a series of efficient parking locations can be mined, which can be recommended to idle car drivers, ultimately increasing the utilization rate of vehicles. It can be seen that finding the correlation between different types of spatial data is the basis for further processing or application of spatial data.

[0003] At present, in the process of spatial data processing, it is generally necessary to perform a cyclic association search between multiple spatial geometric objects included in two types of spatial data sets to find the associated spatial data, wherein the spatial geometric objects are composed of multiple spatial data. For example, the two types of spatial data sets are A and B, wherein A includes spatial geometric objects a1, a2, a3, ..., and B includes spatial geometric objects b1, b2, b3, b4, ..., and each spatial geometric object b1, b2, b3, b4, ... in B is firstly correlated with the spatial geometric object a1 in A, and then each spatial geometric object b1, b2, b3, b4, ... in B is firstly correlated with the spatial geometric object a2 in A, until all the spatial geometric objects in A are correlated with each spatial geometric object in B. Since the number of spatial geometric objects included in the spatial data set may be relatively large, and the amount of spatial data contained in the spatial geometric objects may also be relatively large, the current spatial data processing method will consume a lot of computing resources and lead to low efficiency of spatial data processing. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and apparatus for spatial data processing, which can effectively balance computing resources, reduce the consumption of computing resources, and improve the efficiency of spatial data processing.

[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for spatial data processing is provided, comprising:

[0006] Obtain at least two types of spatial datasets;

[0007] Building a spatial index for the spatial dataset;

[0008] constructing a spatial geometry group according to the spatial index and at least two types of the spatial data sets;

[0009] The spatial geometry group is put into a message queue, and spatial correlation calculation is performed on the spatial geometry group through an idle thread, where the idle thread is a thread used to process spatial data in the spatial data set.

[0010] Optionally, the above spatial data processing method further includes:

[0011] The number of threads for processing the spatial data is determined according to the number of the spatial geometry groups, wherein the number of the threads is smaller than the number of the spatial geometry groups.

[0012] Optionally, constructing a spatial index for the spatial dataset includes:

[0013] Selecting a target spatial dataset from at least two types of the spatial datasets;

[0014] A multi-level spatial index is constructed for the target spatial dataset.

[0015] Optionally, constructing a multi-level spatial index for the target spatial dataset includes:

[0016] Constructing a virtual bounding rectangle for the spatial data included in the target spatial data set;

[0017] The following steps S1 to S2 are executed cyclically:

[0018] S1: constructing a new virtual circumscribed rectangle for the plurality of virtual circumscribed rectangles according to the distances between the respective virtual circumscribed rectangles;

[0019] S2: Determine whether the new virtual bounding rectangle satisfies the loop stop condition. If so, construct a multi-level spatial index using the constructed virtual bounding rectangles and the new virtual bounding rectangle. Otherwise, use the new virtual bounding rectangle as the virtual bounding rectangle and execute step S1.

[0020] Optionally, each node included in the multi-level spatial index includes a pointer to the enclosed spatial data;

[0021] The construction space geometry group includes:

[0022] For other spatial datasets other than the target spatial dataset, execute:

[0023] Searching the multi-level spatial index for a target node that overlaps with the other spatial data sets;

[0024] Calling the spatial data corresponding to the target node through the pointer of the target node;

[0025] The spatial data corresponding to the target node and the spatial data related to the target node in the other spatial data sets are combined into a spatial geometry group.

[0026] Optionally, the above spatial data processing method further includes:

[0027] Storing the calculation results of the spatial geometry group into a result storage container;

[0028] Based on the calculation results stored in the result storage container, the position and / or distribution of the target to be analyzed included in the spatial data is determined.

[0029] Optionally, the spatial data included in the target spatial data set is two-dimensional data or three-dimensional data.

[0030] Optionally, the cycle stop condition includes:

[0031] The number of new virtual bounding rectangles is not greater than a preset number threshold;

[0032] or,

[0033] The number of layers of virtual bounding rectangles currently available meets the requirements of multi-level spatial indexing.

[0034] In a second aspect, an embodiment of the present invention provides a spatial data processing device, including: an acquisition module, an index construction module and a processing module, wherein:

[0035] The acquisition module is used to acquire at least two types of spatial data sets;

[0036] The index building module is used to build a spatial index for the spatial dataset;

[0037] The processing module is used to construct a spatial geometry group according to the spatial index and at least two types of spatial data sets; put the spatial geometry group into a message queue, and perform spatial correlation calculation on the spatial geometry group through an idle thread, wherein the idle thread is a thread used to process the spatial data in the spatial data set.

[0038] An embodiment of the above invention has the following advantages or beneficial effects: because by constructing spatial indexes and spatial geometry groups for at least two types of spatial data sets, one-to-one comparison of irrelevant spatial data included in different spatial data sets is avoided, and then, by placing the spatial geometry group in a message queue and performing spatial correlation calculation on the spatial geometry group through an idle thread among multiple threads for processing spatial data, the idle thread actively obtains the spatial geometry group, avoiding the problem of uneven calculation allocation of different threads, and being able to effectively balance computing resources, reduce computing resource consumption, and improve spatial data processing efficiency.

[0039] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0041] Figure 1 It is a schematic diagram of the structure of spatial data processing according to the prior art;

[0042] Figure 2 is a schematic diagram of the relationship between spatial geometric objects in two spatial data sets according to the prior art;

[0043] Figure 3 A schematic diagram of the main flow of the method for spatial data processing according to an embodiment of the present invention;

[0044] Figure 4 A schematic diagram of the main process of constructing a multi-level spatial index for a target spatial dataset according to an embodiment of the present invention;

[0045] Figure 5 A schematic diagram of the relative position relationship between a spatial geometric object and a virtual circumscribed rectangle according to an embodiment of the present invention;

[0046] Figure 6 A schematic diagram of a multi-level spatial index structure according to an embodiment of the present invention;

[0047] Figure 7 A schematic diagram of the main process of initially screening out spatial geometry groups according to an embodiment of the present invention;

[0048] Figure 8 is a schematic diagram of main modules of a device for spatial data processing according to an embodiment of the present invention;

[0049] Fig. 9 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0050] Fig.10It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0051] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0052] In the prior art, taking two spatial data sets as an example, the processing of spatial data can be as follows: Figure 1 and Figure 2 As shown. Figure 1 As shown, there are two spatial data sets A and B, wherein the spatial geometric objects included in spatial data A are composed of two-dimensional spatial data of longitude and latitude, and the longitude and latitude are used to indicate the business district or plot area or land or illegal construction area of ​​the city; the spatial geometric objects included in spatial data set B are composed of three-dimensional spatial data of buildings or landmarks (the three-dimensional spatial data generally includes the coordinates of the spatial distribution points of buildings or landmarks). In order to be able to find the distribution of a certain type of buildings included in a certain business district, such as residential buildings, or the buildings included in the illegal construction area. The prior art needs to combine the spatial geometric objects composed of all spatial data in the two spatial data sets A and B in pairs, that is, Figure 1 As shown, the spatial geometric objects a1, a2, a3, and a4 included in the spatial dataset A are paired with the spatial geometric objects b1, b2, b3, and b4 included in the spatial dataset B, that is, a1 is paired with b1, b2, b3, and b4, a2 is paired with b1, b2, b3, and b4, a3 is paired with b1, b2, b3, and b4, and a4 is paired with b1, b2, b3, and b4. Then, a spatial judgment operation is performed on each paired combination (a1, b1), (a1, b2), (a1, b3), (a1, b4), (a2, b1), (a2, b2), (a2, b3), (a2, b4), (a3, b1), (a3, b2), (a3, b3), (a3, b4), (a4, b1), (a4, b2), (a4, b3), and (a4, b4), that is, Figure 1 There are many spatial judgment operations, such as geometric intersection judgment, spatial inclusion judgment, etc. The combination that finally meets the judgment requirements will be stored in the result storage container Result Pool. For example, Figure 1If the paired combinations (a1, b1), (a1, b4), (a2, b2), (a3, b3) pass the spatial judgment operation, then (a1, b1), (a1, b4), (a2, b2), (a3, b3) are stored in the result storage container Result Pool. Since the spatial geometric object may be composed of a large amount of spatial data, the most time-consuming part of the entire operation process is the process of performing spatial judgment operations (Spatial Filter) on each pair of paired combinations, because this step requires a large number of geometric operations, and the more complex the geometric figures, the longer the Spatial Filter time. Therefore, all optimizations for Spatial Join are to reduce the Spatial Filter operations of paired combinations as much as possible, or to perform these operations concurrently. Figure 1 This calculation method is the most direct. It performs a two-by-two cyclic calculation on the spatial geometric objects in the two spatial datasets. For example, a spatial dataset grid has m spatial geometric objects, and another spatial dataset dbfg has n spatial geometric objects. Figure 1 The complexity of the method shown in this paper for processing spatial data is O(m*n). This is because Figure 1 The method given does not perform any optimization processing, and will also calculate many spatial geometric objects that have no possibility of intersection (are very far apart in space), resulting in a waste of computing resources such as CPU and GPU.

[0053] However, for Figure 2 As shown in the figure, there are two spatial datasets, grid and dbfg. The spatial dataset grid is the surface grid data of latitude and longitude, with a total of 2090 spatial geometric objects, and the spatial dataset dbfg includes spatial geometric objects composed of surface cover data, with a total of 41011 spatial geometric objects. The spatial distribution of the two spatial datasets grid and dbfg after superposition is as follows Figure 2 As shown in the figure. After investigation, it was found that there are a large number of complex spatial geometric objects in the dbfg data. The so-called complex spatial geometric objects refer to the internal geometric figures that are composed of a large number of node spatial data, and the spatial distribution is very irregular. For example, a single spatial geometric object in dbfg may contain more than 100,000 node spatial data, and a spatial geometric object occupies 1 / 4 of the entire spatial range. If we still use the above method, Figure 1 The illustrated implementation method will consume a large amount of computing resources for spatial data processing.

[0054] In order to solve the above problems, an embodiment of the present invention provides a method and device for spatial data processing.

[0055] Figure 3 is a method for spatial data processing according to an embodiment of the present invention, such as Figure 3As shown, the method for spatial data processing may include the following steps:

[0056] Step S301: obtaining at least two types of spatial data sets;

[0057] Each type of spatial data set may include spatial data and a plurality of spatial geometric objects formed by the spatial data; these spatial geometric objects may be buildings, roads, regions, and the like.

[0058] The at least two types of spatial data sets generally come from different data sources. For example, in order to determine the taxi parking spaces in various business districts, it is necessary to match the business district spatial data divided according to business needs and the taxi driving trajectory data obtained from the taxi platform, wherein the business district spatial data belongs to one type of spatial data set, and the spatial data constituted by the taxi driving trajectory data belongs to another type of spatial data set. For another example, in order to determine the illegal buildings in each area, the spatial data distributed in each area can be matched with various building spatial data and building type spatial data, wherein the spatial data distributed in each area belongs to one type of spatial data set, various building spatial data belong to another type of spatial data set, and various building types of spatial data belong to a third type of spatial data set. The types of spatial data contained in these different types of spatial data sets are generally different, and accordingly, the structures of the spatial geometric objects constituted by these spatial data are generally different, such as Figure 2 As shown in the figure, some spatial data constitutes a grid, while some spatial data constitutes a complex shape. However, different spatial data sets overlap to a certain extent in space (i.e., the spatial coordinates of the spatial geometric objects constituted by the spatial data included in different spatial data sets may overlap).

[0059] Step S302: constructing a spatial index for the spatial dataset;

[0060] The spatial index is a directory of spatial geometric objects composed of spatial data of a spatial dataset.

[0061] The specific implementation method of this step of constructing a spatial index for a spatial dataset can be: constructing a spatial index for any type of spatial dataset or constructing a spatial index for a selected target spatial dataset. That is, by constructing a spatial index for a type of spatial dataset, the efficiency of constructing a spatial geometry group in the subsequent step can be effectively improved.

[0062] Step S303: constructing a spatial geometry group according to the spatial index and at least two types of spatial data sets;

[0063] , wherein at least two spatial geometric objects composed of spatial data included in a spatial geometry group belong to different spatial data sets;

[0064] for example Figure 1 The shown (a1, b1) and (a1, b4) etc. can all be constructed spatial geometry groups.

[0065] Step S304: putting the spatial geometry group into a message queue, and performing spatial correlation calculation on the spatial geometry group through an idle thread, where the idle thread is a thread used to process spatial data in a spatial data set.

[0066] The multiple threads for processing spatial data monitor the spatial geometry groups in the message queue by subscribing to the message queue. Generally speaking, each spatial geometry group obtained in the above step S303 is put into the message queue. At this time, the idle thread can be informed that there is an unprocessed spatial geometry group in the message queue due to subscribing to the message queue, and the idle thread processes the spatial geometry group. Through this process, the accumulation of spatial geometry groups in the message queue can be avoided as much as possible, and the above steps S303 and S304 can be performed synchronously. For example, step S303 first constructs spatial geometry group 1, puts the spatial geometry group 1 into the message queue, and the idle thread X1 processes the spatial geometry group 1. The subsequent step S303 constructs spatial geometry group 2, puts the spatial geometry group 2 into the message queue, and the idle thread X2 processes the spatial geometry group 2, and so on.

[0067] The number of threads for processing spatial data can be determined according to the number of spatial geometry groups, wherein the number of threads is smaller than the number of spatial geometry groups. That is, in order to avoid the problem that some threads process too much data while other threads process too little data, by setting the number of threads smaller than the number of spatial geometry groups, the threads processing the spatial geometry groups with smaller data volumes can process more spatial geometry groups, so as to effectively balance the computational load of each thread and avoid the threads being idle for a long time.

[0068] exist Figure 3 In the illustrated embodiment, by constructing spatial indexes and spatial geometry groups for at least two types of spatial data sets, pairwise comparison of spatial geometry objects constituted by spatial data of different spatial data sets is avoided. Then, by placing the spatial geometry groups into a message queue and performing spatial correlation calculations on the spatial geometry groups through idle threads among multiple threads for processing spatial data, the idle threads actively acquire the spatial geometry groups, thus avoiding the problem of uneven calculation allocation of different threads. This can effectively balance computing resources, reduce computing resource consumption, and improve spatial data processing efficiency.

[0069] In addition, the thread pool will read the geometric pairs of the spatial geometric objects composed of the spatial data in the candidate pool in real time to ensure that all threads are performing calculations, and obtain new geometric pairs once the calculations are completed. In this way, thread pool resources will be fully utilized globally and will not cause idle calculations.

[0070] In an embodiment of the present invention, the specific implementation of constructing a spatial index for a spatial dataset may include: selecting a target spatial dataset from at least two types of spatial datasets; and constructing a multi-level spatial index for the target spatial dataset. The spatial data included in the target spatial dataset is two-dimensional data or three-dimensional data. In order to effectively improve the efficiency of the initial screening, the selected target spatial dataset is generally the spatial dataset containing the largest amount of spatial data or the selected target spatial dataset includes a spatial dataset of relatively complex spatial geometric objects.

[0071] In the embodiment of the present invention, Figure 4 As shown, the specific implementation of constructing a multi-level spatial index for the target spatial dataset may include the following steps:

[0072] Step S401: constructing a virtual bounding rectangle for the spatial data included in the target spatial data set;

[0073] The essence of this step is to construct a virtual bounding rectangle for each spatial geometric object composed of spatial data.

[0074] like Figure 5 The spatial data of a target spatial data set shown in the figure constitutes some spatial geometric objects P1, P2, P3, P4, P5, P6, P7, and P8, and their corresponding virtual enclosing rectangles are O1, O2, O3, O4, O5, O6, O7, and O8 respectively. It can be seen from the figure that the virtual enclosing rectangle is constructed based on the maximum and minimum values ​​of the spatial geometric objects.

[0075] Step S402: constructing a new virtual circumscribed rectangle for the multiple virtual circumscribed rectangles according to the distances between the virtual circumscribed rectangles;

[0076] The distance can be set accordingly according to actual needs. For example, a new virtual bounding rectangle is constructed from multiple virtual bounding rectangles that overlap. Another example is to construct a new virtual bounding rectangle from multiple virtual bounding rectangles whose distance is less than a set distance threshold. Figure 5 As shown, O1, O2, O3, and O4 construct a new virtual circumscribed rectangle D1, O5 and O6 construct a new virtual circumscribed rectangle D2, and O7 and O8 construct a new virtual circumscribed rectangle D3.

[0077] Step S403: determine whether the new virtual bounding rectangle meets the loop stop condition, if yes, execute step S404; otherwise, execute step S405;

[0078] The loop stopping condition in this step may include: the number of new virtual bounding rectangles is not greater than a preset number threshold; or the number of layers of existing virtual bounding rectangles currently meets the requirements of the multi-level spatial index.

[0079] For example, if the preset number threshold is 1, the total number of D1, D2 and D3 obtained above is 3, which is greater than 1, and D1, D2 and D3 need to be used as virtual bounding rectangles for another loop. If the preset number threshold is 2, the total number of D1, D2 and D3 obtained above is 2, and the loop is stopped.

[0080] For another example, if the required number of levels of the multi-level spatial index is 3 and the number of levels of the existing virtual bounding rectangle is also 3, the loop is stopped.

[0081] Step S404: construct a multi-level spatial index using each constructed virtual bounding rectangle and a new virtual bounding rectangle, and end the current process;

[0082] The constructed multi-level spatial index is as follows Figure 6 As shown, the root nodes of the multi-level spatial index include D1, D2, and D3, the leaf nodes O1, O2, O3, and O4 corresponding to the node D1, the leaf nodes O5 and O6 of the node D2, and the leaf nodes O7 and O8 of the node D3. Each node included in the multi-level spatial index contains a pointer to the enclosed spatial geometric object; the pointer can directly call the spatial data corresponding to the spatial geometric object from the memory or storage space.

[0083] Step S405: taking the new virtual bounding rectangle as the virtual bounding rectangle, and executing step S402.

[0084] In the embodiment of the present invention, each node included in the multi-level spatial index includes a pointer to the enclosed spatial data or the spatial geometric object composed of the enclosed spatial data; accordingly, Figure 7 As shown, the specific implementation method of initially screening out spatial geometry groups from at least two types of spatial data sets may include the following steps:

[0085] For other spatial datasets other than the target spatial dataset, execute step S701:

[0086] Step S701: searching for target nodes that overlap with other spatial data sets from a multi-level spatial index;

[0087] The essence of searching for target nodes that overlap with other spatial data sets is to search for target nodes that overlap with spatial geometric objects formed by spatial data in other spatial data sets.

[0088] For example, for Figure 6 The multi-level spatial index shown is constructed by spatial geometric objects composed of spatial data included in spatial dataset B. The spatial geometric object 1 in other spatial dataset A first determines the nodes with spatial overlap from D1, D2, and D3, such as D1. Then, leaf nodes O1, O2, O3, and O4 under D1 are found to overlap with the spatial geometric objects 1 in other spatial datasets A, such as O1 and O2. Then, the spatial geometric object 1 forms a spatial geometric group with the spatial geometric objects corresponding to O1 and O2 respectively.

[0089] Step S702: calling the spatial data corresponding to the target node through the pointer of the target node;

[0090] Step S703: Combine the spatial data corresponding to the target node and the spatial data related to the target node in other spatial data sets into a spatial geometry group.

[0091] After the multi-level spatial index is established, it can help speed up the construction of spatial geometry groups. In the process of searching through the multi-level spatial index, those objects in the multi-level spatial index that are not queried by any spatial geometry object in other spatial datasets will not be matched with other spatial datasets, thus filtering out most of the data. In addition, because the search of the multi-level spatial index uses a virtual bounding rectangle for calculation, it is not an accurate spatial filter, which can further improve the efficiency of building or filtering spatial geometry groups.

[0092] In an embodiment of the present invention, the above-mentioned method for processing spatial data may further include: storing the calculation results of the spatial geometry group into a result storage container; and determining the location and / or distribution of the target to be analyzed included in the spatial data based on all the calculation results of at least two types of spatial data sets stored in the result storage container. The target to be analyzed may be a building on the illegally used land, a taxi parking spot, a surface river distribution, a location of an electric vehicle charging pile, or a distribution of residential buildings in a business district, etc.

[0093] like Figure 8 As shown, an embodiment of the present invention provides a spatial data processing device 800, which may include: an acquisition module 801, an index construction module 802 and a processing module 803, wherein:

[0094] An acquisition module 801 is used to acquire at least two types of spatial data sets;

[0095] An index building module 802, used to build a spatial index for the spatial data set;

[0096] The processing module 803 is used to construct a spatial geometry group according to the spatial index and at least two types of the spatial data sets; put the spatial geometry group into a message queue, and perform spatial correlation calculation on the spatial geometry group through an idle thread, where the idle thread is a thread used to process the spatial data in the spatial data set.

[0097] In the embodiment of the present invention, the processing module 803 is further used to determine the number of threads for processing spatial data according to the number of spatial geometry groups, wherein the number of threads is less than the number of spatial geometry groups.

[0098] In the embodiment of the present invention, the index building module 802 is further used to select a target spatial dataset from at least two types of spatial datasets; and build a multi-level spatial index for the target spatial dataset.

[0099] In the embodiment of the present invention, the index construction module 802 is further used to construct a virtual bounding rectangle for the spatial data included in the target spatial data set; and cyclically execute the following steps S1 to S2:

[0100] S1: constructing a new virtual bounding rectangle for multiple virtual bounding rectangles according to the distances between the virtual bounding rectangles;

[0101] S2: Determine whether the new virtual bounding rectangle meets the loop stop condition. If yes, construct a multi-level spatial index using the constructed virtual bounding rectangles and the new virtual bounding rectangle. Otherwise, use the new virtual bounding rectangle as the virtual bounding rectangle and execute step S1.

[0102] In an embodiment of the present invention, each node included in the multi-level spatial index contains a pointer to the enclosed spatial data; the processing module 803 is further used to execute, for other spatial data sets other than the target spatial data set: from the multi-level spatial index, searching for a target node that overlaps with other spatial data sets; calling the spatial data corresponding to the target node through the pointer of the target node; combining the spatial data corresponding to the target node and the spatial data related to the target node in other spatial data sets into a spatial geometry group.

[0103] In an embodiment of the present invention, the processing module 803 is further used to store the calculation results of the spatial geometry group into a result storage container; based on all calculation results of at least two types of spatial data sets stored in the result storage container, determine the position and / or distribution of the target to be analyzed included in the spatial data.

[0104] In the embodiment of the present invention, the spatial data included in the target spatial data set is two-dimensional data or three-dimensional data.

[0105] In the embodiment of the present invention, the loop stop condition of the index building module 802 includes:

[0106] The number of new virtual bounding rectangles is not greater than a preset number threshold; or, the number of layers of existing virtual bounding rectangles meets the requirements of multi-level spatial indexing.

[0107] It is worth noting that the above-mentioned spatial data processing device can be applied to terminal devices as well as servers.

[0108] The following takes the application of a method or device for spatial data processing to a server as an example to elaborate on the system architecture of a method or device for spatial data processing provided by an embodiment of the present invention.

[0109] Fig. 9 An exemplary system architecture 900 is shown to which the method or apparatus for spatial data processing according to the embodiment of the present invention may be applied.

[0110] like Fig. 9 As shown, system architecture 900 may include terminal devices 901, 902, 903, network 904 and server 905. Network 904 is used to provide a medium for communication links between terminal devices 901, 902, 903 and server 905. Network 904 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0111] The user can use the terminal devices 901, 902, and 903 to interact with the server 905 through the network 904 to receive or send messages, etc. For example, a spatial data processing request is sent to the server 905, and the processing result of the spatial data for the spatial data processing request is received from the server 905. Various communication client applications can be installed on the terminal devices 901, 902, and 903, such as spatial mapping applications, positioning applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0112] The terminal devices 901 , 902 , and 903 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0113] The server 905 may be a server that provides various services, such as a background management server (only an example) that provides support for spatial data processing requested by users using the terminal devices 901, 902, and 903. The background management server may analyze the spatial data and feed back the processing results (such as the location of the target building, the distribution of the target building - only an example) to the terminal device.

[0114] It should be noted that the spatial data processing method provided in the embodiment of the present invention is generally executed by the server 905 , and accordingly, the spatial data processing device is generally disposed in the server 905 .

[0115] It should be understood that Fig. 9 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0116] Reference below Fig.10 , which shows a schematic diagram of the structure of a computer system 1000 of a terminal device or a server suitable for implementing an embodiment of the present invention. Fig.10 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0117] like Fig.10 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the system 1000 are also stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0118] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.

[0119] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the central processing unit (CPU) 1001, the above-mentioned functions defined in the system of the present invention are executed.

[0120] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0121] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0122] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, they may be described as: a processor includes an acquisition module, an index building module, a preliminary screening module, and a processing module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the acquisition module may also be described as a "module for acquiring at least two types of spatial data sets".

[0123] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining at least two types of spatial data sets; constructing a spatial index for the spatial data set; constructing a spatial geometry group according to the spatial index and at least two types of the spatial data sets; placing the spatial geometry group in a message queue, and performing spatial correlation calculation on the spatial geometry group through an idle thread, wherein the idle thread is a thread for processing spatial data in the spatial data set.

[0124] According to the technical solution of the embodiment of the present invention, by constructing spatial indexes and spatial geometry groups for at least two types of spatial data sets, pairwise comparison of spatial geometry objects composed of spatial data included in different spatial data sets is avoided. Then, by placing the spatial geometry groups in a message queue and performing spatial correlation calculation on the spatial geometry groups through idle threads in multiple threads for processing spatial data, the idle threads actively obtain the spatial geometry groups, avoiding the problem of uneven calculation allocation of different threads. This can effectively balance computing resources, reduce computing resource consumption, and improve spatial data processing efficiency.

[0125] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for spatial data processing, characterized in that: include: Obtain at least two types of spatial datasets; Constructing a spatial index for the spatial dataset, wherein the spatial index is constructed based on a target spatial dataset in at least two types of spatial datasets, the spatial index is a multi-level spatial index, and each node included in the multi-level spatial index includes a pointer, and the pointer points to the spatial data surrounded by the node or the spatial geometric object formed by the spatial data surrounded by the node; According to the spatial index and the at least two types of spatial data sets, constructing a spatial geometry group includes: for other spatial data sets other than the target spatial data set, performing: searching for a target node overlapping with the other spatial data sets from the multi-level spatial index; calling spatial data corresponding to the target node through a pointer of the target node; combining the spatial data corresponding to the target node and the spatial data related to the target node in the other spatial data sets into a spatial geometry group; The spatial geometry group is put into a message queue, and spatial correlation calculation is performed on the spatial geometry group through an idle thread, where the idle thread is a thread used to process spatial data in the spatial data set.

2. The method according to claim 1, characterized in that Also includes: The number of threads for processing the spatial data is determined according to the number of the spatial geometry groups, wherein the number of the threads is smaller than the number of the spatial geometry groups.

3. The method according to claim 1, characterized in that The step of constructing a multi-level spatial index for the target spatial dataset includes: Constructing a virtual bounding rectangle for the spatial data included in the target spatial data set; The following steps S1 to S2 are executed cyclically: S1: constructing a new virtual circumscribed rectangle for the plurality of virtual circumscribed rectangles according to the distances between the respective virtual circumscribed rectangles; S2: Determine whether the new virtual bounding rectangle satisfies the loop stop condition. If so, construct a multi-level spatial index using the constructed virtual bounding rectangles and the new virtual bounding rectangle. Otherwise, use the new virtual bounding rectangle as the virtual bounding rectangle and execute step S1.

4. The method according to claim 1, characterized in that: Also includes: Storing the calculation results of the spatial geometry group into a result storage container; Based on the calculation results stored in the result storage container, the position and / or distribution of the target to be analyzed included in the spatial data is determined.

5. The method according to claim 1 or 3, characterized in that: The spatial data included in the target spatial data set is two-dimensional data or three-dimensional data.

6. The method according to claim 3, characterized in that The cycle stop condition includes: The number of new virtual bounding rectangles is not greater than a preset number threshold; or, The number of layers of virtual bounding rectangles currently available meets the requirements of multi-level spatial indexing.

7. A spatial data processing device, characterized in that: include: Acquisition module, index building module and processing module, among which, The acquisition module is used to acquire at least two types of spatial data sets; The index building module is used to build a spatial index for the spatial dataset, wherein the spatial index is constructed based on a target spatial dataset in at least two types of spatial datasets, the spatial index is a multi-level spatial index, and each node included in the multi-level spatial index includes a pointer, and the pointer points to the spatial data surrounded by the node or the spatial geometric object formed by the spatial data surrounded by the node; The processing module is used to construct a spatial geometry group based on the spatial index and at least two types of spatial data sets, specifically including: for other spatial data sets other than the target spatial data set, executing: searching for a target node that overlaps with the other spatial data sets from the multi-level spatial index; calling the spatial data corresponding to the target node through a pointer to the target node; combining the spatial data corresponding to the target node and the spatial data related to the target node in the other spatial data sets into a spatial geometry group; placing the spatial geometry group into a message queue, and performing spatial correlation calculation on the spatial geometry group through an idle thread, wherein the idle thread is a thread used to process the spatial data in the spatial data set.

8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Three-dimensional point cloud data storage method and device and three-dimensional point cloud data query method and device

    CN110413808A

  • Spatial connection query method and device, electronic equipment and storage medium

    CN113722314A