Search code examples
kmlgoogle-earth

How to open a local folder using Google Earth


I have a photo within Google Earth. I would like to be able to click the photo or description to open the folder directory. I believe the href needs to be modified. How can the code be modified to open the local folder?

Screenshot here

<a href="file:///C:/Temp">Click Here to open Folder</a> <img style="max-width:500px;" src="file:///C:/Temp/Photo1.jpg">


Solution

  • You can link to a local folder only if you change two of the default settings. Open Google Earth and select Menu / Tools / Options / General

    • In Display panel, check "Show Web Results in external Browser" option
    • In Placemark Balloons panel, check "Allow Access to local files and personal data" option

    Then create a KML file in a text editor (such as the following) and launch it in Google Earth.

    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2">
      <Placemark>      
        <description><![CDATA[
    
    <a href="file:///C:/Temp">Click Here to open Folder</a>
    <img style="max-width:500px;" src="file:///C:/Temp/Photo1.jpg">
    
          ]]>
        </description>  
        ...
      </Placemark>
    </kml>
    

    For more details on using HTML in KML description balloon, see KML Reference.