Markercluster-Baidu GEO chart

Source: Internet
Author: User

In 《Marker ClusterAppearanceI describedMarker ClusterUsage: used to solve the problem of overwriting when loading a large number of points to the map, and improve the performance. This document lists (2009Year), and give the illustration and link. In 《Bmsl: CustomClusterThe simplest AggregationAlgorithm, Gave a setBing MapOfC #Brief algorithm version. Map in China/GISOf the vendors, Hypergraph software and AMAP/MapabcThey all have their own similar solutions.

The principle of the algorithm is still the same as that of lattice, calculation, and aggregation. After translation or scaling, that is, the visible area of the map changes and recalculates. In fact, there can be more complex processing methods. Different solutions can be used to calculate distance aggregation, and different results will be produced. For example, you can assign some weights to a certain point based on the attribute information marked by each point, so that the "big point" that is finally aggregated will have different weights. For example, not purely based on distance, but a standard is attached, which falls within the specified province range (that is, the point mark in the boundary polygon of a province at the same time) can be aggregated to a block, and so on.Supermap iclientMany such parameters are provided for determination.

This article focuses onGoogle
MapsExtension LibraryMarkerclustererMigrate to Baidu MapAPIFor more information, seeV2,V3But made a lot of changes. For exampleClustermarkerThis custom covering class makes it independentMarkerclustererAlgorithm, which can be used separately. DeletedMarkerclustererAndOverlayBecause it is unnecessary. The final result is as follows: OnlineSample Link. (You can find the source code)

Explain the source code and important interfaces.MarkerclustererClass, that is, the "tag aggregator" class, is actually a "manager" responsible for aggregating the point tags on the map according to the algorithm according to certain parameter settings, and load it to the map.ClustermarkerClass, that is, the "aggregation tag" class, is a custom overlay, a complex tag, similarMarker, Refer to the previous stepsArticle"Custom cover". WhileClusterClass, the two are linked to play a bridge role, oneClusterContains multiple aggregatedMarkerThe form of representation on the map isClustermarker.

Constructor:Markerclusterer (map,
Opt_markers, opt_options): Map.

opt_markers is an optional parameter for locating multiple vertex tags added to a map, it is because you also provide addmarker , addmarkers and other methods to dynamically add tags.. Corresponding, removemarker , removemarkers , and clearmarkers and Other interfaces for deleting and clearing vertex tags. Whether it is dynamic addition or deletion, the calculation of cluster is performed again by default, unless the calculation parameter is forcibly declared, the calculation is not performed again. The attachment also provides getmarkers and getmarkerscount for ease of use.

Opt_optionsContainsGridsizeThe pixel range for control point aggregation. The default value is60.MaxzoomIs to control the maximum scaling level of aggregation, that is, all the layers are dispersed at which level, the default is18That is, the maximum level supported by Baidu map.AveragecenterIs to control the aggregation to one of theseMarkerTo aggregate the data into a back position. whether to take the average of the positions marked by all vertices. If not, use the first position. The default value isFalse.MinclustersizeMinimum ControlClusterThe number of contained items, that is, less than this number, cannot constituteClusterThe default value is2.StylesControlClusermarker. Basically, there is a correspondingGET/SetMethod. However, after dynamic changes, you need to call the refresh interface to automatically repaint.

OtherGetclusterscountTo obtainClusterQuantity. In order to improve performance, vertices that are not in the view are not involved in aggregate computing. ThereforeClusterscountIt is related not only to the zoom level, but also to the translation of the MAP and the change of the map's field of view. (Original article link)

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.