Search code examples
infowindowdirectionsgeoxml3

kmz/geoxml3: How to suppress "To Here - From Here" line in infowindows?


Since moving from google.maps.KmlLayer to geoxml3 I now have "To Here" and "From Here" links on a new line at the bottom of each infowindow. How do I get rid of those?

After I posted the original question above, I figured out that this happens with the kmz branch but not the polys branch. I need the kmz branch, to deal with markers with shadows, which are either wider than 32 pixels or off-center.

I could be out of my depth, but looking at the KMZ source it seems that kmz/geoxml3 will always add the Directions line if there's a latlng for that placemark, which is to say for every placemark.

So, unless there's an infoWindowOption or something I'm not seeing, I guess all I can do is hack out the code that loads geDirections, around lines 1206-1215. But is there some way to suppress that line without hacking kmz/geoxml3?

The current map is at http://allbluesdance.com/bluesmapgeoxml3_005.php, and the code (with text styling removed) is:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        html { height: 100% }
        #page-body { height: 100%; margin: 0; padding: 0; }
        #map-canvas { 
            height: 100%;
        }
    </style>
    <script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDDFrP7MSD1ieFEvaF95BRlwHa0S72Fy1s&sensor=FALSE">
    </script>
    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <script src="http://geoxml3.googlecode.com/svn/branches/kmz/geoxml3.js"></script>
    <script src="http://geoxml3.googlecode.com/svn/trunk/ProjectedOverlay.js"></script>
    <script>

        function initialize() {
            var mapOptions = {
                center: new google.maps.LatLng(20,-100),
                zoom: 2,
                preserveViewport: true
            };
            var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);   
            var blues = new geoXML3.parser({map: map, singleInfoWindow: true, zoom: false});
            blues.parse('http://allbluesdance.com/allbluesdance_003.kml');
        }

        google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body id="page-body">
    <div id="map-canvas"/>  
  </body>
</html>

The KML file is:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
    <name>Blues Dance Cities</name>
    <description><![CDATA[]]></description>
    <Style id="style1">
        <IconStyle>
            <Icon>
                <href>http://allbluesdance.com/bluemarkershadow_49x32.png</href>
                <scale>1.0</scale>
            </Icon>
            <hotSpot x="24" y="0" xunits="pixels" yunits="pixels" />
        </IconStyle>
    </Style>

    <Placemark>
        <name>Argentina</name>
        <description>
            <![CDATA[<h6>Blues Playground <a href="http://www.bluesplayground.blogspot.com/" target="_blank">Site</a>, 
            <a href="https://www.facebook.com/groups/225196297497142/" target="_blank">Group</a></h6>
            ]]>
        </description>
        <styleUrl>#style1</styleUrl>
        <Point>
            <coordinates>-58.38159310000003,-34.6037232,0.0</coordinates>
        </Point>
    </Placemark>

    <Placemark>
        <name>Australia &amp; New Zealand</name>
        <description>
            <![CDATA[<h6><a href="https://www.facebook.com/groups/369022273182480/" target="_blank">Blues Dancers ANZ</h6>
            <h6><a href="https://www.facebook.com/groups/1437271016490252/" target="_blank">Blues, Fusion &amp; Alt-Blues Dancing<br>
            &emsp;(Australia &amp; NZ)</h6>
            ]]>
        </description>
        <styleUrl>#style1</styleUrl>
        <Point>
            <coordinates>162.5,-37,0.0</coordinates>
        </Point>
    </Placemark>
.
.
.

Thanks, Drew


Solution

  • Added an option to suppress the directions links in the infowindow in the KMZ branch of geoxml3 (revision 113 of the KMZ branch)

    use it like this:

    var blues = new geoXML3.parser({
                  map: map, 
                  singleInfoWindow: true, 
                  suppressDirections: true,
                  zoom: false
                });
    

    working example