2012-06-28 2 views
0

V3 API에서 Google지도에 제조업체를 추가 할 수없는 이유는 무엇입니까? 이 코드입니다 :왜 V3 API의 Google지도에 제조업체를 추가 할 수 없습니까?

<script type="text/javascript">  
    var map; 
      var myCenter = new google.maps.LatLng(100, 100); 
      function CoordMapType() { 
      } 

      CoordMapType.prototype.tileSize = new google.maps.Size(256, 256); 
      CoordMapType.prototype.maxZoom = 18; 
      CoordMapType.prototype.minZoom = 10; 


      CoordMapType.prototype.getTile = function (coord, zoom, ownerDocument) { 
       var div = ownerDocument.createElement('div'); 
       div.innerHTML = '<img name="" src="mapTiles/' + zoom + '/' + coord.y + '/' + coord.x + '.png"/>'; 
       div.style.width = this.tileSize.width + 'px'; 
       div.style.height = this.tileSize.height + 'px'; 
       div.style.fontSize = '10'; 
       return div; 
      }; 


      CoordMapType.prototype.name = "Tile #s"; 
      CoordMapType.prototype.alt = "Tile Coordinate Map Type"; 

      var coordinateMapType = new CoordMapType(); 

      function initialize() { 
       var mapOptions = { 
        zoom: 10, 
        center: myCenter, 
        mapTypeControl:false 
        mapTypeId: "coordinate" 
       }; 
       map = new google.maps.Map(document.getElementById("map_canvas"), 
       mapOptions); 

       map.mapTypes.set('coordinate', coordinateMapType); 
         var marker = new google.maps.Marker({ position: myCenter, title: "Hello World!" }); 
       marker.setMap(map); 
      } 

    </script> 

내가 표시 할 수 있습니다 내 server.The 맵에서 타일을 사용하지만 마커가지도에 없습니다.

무엇이 문제입니까?

감사합니다.

답변

0

google.maps.LatLng 클래스는 위도 [-90, 90] 및 경도 [-180,180]를 지원하므로 myCenter 객체가 해당 범위 내에 있어야합니다.

var myCenter = new google.maps.LatLng(41.88, -87.62); 
Google지도 API v3의에서

Google Maps API v3 LatLng Class Reference

발췌 : 은 지리적 지점을 나타내는하는 LatLng 객체를 작성합니다. 위도는 [-90, 90] 범위의도 단위로 지정됩니다. 경도는 [-180, 180] 범위의도 단위로 지정됩니다. 이 범위를 벗어나는 값을 사용하려면 noWrap을 true로 설정하십시오. 위도와 경도 순서에 유의하십시오.

관련 문제