The POI that divides based on road mesh hierarchical structure simplifies parallel calculating method
Technical field
The present invention relates to a kind of vector data division methods, can realize POI (Points of Interest) data are divided efficiently, technical applications is that POI simplifies parallel computation.
Background technology
POI, point of interest, contained the most frequent Back ground Information in people's daily lifes such as food and drink, amusement, financial institution, tourist attractions, landmark, refuelling station, parking lot, the accuracy of POI data, the degree of enriching of attribute, the sharpness of expression and real-time display efficiency thereof all will influence quality and the availability of moving map.But current POI expresses and has many problems, particularly when the user search customizing messages, because the Query Result data volume is bigger, can causes overlapping, the gland of POI etc., and then influence the user to the cognition of geographical space, the availability of reduction map.
Map comprehensively is a feasible program that addresses this problem, but at present also less at the comprehensive operator of POI, algorithm, and decades have been carried out in the synthetic study of some key element, and existing many ripe algorithms can be used for reference a little comprehensive method and handle the POI data.The space attribute that the simplification operator of point is based on is a little concentrated the selection subclass from original point, can keep thematic information and the topology information of POI preferably, is suitable for solving current POI and expresses the problem that exists.But existing shortcut calculation efficient is generally not high, can not the real-time demand of expressing of satisfying magnanimity POI.These algorithms are combined with the high-performance calculation technology, improve the efficient that algorithm is carried out, a kind of feasible technical scheme will be provided for the solution of this problem.
Summary of the invention
The purpose of this invention is to provide the POI data partition method under a kind of road mesh hierarchical structure constraint, simplify the efficient of calculating to improve POI.At first make up path layer aggregated(particle) structure and mesh prime area, grade according to road is divided the mesh zone successively, set up the hierarchical structure of road mesh, on this basis, use the road mesh to the POI space segmentation, the POI of magnanimity is divided into one by one in the road mesh, reduces the complexity of problem solving.According to the hierarchical structure of number and the road mesh of computing node, divide the POI data, data allocations to computing node, and then to POI simplifications that walk abreast, is improved the efficient of POI simplification calculating.
Technical solution of the present invention is: the POI that divides based on road mesh hierarchical structure simplifies parallel calculating method, and its used basic variable is as shown in table 1.
Table 1 is based on the variable description of road mesh hierarchical structure decomposition algorithm
Step of the present invention is as follows:
(1) according to data characteristics and cluster enabled node number, calculates used variable: N, K, N in the partition process
A, N
D, N
U
(2) road mesh hierarchical structure makes up, the structure of road net level mesh is exactly the level division of the road net region being carried out the zone, the importance rate of road will influence cutting procedure and result, high level road at first carries out rough segmentation to the zone, the inferior grade road is further cut apart the zone on the basis of rough segmentation, because the difference of road importance rate makes the closed region have level characteristics, such closed region is exactly the road mesh.Comprise two basic steps: a) make up border, maximum closed region, maximum closed region namely is initial mesh in the road mesh hierarchical structure of dividing at the POI data, they are different with traditional road mesh hierarchical structure, and this maximum closed region is the minimum boundary rectangle of POI data; B) choose grade, length, road that interconnectedness is the highest successively, mesh is cut apart, progressively make up the mesh layer aggregated(particle) structure.
(3) road mesh and POI Data Matching.Traversal road mesh and POI data, the spatial relationship of judgement POI and road mesh if the road mesh comprises POI, then joins this POI in the POI set of current road mesh, calculates the number of POI in each mesh.
(4) begin to divide calculating from bottom mesh, the sequence number of establishing current mesh is i, and counting that it comprises is Ni, if Ni<N
D, execution in step 5; If Ni>N
U, execution in step 6; If N
D<Ni, and Ni≤N
U, execution in step 7.
(5) its adjacent mesh is added current zoning, continues execution in step 4, all participate in dividing up to all fraternal meshes of mesh i, if this moment Ni<N
D, then current mesh i and the brotgher of node thereof are merged in the brotgher of node of its father node, and with these meshes as division unit independently, again from its new brotgher of node, continue to divide according to step 4 and all be divided up to all meshes.
The mesh node that (6) will add is at last decomposed, if current mesh is formed by itself data and other mesh count strong point, so when decomposition, decompose the data that itself comprise, and do not decompose other mesh data, by decomposing mesh, make the interstitial content Ni=N of current distribute data piece i
A, it is distributed to a computing node, the remainder from the mesh that is decomposed begins to continue execution in step 4 then.
(7) the above-mentioned mesh of dividing requirement that meets is packaged as a data block, forwards step 4 to and continue to carry out, all be assigned with up to current all meshes, finish partition process.
(8) according to known interstitial content, create certain number of threads, with the data after dividing, distribute to each thread successively.
(9) parallel POI, the return results simplified.
The present invention has following advantage compared to prior art:
(1) present POI comprehensively is the angle from single key element, only POI is simplified, do not consider other key element to the influence of POI, the present invention considers road net in its data partition process to the influence of POI, can better keep simplifying thematic information and the topology information of back POI.
(2) traditional data partition method reckons without the feature of shortcut calculation, needs the cooperation between process, the thread, and the present invention adopts the road mesh to divide the POI data.Road network is divided into map different zones natively, and POI is in a certain mesh of road network, POI between the mesh is completely cut off by road, it is in space and semantically all separate, reduced the space of finding the solution of problem, and be computing unit with the mesh, reduced internodal communication, improve POI and simplified the efficient of calculating.
Description of drawings
Fig. 1 is basic flow sheet of the present invention.
Fig. 2 is for using the present invention to somewhere POI division result figure, and wherein figure (a) is raw-data map, and figure (b) is 2 node division figure as a result, and figure (c) is 4 node division figure as a result, and figure (d) is 6 node division figure as a result, and figure (e) is 8 node division figure as a result.
Fig. 3 does not carry out the comparison diagram of efficient for using the present invention with using algorithm of the present invention.
Embodiment
In conjunction with process flow diagram shown in Figure 1, be example with 4 computing nodes, to the road net in somewhere and the POI data are divided and parallel the simplification calculated (wherein road data comprises 69 roads, and the POI data comprise 12006 points), specific implementation method of the present invention is described:
1, main thread reads road and POI data, calculates each data and divides each Parameter N, K, N
A, N
U, N
D, N=12006, K=4, N
A=3001, N
U=2801, N
D=3201.
2, main thread calculates the minimum boundary rectangle frame of POI, the initialization road data, grade, length, interconnectedness structure path layer aggregated(particle) structure data structure according to road are Road<road ID, road level ID, Box>, calculate the minimum boundary rectangle frame of road, this minimum boundary rectangle is exactly initial mesh, and its data structure is Cell<ID, POISet, PointSet, Box, POISum>, wherein POISet is its contained POI set, PointSet is for constituting the some set of itself, and Box is minimum boundary rectangle frame, and POISum is the total number that comprises POI.
3, from highest-ranking road level, use road Road that current all meshes are divided successively, calculate the spatial relationship of minimum boundary rectangle frame and the minimum boundary rectangle frame of mesh of road earlier,, they continue to calculate the spatial relationship of road and mesh if intersecting, calculate its intersection point, according to its position of intersecting point, calculate the PointSet and the Box that divide the back mesh, progressively set up the hierarchical structure of road mesh.
4, from the leaf node of the road mesh leftmost side, calculate the relation of leaf node and POI data successively, set up the space correlation relation of POI and mesh, if POI is comprised in the POISet set that just this point is joined mesh by this mesh, calculate the total POISum of POI in each mesh.
5, main thread from the leaf node of the road mesh leftmost side, is judged mesh POISum and N according to current interstitial content
A, N
U, N
DRelation, if less than N
UThen just use the data allocations strategy that meets this situation; If greater than N
U, and less than N
DJust use allocation strategy, with the packing of these data be assigned to a data block (structure of data block is Block<CellsSet, POINum, POISet>); If greater than N
DJust using the allocation strategy that splits, is two nodes with specific node division, all is assigned with up to all meshes.Describe with regard to some special circumstances below, the data volume of supposing present node i is 3000, then directly it is distributed to a node, continuation is divided unappropriated node, if data volume has exceeded the division upper limit after adding ingress j, preferentially j is divided into two subclass, one of them subset division is to present node, and another subset division is to the another one node.
In main thread, create 4 sub-threads, successively with Block[0], Block[1], Block[2], Block[3] distribute to this 4 threads, each thread is treatments B lock successively, POISet in the data block is simplified, all finish dealing with up to all threads, POISet among the Block is returned to main thread, finish calculating.
Fig. 2 divides experimental result picture for data, and setting K is 2,4,6,8 result among the figure, has provided the node number that each road mesh belongs to, and has analyzed its load balancing, and is as shown in table 2, analyzes and divides the requirement that the result has satisfied load balancing as can be known.
Table 2 road mesh hierarchical structure is divided statistical form as a result
Fig. 3 has provided the execution of " circle " growth algorithm that uses this data dividing mode, and efficient its speed-up ratio as seen from the figure increases along with the increase of interstitial content, and has reached ultra linear increase, illustrates that this method can improve algorithm efficiency greatly.