0

How can I display a heatmap with the Google Maps API with data from a Fusion Table (Layer)?

With a FusionTablesLayer I can select and display the data (as markers).

layer = new google.maps.FusionTablesLayer({
    query: {
        select: '\'Geocodable address\'',
        where: 'City=\''+city+'\' AND Category = \'companies\'',
        from: 'sdfgfdgfsdfewrrtre34534543egffg'
    },
    heatmap: {
        enabled: true
    },
    templateId: 0,
    styleId: 1
});

However, I can't display the data as heatmap. I tried adding 'maxIntensity' and 'radius' as parameters but this did not work. I get a map like this one in this post.

Now, I'm looking to the HeatmapLayer but don't know how to retrieve the data as with the FusionTablesLayer. Somehow the 'query' parameter does not work in HeatmapLayer.

Therefore my question: How can I display a heatmap with the Google Maps API with data from a Fusion Table?

Community
  • 1
  • 1
Arjen
  • 289
  • 2
  • 4
  • 11
  • 1
    The location-column(`Geocodable address` in the sample-code), did you store there LatLng's or addresses that have been geocoded internally? – Dr.Molle Jul 24 '14 at 10:40
  • I have addresses that have been geocoded internally by Google FushionTables. I can, however, display all the addresses with a marker on the map. But I can't create a heatmaps via the Google Maps API. – Arjen Jul 24 '14 at 14:21

1 Answers1

0

Sorry, there is nothing you can do.

Heatmaps created via a FusionTablesLayer did not have any configurable options.

To be able to use a HeatMapLayer with the data from a FusionTable you must download these data, and the data must include a location(a LatLng, not an address ).

When you didn't store these LatLng's on your own in a column you're not able to get them, the LatLng's created internally via geocoding are not accessible via download.

Dr.Molle
  • 116,463
  • 16
  • 195
  • 201
  • What about using the FusionTablesLayer layer-object? Can the data not be obtained after the query has been executed? Thus in my example: layer.getData() or another way to an array? – Arjen Jul 24 '14 at 15:49
  • No, you can't access these data via download in any way(no matter which API/service) – Dr.Molle Jul 24 '14 at 15:53
  • Strange. Thus there is a heatmap option (enabled: true) but no visible heatmap. – Arjen Jul 24 '14 at 15:55
  • the heatmap is visible: *I get a map like [this one in this post](http://stackoverflow.com/questions/7891974/configuring-heatmap-overlays-using-google-maps-api)* ....there is a heatmap. – Dr.Molle Jul 24 '14 at 15:58
  • Yep, but the one visible in my fusiontable is much better. Any idea how to create a latlng column? If that's the only option... – Arjen Jul 24 '14 at 16:00
  • I know. But how to obtain the LatLng value for each address (automatically)? – Arjen Jul 24 '14 at 16:07
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57934/discussion-between-arjen-and-dr-molle). – Arjen Jul 24 '14 at 16:09
  • you can't obtain these values automatically(and furthermore you're not allowed to store these values when you retrieve them programmatically via google-geocoding). You'll need a 3rd-party-service that returns the LatLng's for these addresses and store them(of course this service should allow the storage) – Dr.Molle Jul 24 '14 at 16:22