Google Fusion Table Mapping Help! - Custom Info Window using Closure Templates

472 Views Asked by At

First, some background:

I'm working with mapping from Google Fusion Tables and I'm trying to customize the info window using Dynamic Templating, which uses Closure Templates. I'm editing the window from the Configure Map area of my Fusion Table. I'm new to coding and I studied the HOWTO regarding Dynamic Templating here: Tip: Use dynamic templating

The problems:

However when I try to use an example from the HOWTO and adapt it to my own data I am having issues with some data not displaying despite using the correct column name, and I have no idea how to skip blank cells being displayed.

My Objective:

I'm mapping hospitals and nursing homes in the US. My fusion table has some columns that have data which is specific to a hospital and some which is specific to a nursing home in other columns. I just want my info window to display the appropriate data per facility type, which is one of my columns btw.

My Questions:

Am I right to use Closure Templates to customize the data shown in my info windows?

If so, can I specify which columns' data displays in the info window depending upon the facility type?

Hopefully, I've been clear enough for someone to understand what I'm doing/seeing here.

1

There are 1 best solutions below

2
On

The dynamic templates are the correct choice.

Sample(modify the column-names and facility-types depending on the values used in your table):

{template .contents}
<div>
  {if $data.value['facility type'] == 'hospital'}
   {$data.value['name of desired column']}
  {/if}
  {if $data.value['facility type'] == 'nursery home'}
    {$data.value['name of another desired column']}
  {/if}
</div>
{/template}

so the basic syntax is:

  {if $data.value['name of column which should match the condition'] == 'specific value'}
    {$data.value['name of column whose value should be printed']}
  {/if}