地图 聚类 java,反应本地地图聚类

I want to integrate maps in my react-native app, I am using the “react-native-maps” library for that

https://github.com/airbnb/react-native-maps

I want to use clustering but I am unable to find proper documentations related to that.

Please help me to find documentation of how to integrate maps with clustering and also tell which library is best for the implementation of clustering for both platforms, iOS and Android.

解决方案

You can use mapbox/supercluster repo, and here's a gist showing how to implements supercluster to React Native. It's initially developed for browser/node applications but you can still simply npm install and use it (javascript is javascript everywhere). Add the clustered markers into your MapView (originally shared here):

{ this.map = ref; }}>

{ this.state.markers.map((marker, index) => {

return (

coordinate={{ latitude: marker.geometry.coordinates[1], longitude: marker.geometry.coordinates[0] }}

onPress={() => this.markerPressed(marker)}>

);

})}

Warning from an issue of react-native-maps:

The major issue is performance, if you need to display hundreds or

thousands of markers you're gonna have to optimize the hell out of it,

and this is where it gets really hard.

react-native-maps also have an active conflicting PR which solves this issue both in Android and iOS natively, but it waits for a merge. However, you can manually implement it.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值