Tuesday, June 28, 2016

Interactive KML Placemarks using HTML/JavaScript

Be The First To Comment
My colleague stopped by this morning and asked me to see if there is any way to  implement combo box / drop-down list in KML file for dynamically selecting the Placemarks' information. Few hour of googling come up with a quick and dirty KML (adding custom data) using HTML/JavaScript in <ExtendedData> tag with combo box selection and pasted it here for our future reference. It may helps others as well. If there are any alternatives feel free to chime in.

 <?xml version="1.0" encoding="UTF-8"?>  
 <kml xmlns="http://www.opengis.net/kml/2.2">  
      <Style id="MyBalloonStyle">  
                <text> <![CDATA[  
                <b>Example extended data template</b>  
                <div style="width:350px;" id="tree"></div>  
                <table id="table" border="1" >  
                     <tr><td>Company Name</td></tr>  
                          <select id = "treeListSelection" onchange = 'treeListChanged(value)'>  
                           <option value="tree 1">'Tree 1'</option>  
                           <option value="tree 2">'Tree 2'</option>   
                <script type="text/javascript">   
                 function treeListChanged(value){  
                     document.getElementById('tree').innerHTML = value ;        
           <IconStyle> <color>ffffffff</color> <scale>1</scale>  

© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me