Martin Larsson
Martin Larsson

Reputation: 720

No info window is showing on Google Fusion map

I have published a Google Fusion table/map.

https://www.google.com/fusiontables/DataSource?docid=1bQud-ZGrJK9yBwfdasIcbU1rwJ5W9ZE53RBAeLk

My problem is that the info window does not apear when looking at the map inside html which has the map embedded. As you can see, the table is totally exposed for all users. Before I noticed this problem I had the table shared as "Everyone with the link" and thought that was the issue but no help in changing it to public.

My html with embedded map:

<html>
<head>
<style type="text/css">
#map_canvas {
    height: 700px;
    width: 380px;
    background: #000000;
    float:left;
 }
</style>

<script type="text/javascript"
    src="http://maps.google.com/maps/api/js?sensor=true">
</script>

<script type="text/javascript">
  var layer;
  var map;
  var html;

  function initialize() {

    var latlng = new google.maps.LatLng(62.835089,17.556641);
    var myOptions = {
      zoom: 5,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    // Add län
    var lanLayer = new google.maps.FusionTablesLayer(667529);
    lanLayer.setMap(map);
  }

  function clearOverlays() {
    if (layer != null) {
        layer.setMap(null);
        layer = null;
    }
  }

  function setMapLayer(fusionTableId) {
    if (layer != null) {
        layer.setMap(null);
        layer = null;
    }

    layer = new google.maps.FusionTablesLayer(fusionTableId);
    layer.setMap(map);
  }

</script>
</head>
<body onload="initialize()" class="map">

  <div id="map_canvas"></div>

  <div class="LayerManager">
    <form>
        <input type="radio" onclick="setMapLayer(3357208)">Antal skuldsatta<br />
        <input type="radio" onclick="clearOverlays()" checked="true" >Bara länsgränser<br />
    </form>
  </div>

</body>
</html>

For the layer that is loaded at init the info window shoes up fine but not the layer that is loaded when radio button is clikced. Why?

Upvotes: 1

Views: 285

Answers (1)

Dr.Molle
Dr.Molle

Reputation: 117334

Use a proper FusionTablesLayerOptions-object as argument for google.maps.FusionTablesLayer

layer = new google.maps.FusionTablesLayer({
      query: {
        select: 'Geocodable address',
        from: fusionTableId
      }
    });

Upvotes: 2

Related Questions