0

I have a simple question (but I'm not a programmer...)

On http://www.strahlen.org/index.htm I manually enter the numbers of rows that contain a certain string in a Google Fusion table. "454" records in this case for the string "11" (Mineral fair) etc, for each number. Now, manually editing the html source is kind of stupid for this every time I edit the FT...

With the query "https://www.google.com/fusiontables/api/query?sql=SELECT COUNT() FROM 3167783 WHERE title='Mineral fair'" , I get the response "count() 454 ". Where the count is the amount of markers for that string on my Google Maps.

Now, and here comes the stupid part: how do I code my html so that the response "454" gets presented/echoed automagically? To make it more clear: I want the number, the count, to show. As a number. The markers are showing on the maps, that's not the problem. It's a html/js question, but I'm not a coder. I need a snippet of code that can do the trick, but I couldn't find it after hours of google-ing.

Thanks for your help in advance...

Cheers, Frank

Frank
  • 81
  • 1
  • 8

2 Answers2

1

I posted an answer to a similar question with sample code at: https://stackoverflow.com/a/9778985/1211981 You need to use the FT JSON API which is "undocumented" but is now officially part of the Trusted Tester's API so I think it's safe to use. Look for the getFTCount() function. It requires jQuery and using a callback so not really simple JS. But I use this approach all the time and the performance is excellent.

Community
  • 1
  • 1
Eric Bridger
  • 3,751
  • 1
  • 19
  • 34
  • Thanks Eric! That's the answer I was looking for, although after reading it once it's way over my head. So, I will read it another ten times and then I will probably understand it :) I hope to find time to work on it the next weeks, between changing my son's diapers and cooking. Cheers, thanks again, Frank – Frank May 24 '12 at 21:29
0

I am assuming in your question, that you want the fusionTablesLayer to render the 454 points that match your select statement, so something like this ought to do the trick:

var map = new google.maps.Map(document.getElementById('map-canvas'), 
{
    zoom: 5,
    mapTypeId: google.maps.MapTypeId.ROADMAP
});

var layer = new google.maps.FusionTablesLayer({
    query: {
        select: "title",
        from: 3167783,
        where: "title ='Mineral fair'"
    },
    map: map
});

More information here: https://developers.google.com/maps/documentation/javascript/layers

javram
  • 2,635
  • 1
  • 13
  • 18