예 : here을 설정했습니다.
Ajax 요청 아래와 같이 나는 좌표
$.getJSON("getjson.php?address="+address,
function(data){
lat=data.results[0].geometry.location.lat;
lng=data.results[0].geometry.location.lng;
point= new google.maps.LatLng(lat,lng);
map.setCenter(point);
zoom = 14;
marker = createMarker(point,"<h3>Marker"+(markersArray.length+1)+" "+point+"</h3>",zoom);
});
를 얻기 위해 사용자와 구글 API V3를 사용하여 마커를 작성하여 입력 한 주소의 좌표를 수신하기 위해 구글 지오 코딩 API를 사용하고 PHP 코드는 마커
를 만들기 좌표
<?php
$address = $_GET['address'];
$address=str_replace(" ","+",$address);
if ($address) {
$json = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address='.$address.
'&sensor=true');
echo $json;
}
?>
를 반환
function createMarker(latlng, html,zoom) { var contentString = html; var marker = new google.maps.Marker({ position: latlng, map: map, zIndex: Math.round(latlng.lat()*-100000)<<5 }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(contentString); infowindow.open(map,marker); }); marker.MyZoom = zoom; return marker; }