2012-06-08 1 views
0

Google 퓨전 테이블의 데이터로 계층화 된 Google지도가 포함 된 웹 응용 프로그램을 작성하고 있습니다. 퓨전 테이블에서 마커에 대한 정보 창을 정의했으며 모두 예상대로 렌더링되지만 한 가지 문제가 있습니다. 정보창에 정의 된 링크에 웹 응용 프로그램의 세션 변수를 전달해야하지만이 방법은 찾을 수 없습니다. 내가 좋아하는 것 변수를 FusionTableLayer의 정보 창에 전달하십시오.

var myOptions = { 
    zoom: 10, 
    mapTypeId: google.maps.MapTypeId.ROADMAP, 
    center: new google.maps.LatLng(40.4230,-98.7372) 
} 
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 

// Weather 

weatherLayer = new google.maps.weather.WeatherLayer({ 
    temperatureUnits: google.maps.weather.TemperatureUnit.FAHRENHEIT 
}); 
weatherLayer.setMap(map); 

//Hobby Stores 

var storeLayer = new google.maps.FusionTablesLayer({ 
    query: { select: "col2", from: "3991553" }, 
    map: map, 
    supressInfoWindows: true 
}); 

//Club Sites 

var siteLayer = new google.maps.FusionTablesLayer({ 
    query: { select: "col13", from: "3855088" }, 
    styles: [{ markerOptions: { iconName: "airports" }}], 
    map: map, 
    supressInfoWindows: true 
}); 

가에 포함 할 값을 전달 google.maps.FusionTableLayer에 대한 호출에서 매개 변수의 몇 가지 유형을 통과 할 수 있도록 : 다음 나는 현재지도를 렌더링하는 데 사용하고있는 자바 스크립트입니다 정보창을 열지 만이를 수행 할 방법을 찾을 수 없습니다.

실제 페이지를 보려면 www.dualrates.com을 방문하십시오. 우편 번호를 입력하고 공항 마커 중 하나를 선택하여 정보 창을 봅니다. 비행장을 보려면지도를 확대해야 할 수도 있습니다.

+0

을 당신은 supressInfoWindows있다 : 당신이 작성하고 정보창이 아닌 퓨전 테이블을 채우는 의미있는 사실을. 페이지에 세션 변수가 있으면 창을 만들거나 열 때 추가 할 수 있어야합니다. –

답변

1

이 예는 정보창의 콘텐츠를 사용자 정의하는 방법을 보여줍니다

https://developers.google.com/fusiontables/docs/samples/change_infowindow_content

당신은 당신의 특정 테이블의 정보를 포함하고 세션 변수를 추가하기 위해 다음과 같은 기능을 업데이트 할 것입니다. 당신이 PHP를 사용하는 가정하면,이 같은 것을 볼 수 있습니다

google.maps.event.addListener(layer, 'click', function(e) { 

    // Change the content of the InfoWindow 
    e.infoWindowHtml = e.row['Store Name'].value + "<br>"; 

    // If the delivery == yes, add content to the window 
    if (e.row['delivery'].value == 'yes') { 
    e.infoWindowHtml += "Delivers!"; 
    } 

    e.infoWindowHtml += "<?php echo $_SESSION['yourvariable']; ?>"; 
});