지오 코딩 된 이벤트를 기반으로 Google 퓨전 테이블을 렌더링하는 포인트를 표시하려고합니다. 이벤트는지도를 중심에두고 마커를 표시하지만 새로운지도 중심과 고정 된 반지름을 기반으로 테이블에서 새로운 선택을하고 싶습니다. 필자의 시도는 공간 쿼리에 변수를 전달하는 것이지만 어디에 넣을 것인지, 아니면 내가 올바르게 호출 할 것인지 확신 할 수 없다.Google Fusion Tables에서 SQL expr의 LatLng 위치 변수 사용
새 쿼리를 실행하기 위해 onClick 이벤트를 사용하는 것이 좋습니다.하지만 동일한 문제입니다. 사전에
감사합니다 ... 라파
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Selected Records from Google Fusion Table based on Geocoded Location</title>
<style>
body { font-family: Arial, sans-serif; }
#map_canvas { height: 600px; width:700px; }
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var layer;
var geocoder;
var map;
var tableid = 411675;
// initialize the map =====================
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(45.526, -122.6684);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
layer = new google.maps.FusionTablesLayer(tableid);
layer.setMap(map);
}
// operates geocoder =====================
function codeAddress() {
var gcAddress = document.getElementById("gcAddress").value;
geocoder.geocode({ 'address': gcAddress}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
layer.setQuery("SELECT Address FROM " + tableid + " WHERE ST_INTERSECTS(Address, CIRCLE(LATLNG(" + position + "), 5000))");
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
</script>
</head>
<body onload="initialize();">
<div>
<input id="gcAddress" type="textbox" value="Hillsboro, OR">
<input type="button" value="Geocode" onclick="codeAddress()">
</div>
<div id="map_canvas"></div>
</body>
하! 아름다운. 그거야. 새 사이트는 나에게 멋진 아이디어를 제공합니다. 엄청 고마워! – geografa