-1
Google 퓨전 테이블에서 데이터를 가져 오는 Google지도 API를 호출하여 검색 창 기능을 포함하려고합니다. 검색 창은지도에서 마커 이름을 검색해야합니다. 그러나 상자 안에 아무 문자 나 입력하면 검색이 실패합니다. 이유가 확실하지 않습니다.Google지도 API/자바 스크립트/검색 창 기능
<!DOCTYPE html>
<html>
<head>
<meta name="viewport"></meta>
<title>Merge of Vino_Brew_BBQ and Markers - Google Fusion Tables</title>
<style type="text/css">
html, body, #googft-mapCanvas {
height: 300px;
margin: 0;
padding: 0;
width: 500px;
}
</style>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAI_3RMI43f45RgHC9MLdZbePINAqH_ZM0"></script>
<script type="text/javascript">
var map;
var VinoBrewBBQLayer;
var VinoBrewBBQTable = '15qpgfFdsMTpuwQ_gR2-LgBSlN6Z7EPhCegikJ0xy';
var VinoBrewBBQColumn = 'Geometry';
function initialize() {
google.maps.visualRefresh = true;
var isMobile = (navigator.userAgent.toLowerCase().indexOf('android') > -1) ||
(navigator.userAgent.match(/(iPod|iPhone|iPad|BlackBerry|Windows Phone|iemobile)/));
if (isMobile) {
var viewport = document.querySelector("meta[name=viewport]");
viewport.setAttribute('content', 'initial-scale=1.0, user-scalable=no');
}
var mapDiv = document.getElementById('googft-mapCanvas');
mapDiv.style.width = isMobile ? '100%' : '500px';
mapDiv.style.height = isMobile ? '100%' : '300px';
map = new google.maps.Map(mapDiv, {
center: new google.maps.LatLng(31.340072697821267, -98.913833984375),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('googft-legend-open'));
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('googft-legend'));
VinoBrewBBQLayer = new google.maps.FusionTablesLayer({
map: map,
heatmap: { enabled: false },
query: {
select: VinoBrewBBQColumn,
from: VinoBrewBBQTable,
where: ""
},
options: {
styleId: 2,
templateId: 2
}
});
if (isMobile) {
var legend = document.getElementById('googft-legend');
var legendOpenButton = document.getElementById('googft-legend-open');
var legendCloseButton = document.getElementById('googft-legend-close');
legend.style.display = 'none';
legendOpenButton.style.display = 'block';
legendCloseButton.style.display = 'block';
legendOpenButton.onclick = function() {
legend.style.display = 'block';
legendOpenButton.style.display = 'none';
}
legendCloseButton.onclick = function() {
legend.style.display = 'none';
legendOpenButton.style.display = 'block';
}
}
}
function SearchLayer(VinoBrewBBQLayer, VinoBrewBBQTable, map){
var store = document.getElementById('StoreTextInput').value;
var search = "NAME CONTAINS IGNORING CASE '" + store + "'";
if(!VinoBrewBBQLayer.getMap()){
VinoBrewBBQLayer.setMap(map);
alert (search);
}
VinoBrewBBQLayer.setOptions({
query: {
select: VinoBrewBBQColumn,
from: VinoBrewBBQTable,
where: search
},
options: {
styleId: 3,
templateId: 3
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
검색
"검색 실패"란 무엇을 의미합니까? 코드를 실행할 때 실패하지는 않지만 작동하지만 모든 마커가 빨간색으로 변합니다. – geocodezip