100 markers are added to the map.
var marker = new google.maps.Marker({ position: latlng, icon: image, map: map }); gmarkers.push(marker); There is an image
CustomCircle = function (center, radius, map) { this.bounds_ = new google.maps.Circle({ center: center, radius: radius }).getBounds(); this.map_ = map; this.div_ = null; this.setMap(map); }; CustomCircle.prototype = new google.maps.OverlayView(); CustomCircle.prototype.onAdd = function () { var div = document.createElement('div'); div.style.position = 'absolute'; var circle = document.createElement('div'); circle.className = 'circle'; //class with custom styling circle.style.width = '100%'; circle.style.height = '100%'; circle.style.position = 'absolute'; div.appendChild(circle); this.div_ = div; var panes = this.getPanes(); panes.overlayLayer.appendChild(div); }; CustomCircle.prototype.draw = function () { var overlayProjection = this.getProjection(); var sw = overlayProjection.fromLatLngToDivPixel(this.bounds_.getSouthWest()); var ne = overlayProjection.fromLatLngToDivPixel(this.bounds_.getNorthEast()); var div = this.div_; div.style.left = sw.x + 'px'; div.style.top = ne.y + 'px'; div.style.width = (ne.x - sw.x) + 'px'; div.style.height = (sw.y - ne.y) + 'px'; }; CustomCircle.prototype.onRemove = function () { this.div_.parentNode.removeChild(this.div_); this.div_ = null; }; which is added to certain markers, with no problems added
CustomCircles = new CustomCircle(center, radius, map); Circles.push(new CustomCircle(center, radius, map)); How to remove one particular image
Circles[i].onRemove(); leads to error Cannot read property 'parentNode' of null