kmz / geoxml3:如何在infowindows中压制“To Here- From Here”这一行?

时间:2014-08-07 21:43:41

标签: infowindow directions geoxml3

从google.maps.KmlLayer迁移到geoxml3后,我现在在每个infowindow底部的新行上都有“To Here”和“From Here”链接。我如何摆脱那些?

在我发布上面的原始问题之后,我发现这发生在kmz分支但不是聚合分支。我需要kmz分支来处理带有阴影的标记,阴影要么宽于32像素,要么偏离中心。

我可能超出了我的深度,但是看KMZ source似乎kmz / geoxml3将总是添加方向线,如果有一个该地标的latlng,也就是说每个地标。

所以,除非有一个我没有看到的infoWindowOption或者其他东西,我想我能做的就是在1206-1215行附近破解加载geDirections的代码。但有没有办法在没有攻击kmz / geoxml3的情况下压制该行?

当前地图位于http://allbluesdance.com/bluesmapgeoxml3_005.php,代码(删除了文字样式)为:

<!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>

KML文件是:

<?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>
.
.
.

谢谢, 德鲁

1 个答案:

答案 0 :(得分:2)

Added an option to suppress the directions links in the infowindow in the KMZ branch of geoxml3(KMZ分会第113号修订版)

像这样使用它:

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

working example