Azure地图群集数据 [英] Azure Maps Cluster data

查看:88
本文介绍了Azure地图群集数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试抓取群集中的数据,以便在屏幕上呈现该信息。我试图在我的数据源上调用getClusterLeaves,但似乎无法使其工作。我正在传递集群ID,限制和偏移但我没有得到任何
回来。我可能传递了错误的限制和偏移值。有人可以清除限制和偏移值是什么?我对这些价值实际意味着什么感到困惑。当我点击一个引脚时,我可以看到所需的所有信息,但当我点击
一个群集时,它只会告诉我该群集中有多少个引脚。我正在尝试取回群集中每个引脚的数据。



谢谢


解决方案

getClusterLeaves方法返回一个记录的承诺
here

here
。以下是如何使用此方法的示例:

 datasource.getClusterLeaves(cluster_id,limit,offset).then(function(data){
var位置,属性;

for(var i = 0; i< = data.length; i ++){
if(data [i] instanceof Shape){
//数据可能来自数据源。
position = data [i] .getCoordinates();
properties = data [i] .getProperties();
} else {
//数据是一个特征,这意味着它可能是一个集群。
position = data [i] .geometry.coordinates;
properties = data [i] .properties;
}


//用坐标/属性做一些事情。
}
}

这里是围绕群集Azure地图的一堆代码示例:  https:// azuremapscodesamples。 azurewebsites.net/index.html?search=cluster


I'm trying to grab the data that's within a cluster to render that information on my screen. I'm trying to call getClusterLeaves on my datasource but can't seem to make it work. I'm passing in the cluster ID, limit and offset but Im not getting anything back. I maybe passing in the wrong limit and offset values. Could someone clear up what the limit and offset values are? I'm confused on what those values actually mean. I can see all the information I need when I click on a single pin but when I click on a cluster it just tells me how many pins are in that cluster. I'm trying to get back the data of each individual pin that's within the cluster.

Thanks

解决方案

The getClusterLeaves method returns a promise as documented here and here. Here is an example of how to use this method:

datasource.getClusterLeaves(cluster_id, limit, offset).then(function (data){
	var position, properties;
	
	for(var i=0;i<=data.length;i++){
		if(data[i] instanceof Shape){
			//Data likely came from a data source.
			position = data[i].getCoordinates();
			properties = data[i].getProperties();			
		} else {
			//Data is a feature which means it is likely a cluster.
			position = data[i].geometry.coordinates;
			properties = data[i].properties;
		}
		
		
		//Do something with the coordinates/properties.
	}
}

Here are a bunch of code samples around clustering Azure Maps: https://azuremapscodesamples.azurewebsites.net/index.html?search=cluster


这篇关于Azure地图群集数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆