다각형을 사용하는 Google지도 기능으로 코딩하고 응용 프로그램을 빌드하고 응용하려고합니다. 이 질문을 몇 번 본 적이 있지만 내 문제를 파악하지 못하는 것 같습니다. 지도가 초기화되고 정의 된 위치에서 다각형이 작성됩니다. "잡히지 않는 참조 오류 : google이 정의되지 않았습니다"라는 이벤트 리스너를 사용할 때 폴리곤이 호버에있을 때 스타일을 변경하려고합니다. 나는이 문제를 해결하려면 어떻게Google지도에서 마우스 오버 폴리곤을 사용할 수 없음 - 잡히지 않는 참조 오류 : Google이 정의되지 않았습니다.
Uncaught Reference Error: google is not defined
: 어떤 이유
var map;
// Map Display options
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 9,
center: {lat: 42.05, lng: -70.25},
mapTypeId: google.maps.MapTypeId.SATELLITE
});
// Define the LatLng coordinates for the polygon.
var cc_peaked_hill = [
{lat: 42.049803, lng: -69.970551},
{lat: 42.048273, lng: -69.978790},
{lat: 42.043684, lng: -70.046082},
{lat: 42.043684, lng: -70.058441},
{lat: 42.056940, lng: -70.085907},
{lat: 42.070194, lng: -70.118179},
{lat: 42.079369, lng: -70.156631},
{lat: 42.049803, lng: -69.970551}
];
// Construct the polygon.
var cc_peaked_hill_billsPollygon = new google.maps.Polygon({
paths: cc_peaked_hill,
strokeColor: '#F7F8FF',
strokeOpacity: 0.8,
strokeWeight: 1,
fillColor: '#4562A8',
fillOpacity: 0.45,
editable: false
});
// Build the Polygons
polygons = cc_peaked_hill_billsPollygon.setMap(map);
//Listen for when the mouse hovers over the polygon.
google.maps.event.addListener(polygons, 'mouseover', function (event) {
// Within the event listener, "this" refers to the polygon which
// received the event.
this.setOptions({
strokeColor: '#00ff00',
fillColor: '#00ff00'
});
});
}
, 나는 다음과 같은 오류는 무엇입니까?
플러그인을 포함하지 않았을 수 있습니다. – brk