2012-11-01 3 views

답변

1
var klms = [{"url":"http:\/\/example.com\/points_in_a_kml_file.kml"}]; 

if(klms){ 
    $.each(klms, function(i, klms){ 
     $('#map').gmap3({ 
      action: 'addKmlLayer', 
      url: klms.url, 
      options:{ 
       suppressInfoWindows: true, 
       preserveViewport: false 
      } 
     }) 
    }) 
} 

"points_in_a_kml_file.kml"

<?xml version="1.0" encoding="UTF-8"?> 
<Document> 
<Style id="style0"> 
    <IconStyle scale="0.181818"> 
     <Icon> 
      <href>http://example.com/pin.png</href> 
     </Icon> 
    </IconStyle> 
</Style> 
<Folder> 
    <name>pulau_weh_point</name> 
    <Placemark> 
     <name>Mama's</name> 
     <description><![CDATA[Point's description]]></description> 
     <Point> 
      <coordinates>95.255227,5.875082,0.000000</coordinates> 
     </Point> 
     <styleUrl>#style0</styleUrl> 
    </Placemark> 
</Folder> 
</Document> 
1

KmlLayer에서 마커에 액세스 할 수 없습니다 (Google 서버에서지도 타일로 렌더링 됨). FusionTableLayer (KML을 FusionTable에 가져온 다음 해당 FusionTable로 수정하여 마커를 필터링 할 수 있음) 또는 geoxml3 또는 geoxml-v3과 같은 타사 KML 파서 (기본 Google지도 v3 객체를 사용하여 KML 렌더링)를 사용할 수 있습니다. 그들 중 어떤 것이 gmap3과 함께 작동하는지 확실하지 않습니다.

관련 문제