Map Point Aggregation optimization scheme

Source: Internet
Author: User

First, why do I need a dot aggregation

The results of the query on the map are usually shown as marker points, but if there are more markers, they will not only greatly increase the client's rendering time, but will make the client become very card-making, and can cause intense phobia (Figure 1). In order to solve this problem, we need a means to display the most comprehensive information with the smallest area within the user's limited viewable area, without overlapping coverage.

Figure 1

second, the scheme has been tried---kmeans

The intuition uses the clustering algorithm to achieve our goal better, therefore uses the simple Kmeans clustering. Based on the client's request, we know the scope of the client's display and fetch the data in this range into the index engine, Kmeans the data, and finally returns the result to the client.

but on-line found Kmeans effect is not satisfactory , mainly has the following two shortcomings .

A) Performance issues

Kmeans is a computationally intensive algorithm that needs to be iterated multiple times to complete, and each iteration involves a complex distance calculation that consumes the CPU.

We ran into a high load problem after the launch.

b) Effect issues

Kmeans failed to resolve overlapping overlay issues completely! You can see that some of the aggregated icons are stacked together.

third, the optimization program

Again, we need a means to display the most comprehensive information in the smallest area of the user's limited viewable area, without overlapping coverage.

3.1. Direct Grid Method

When solving geospatial-related problems, the method of dividing spatial grids is often used.

principle : Divides the map extent into squares of a specified size (each zoom level is different size), then aggregates the points falling in the corresponding lattice into the square (the center of the square), and the final square shows only one center point, and the point shows the number of original points that the aggregation point contains.

How do you drop a point into a square? We map the space by specifying the size of the 100*100 by this formula.

Advantages : The computation speed is fast, each original point only needs to calculate once, does not have the complex distance computation.

disadvantage : Sometimes obviously very close to the point, but only because the boundaries of the network is forced to separate in different aggregation points, in addition, the location of the aggregation point is the center of the grid, rather than the grid's centroid, so the aggregation of points may not be more accurate reflection of the original point information.

3.2. Grid Distance Method

principle : Follow the idea of the scheme, 1) to the various points into the corresponding square; 2) to solve the centroid of each grid; 3) Merge centroid: Determine if the centroid is within a certain range, and if it is merged within a certain range.

How do you determine if each centroid point needs to be merged? Take point A as an example, draw a rectangle or circle range, fall within the scope of the merger, B, C are falling within the range, so a, B, c three point merger.

Advantages : The operation speed is also relatively fast, relative to the scheme one, more than the solution centroid and centroid merging two steps, but these two steps are relatively simple, can be completed quickly.

3.3. Direct Distance Method

principle : Initially there is no known aggregation point, then iterate over each point, calculate a point of the outsourced square, if the outsourced square of this point does not intersect with the existing aggregation point of the outsourced square, then the new aggregation point (here is not the distance between the calculation point and point, but the calculation of a point of the outsourced square, The length of the square is specified by the user or the program sets a default value), if intersected, the point is aggregated into the aggregation point, if the point intersects with the outsourced square of several known aggregation points, the distance from the point to the aggregation point is computed, aggregated to the nearest aggregation point, so that the loop is completed until all points have been traversed. Each zoom level iterates through all the original point features.

Advantages : The computation speed is relatively fast, each original point only need to calculate once, may be somewhat with the point distance computation, the aggregation point more accurately reflects contains the original point features location information.

disadvantage : speed is not as fast as the speed of the grid, this method also has a disadvantage, that is, the various points of different iteration order results in different end result. Therefore, the problem of developing an iterative sequence is involved.

3.4. K-d Tree Method

This method needs to combine PCA (principal component analysis) and k-d tree, which is better in effect, but the performance is poor and the implementation is more complicated. (http://applidium.com/en/news/too_many_pins_on_your_map/)

Reference Documents

Https://developers.google.com/maps/articles/toomanymarkers

http://applidium.com/en/news/too_many_pins_on_your_map/

Research on the algorithm of tagging point aggregation based on Baidu map

Point aggregation algorithm of online map and its present situation

Map Point Aggregation optimization scheme

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.