Baidu map api-Baidu Map API Development, the use of markerclusterer for point aggregation problems

Source: Internet
Author: User
Keywords Baidu Map API Baidu map PHP javascript
Baidu Map API Baidu map Phpjavascript

Novice Help, I developed the program to place marker on the map, is done by a function:

  function Addmarker (getpoint,outcontent,titlecontent) {var opts = { Position:getpoint,//Specifies the location where the text callout is located offset:new bmap.size (10, 0)//Set text offset} var label = new Bmap.label (titlecontent, O pts);  Create a text callout object Label.setstyle ({color: "Red", FontSize: "12px", Height: "20px", Lineheight: "20px", fontFamily: "Microsoft Jas Black"}); var marker = new Bmap.marker (getpoint); var Infowindow = new Bmap.infowindow (outcontent,{width:300}); Create Information Window object//var Titlewindow = new Bmap.infowindow (titlecontent, {width:50,height:5}); Map.addoverlay (marker); Marker.addeventlistener ("MouseOver", function () {this.map.addOverlay (label);}); Marker.addeventlistener ("Mouseout", function () {this.map.removeOverlay (label);}); Marker.addeventlistener ("click", Function () {This.openinfowindow (Infowindow); document.getElementById (' Smallpic ')  . onload = function () {Infowindow.redraw ();} }); }

Then use the For loop to set the coordinates of each point that has been read, the label to be displayed, the contents of the Infowindow that need the popup, and punctuation on the map:

 for (i = 0; i < locations.length; i++) {addMarker(point,readContent,titleContent); }

Now the problem is a lot of points, need to use markerclusterer for point aggregation, but if you follow the example code, build an array to import all the coordinates, the aggregation is successful, but the resulting aggregation point is no label and Infowindow, It feels like the aggregation point is directly generating a batch of new marker caps on top. How can I write to solve this problem? Thank you!

  • 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.