Google Maps Marker Cluster Problem

Hello guys,

My problem is that addMarkerCluster() does not work. Here is my code:

.get(link, headers)
.subscribe( data_ => {
    this.healthList = JSON.parse(data_['_body']);{
        markers: this.healthMarkers_1,
                icons: [
                      {min: 2, max: 100, url: "assets/icons/health_marker.png", anchor: {x: 16, y: 16}}

healthMarkers array consists of my markers:

$marker = array(
 'title' => $row['title'],
'snippet' => $snippet,
'icon' => array( 'url' => 'assets/icons/municipality_marker.png' ),
'position' => array( 'lat' => $row['lat'] , 'lng' => $row['lng'] )

The strange thing is that when I take the same markers array from a local sqlite table, the addMarkerCluster works fine!!! Any ideas?? I waste one day for this!

Thank you for your reply. I use excactly the same code. The problem is that when i put to an array data from a local sqlite table the addMarkerCluster works, but when I put to an array data from an sql server database, addMarkerCluster does not work properly. I realize that if i zoom out the map to the max the cluster appears but when i zoom in again, they disappear. Besides if i use addMarker for each marker of the second array, markers works perfect. The problem is the addMarkerCluster function and not the data. Any idea??

Finally it was my mistake. Lat and Lng in markers were not floats but strings. I used parseFloat() and clusters are ok now!

1 Like