react-native-clusterer icon indicating copy to clipboard operation
react-native-clusterer copied to clipboard

Cluster can not explose markers when markers are too near each other

Open devransimsek opened this issue 2 years ago • 3 comments

I also get an error when I press the Cluster.

https://github.com/JiriHoffmann/react-native-clusterer/assets/28485486/b4ccc54a-8c43-49a0-915b-75fa86447bc6

The example geojson; [ { "type": "Feature", "properties": { "id": 3560, "lat_y": 38.257204, "long_x": -121.3739 }, "geometry": { "type": "Point", "coordinates": [ -121.3739, 38.257204 ] } }, { "type": "Feature", "properties": { "id": 1949, "lat_y": 38.257204, "long_x": -121.373203 }, "geometry": { "type": "Point", "coordinates": [ -121.373203, 38.257204 ] } }, ]

radius of Clusterer is 18

"react-native": "0.72.4", "react-native-clusterer": "^1.3.0", "react-native-maps": "^1.8.0",

Can you please help? @JiriHoffmann

devransimsek avatar Nov 18 '23 15:11 devransimsek

I am unable to reproduce the error with the example points you provided. However, if you have multiple points with the exact same coordinate (in this case both have 38.257204 latitude), the expansion Region will have a delta of 0 resulting in react-native-maps not animating the zoom and just centering the cluster. I would suggest replacing the latitudeDelta with a small value such as 0.001 and the camera will zoom in during the animation. You can adjust at what zoom all clusters turn into points with the minZoom options property.

JiriHoffmann avatar Feb 18 '24 20:02 JiriHoffmann

Hi, @JiriHoffmann Thank you for the answer! I changed the initialRegion's latitudeDelta to 0.001 and played with minZoom but It did not work! Is there anything else that can affect this problem?

devransimsek avatar Feb 21 '24 19:02 devransimsek

In this case, you would use maxZoom, because you are zooming in and thus the zoom value is higher. There was a bug with maxZoom, but it should be fixed in v2.0.0. Let me know if that resolves the issue.

JiriHoffmann avatar Mar 25 '24 00:03 JiriHoffmann