JiriHoffmann / react-native-clusterer

React Native clustering library using C++ Supercluster implementation
MIT License
147 stars 19 forks source link

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

Open devransimsek opened 10 months ago

devransimsek commented 10 months ago

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

JiriHoffmann commented 7 months ago

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.

devransimsek commented 7 months ago

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?

JiriHoffmann commented 5 months ago

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.