0

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?

mpsbhat
  • 2,733
  • 12
  • 49
  • 105

1 Answers1

0

Over a year ago, I posted an answer with example code which is the same approach taken in your "first" link. https://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.

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=?';

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

  • The new api returns data.columns and data.rows, not data.table.rows.
  • I guess the new API is returning json integers, not strings and jquery seems to object to passing numbers to $("#div_id").html() or .append().

Note: the empty string before the count number

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

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

Community
  • 1
  • 1
Eric Bridger
  • 3,751
  • 1
  • 19
  • 34