Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle map with two Fusion Table layers does not display second layer
    primarykey
    data
    text
    <p>I have a map that is displaying two fusion table layers. I have styled them both using the <code>styleId</code> attribute to take the styles defined in the Fusion Table UI instead of using the <code>styles</code> attribute when creating the layer in Google maps. From the <a href="https://developers.google.com/maps/documentation/javascript/layers#fusion_table_styles" rel="nofollow">maps docs</a>, it mentions that you can have up to 5 fusion table layers, with one of them being styled. </p> <blockquote> <p>Styles can only be applied to a single Fusion Tables layer per map. You may apply up to five styles to that layer.</p> </blockquote> <p>What I'm not 100% clear on is if this applies to inline styles only, e.g.:</p> <pre class="lang-js prettyprint-override"><code>layer1 = new google.maps.FusionTablesLayer({ query: { from: table1Id }, styles: [ {markerOptions: {iconName: 'red_blank'}, where: 'age &gt; 50'}, {markerOptions: {iconName: 'grn_blank'}, where: 'age &lt;= 50'} ] }); layer2 = new google.maps.FusionTablesLayer({ query: { from: table2Id }, styles: [ // This won't work because you can only style one table inline {markerOptions: {iconName: 'red_blank'}, where: 'age &gt; 50'}, {markerOptions: {iconName: 'grn_blank'}, where: 'age &lt;= 50'} ] }); </code></pre> <p>or if it also applies to styles defined in the fusion table UI:</p> <pre class="lang-js prettyprint-override"><code>layer1 = new google.maps.FusionTablesLayer({ query: { from: table1Id }, options: { styleId: 2, // Obtained from the fusion table UI templateId: 1 // Obtained from the fusion table UI } }) layer2 = new google.maps.FusionTablesLayer({ query: { from: table2Id }, options: { styleId: 2, // Obtained from the fusion table UI templateId: 1 // Obtained from the fusion table UI } }) </code></pre> <p>From my reading of the docs, it would seem that it's only the first type that is not allowed on multiple layers.</p> <p>The <code>styleId</code> way of styling a table is actually not mentioned in the Google Maps docs, but this is the way the embed code generated in Fusion Tables when you "Publish" a map looks like, and it actually works for individual layers.</p> <p>If I enable both layers (<code>layer1.setMap(map)</code>), only one of the layers gets displayed. If I disable a layer, the other one appears correctly.</p> <p>Any help will be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload