2014-02-13 2 views
-2

마커와 원이있는 Google지도가 있습니다. 표시가 잘 작동하지만 원이 표시되지 않습니다.Google지도 - 표시되지 않는 서클

나는 코드를 쳐다 보면서 비슷한 물건들을 온라인으로 비교했지만 나에게있어서 내가 잘못 가고있는 곳을 볼 수는 없다.

아무도 도와 줄 수 있습니까?

function initialize() { 
    var userLocation = "London"; 
    var geocoder = new google.maps.Geocoder(); 
    var circle; 
    var styles = [ 
        { 
        stylers: [ 
         { hue: "#00ffe6" }, 
         { saturation: -20 } 
        ] 
        } 
       ]; 
    geocoder.geocode({"address": userLocation}, function(results, status) { 
     if (status == google.maps.GeocoderStatus.OK) { 

      var latLng = results[0].geometry.location; 
      //alert (latLng); 
      var mapOptions = { 
       center: latLng, 
       zoom: 6, 
       styles: styles, 
       mapTypeId: google.maps.MapTypeId.ROADMAP 
      }; 
      map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); 
      var marker = new google.maps.Marker({ 
       map: map, 
       position: results[0].geometry.location, 
       draggable: true 
      }); 
      var circle = new google.maps.Circle({ 
       map: map, 
       radius: 50000, //your radius in meters 
       fillColor: "#000000", 
       center: point 
      }); 
      $("#ListingGeolocation").val(results[0].geometry.location); 
      google.maps.event.addListener(marker, "dragend", function(){ 
       var position = marker.getPosition(); 
       map.setCenter(position); 
       $("#ListingGeolocation").val(position.lat() + " ," + position.lng()); 
      }); 
     } else { 
      alert("Geocode failed. Please edit your address (top of the page) and try again."); 
     } 
    }); 
} 
    google.maps.event.addDomListener(window, "load", initialize); 

편집

난 내 중심으로 위의 코드에서하는 LatLng 변수를 고집했지만, 당신은 위치를 설정 한 것처럼이

var latLng = results[0].geometry.location; 
+2

원의 중심이 점이 아닌 것으로 간주하면 latlng이 맞습니까? – user2930100

+0

내가 제안한 것처럼 latlan으로 바 꾸었습니다. 편집을 참조하십시오. - –

+0

그건 이상한 일입니다. [나에게 잘 맞습니다.] (http://jsfiddle.net/n6p54/1/) – geocodezip

답변

1

그것은 보이지 않는 작동하지 않았다 동그라미를 위해.

아마도 center: pointcenter: new google.maps.LatLng(YOURLAT, YOUR LONG)으로 변경해보십시오.

+0

죄송합니다 - 내 Qu를 편집하겠습니다. –

관련 문제