Display Multiple Records with KML/KMZ HTML Popups

Idea created by shane.barney on Mar 20, 2012
    New
    Score40
    • ambershows
    • shane.barney
    • basileChandesris
    • 1_abrown31
    For a recent project, we needed to be able to push data out in near-real-time via KMZ network link for use within Google Earth.  The problem was that for each location, we have more than one recorded that we needed to display.  Currently, HTML popups limit you to one record regardless of the number of records associated with the point. 

    I was able to craft together a solution that works (which I'll outline below for those interested).  However, I would like to see built in tools for displaying multiple records per point via HTML popup.  This function needs to work in both ArcGIS Server web applications and when published as KMZ network links.  This function should support common HTML frameworks (ASP.NET, JavaScript, etc.) and include such things as grid controls, sort and filter records, HTML links, and attachments.  In addition, we should be able to leverage ArcGIS server security to control access to the HTML popup content.  It would be nice if this included the ability to create more than one HTML popup per point.  The different HTML popups could then be tied back to ArcGIS server security groups.
      
    Thanks




    --Work Around for displaying Multiple Records within HTML Popups---

    The solution I provide below creates a KMZ network link that when you click the point balloon in Google Earth,  events associated with that site are displayed as a grid.  One advantage of this approach is that you can add additional levels of functionality (sorting, mailto links, images, etc, you are only limited by the version of ASP your server supports) and you can also add some level of security by using lookup user tables and creating different asp pages depending on the user. 

    Of course, the downside is that this is outside of ArcGIS and requires access to an ASP server, and additional levels of support.  In addition if you make changes to one part of the process, you have to go and make changes to all of the other parts manually.  On simply sites this is easy.  However, on more complex sites it becomes an admin nightmare. 


    For this to work, you will need to have a ASP application server setup and access to Database server.   

    First, I created an ASP page that uses a query string to do a one-to-many lookup for each site.  The basic grid asp site looks like this:
         <body>
         <form id="form1" runat="server">
         <asp:GridView runat="server" id="GridView1" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SIRs" ForeColor="#333333" GridLines="None" Font-Size="Small" Width="583px">
          <AlternatingRowStyle BackColor="White" />
          <Columns>
           <asp:BoundField DataField="Number" HeaderText="Number" SortExpression="Number">
            <ItemStyle Wrap="False" />
           </asp:BoundField>
           <asp:BoundField DataField="POC" HeaderText="POC" SortExpression="POC">
            <ItemStyle Wrap="False" />
           </asp:BoundField>
           <asp:BoundField DataField="POCEmail" HeaderText="POC Email" SortExpression="POCEmail" DataFormatString="&lt;a href=mailto:{0}&gt;{0}&lt;/a&gt;" HtmlEncode="False">
           </asp:BoundField>
           <asp:BoundField DataField="Group" HeaderText="Category" SortExpression="Group">
           </asp:BoundField>
           <asp:BoundField DataField="SubGroup" HeaderText="Group" SortExpression="SubGroup">
           </asp:BoundField>
           <asp:BoundField DataField="Types" HeaderText="Type" SortExpression="Types">
           </asp:BoundField>
           <asp:BoundField DataField="DateTimeStamp" HeaderText="Date/Time Stamp" SortExpression="DateTimeStamp">
           </asp:BoundField>
           <asp:BoundField DataField="LocationID" HeaderText="LocationID" SortExpression="LocationID" Visible="False">
           </asp:BoundField>
             <ItemStyle Wrap="False" />
           </asp:BoundField>
          </Columns>
          </asp:GridView>
          <asp:SqlDataSource ID="Event" runat="server" ConnectionString="<%$

         ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [YourTable] WHERE ([LocationID] = @LocationID) ORDER BY [DateTimeStamp] DESC">
           <SelectParameters>
            <asp:QueryStringParameter DefaultValue="1" Name="LocationID" QueryStringField="Event" Type="Int32" />
           </SelectParameters>

          </asp:SqlDataSource>

         </body>
          
    Second, In ArcMap, under the HTML popup tab, I set it to URL.  In prefix I put <iframe src="http://YourServer/Event.aspx?location=.  I select the LocationID as the field and add the “</iframe> as the suffix. Note that you need to include the quote mark at the beginning of close iframe tag.

    Each point has a LocationID with several events associated with each ID.  The url to access the events looks like this: http://YourServer/Event.aspx?location=3

    Finally, publish the ArcMap document to your ArcGIS server and create the KMZ network link.  Because we are using this to view near-real-time data, I set the refresh to once every 60 seconds and after the when camera stops. 

    Of course, the above does require that you setup a table to query on your database.  I use our ArcSDE DB and create a non-GIS view so that I can filter the number of records published to Google Earth.