Baidu map api to create an administrative area within the region to create a point mark can not be seen how to solve?

Baidu Map api creates an administrative area and adds dots inside the area without seeing how to solve it?

the environmental background of the problems and what methods you have tried

clipboard.png

related codes

        var map = new BMap.Map("mapContainer");
        map.centerAndZoom("", 9);
        // API
        map.enableScrollWheelZoom();
        getBoundary();
        var point = new BMap.Point(116.614759,39.971582);
        var marker = new BMap.Marker(point); //     
        map.addOverlay(marker);
        //function:
        function getBoundary() {
            var bdary = new BMap.Boundary();//
            // name:  callback:
            bdary.get("", function (rs) { // 
                map.clearOverlays(); //       
                var count = rs.boundaries.length; //
                if (count === 0) {
                    alert("");
                    return;
                }
                var pointArray = [];
                for (var i = 0; i < count; iPP) {
                    var ply = new BMap.Polygon(rs.boundaries[i], {
                        strokeWeight: 2,
                        strokeColor: "-sharpff0000",
                        fillColor: "yellow",
                        fillOpacity: 0.1
                    }); //
                    map.addOverlay(ply); //
                    pointArray = pointArray.concat(ply.getPath());//
                }
                //
                map.setViewport(pointArray); //  
            });
        }

the function to be implemented is to add multiple points in this administrative area, and the information window appears when you click on it. Excuse me, can"t you see that the points created now are overwritten? How to solve the problem?

May.14,2022

Hello, I have solved this problem. The key point is that the method of adding tags is written in the method of building administrative areas, as follows:

clipboard.png

clipboard.png

drawBoundary:

clipboard.png


have the bloggers solved the problem? I have recently encountered the same demand.

Menu