融合表映射中的标记计数 [英] Marker count in fusion table map

查看:160
本文介绍了融合表映射中的标记计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我浏览了以下两个链接:第一第二< a>其中解释了如何在融合表映射层中添加标记的计数。我尝试了同样的技术在我的示例地图,但它没有工作。实际上,我需要关键的,最优的,正常的转基因的计数,单独和所有的总和。

I went through these two links: first and second which explains how to add count of marker in fusion table map layer. I tried the same technique in my sample map but it didn't work. Actually i need the count of critical, optimal, normal transforers seperately and the total of all. Also i want to know that can I add these counts in map legend?

推荐答案

一年多前,我发布了一个答案示例代码是在第一链接中采用的相同方法。 http://stackoverflow.com/a/9778985 。请参阅getFTCount()函数。
这两个示例的问题是它们是旧的,并使用已弃用的FT SQL API,而不是V1.0 API。

Over a year ago, I posted an answer with example code which is the same approach taken in your "first" link. http://stackoverflow.com/a/9778985. See the getFTCount() function. The problem with both these examples is that they are old and use the deprecated FT SQL API, not the V1.0 API.

您需要一个Google API密钥。和jQuery。您需要在代码中更改的一件事是:

You will need a Google API key. And jQuery. The one thing you'll need to change in the code is:

var apiKey = "XXXXXX";
var queryUrlHead = 'https://www.googleapis.com/fusiontables/v1/query?sql=';
var queryUrlTail = '&key=' + apiKey + '&callback=?';

更新:我修复了jsfiddle几个问题:

Update: I fixed your jsfiddle to make it work. Couple of issues:


  • 新的API返回data.columns和data.rows,而不是data.table.rows。

  • 我想新的API返回json整数,而不是字符串,jquery似乎反对传递数字到$(#div_id)。html()或.append()。

注意:计数之前的空字符串

Note: the empty string before the count number

$ #count')。html((''+ data.rows [0]));

http://jsfiddle.net/S2WMf/8/

这篇关于融合表映射中的标记计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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