-1
나는 방금 json과 google maps api를 시작하여 this video tutorial on youtube을 예제로 사용하고 있습니다. 표시 할 데모지도가 있지만 내게는google map api 두 번 호출하지 않기
이 페이지에 Google Maps API를 여러 번 포함 시켰습니다. 예기치 않은 오류가 발생할 수 있습니다.
원래 코드에는 API 키 호출이 없었지만 API 키를 두 번 호출하면됩니다. API를 두 번 호출하지 않으려면 어떻게해야합니까?
<head>
<script src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script>
// The web service URL from Drive 'Deploy as web app' dialog.
var DATA_SERVICE_URL = "https://script.google.com/macros/s/SPREADSHEET_ID/exec=?jsonp=callback";
var map;
function initialize() {
map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(0, 0),
zoom: 2,
maxZoom: 20,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var scriptElement = document.createElement('script');
scriptElement.src = DATA_SERVICE_URL;
document.getElementsByTagName('head')[0].appendChild(scriptElement);
}
function callback(data) {
for (var i = 0; i < data.length; i++) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(data[i][3], data[i][2]),
map: map
});
}
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=#######&callback=jsonp"></script>
</head>
는 ** 두 번 API를 포함하지 마십시오 할 필요가 없다 ... "**에 필요한 매개 변수를 결합 원래 전화. – geocodezip