2013-04-02 90 views
0

我有一個問題,當我想在我的地圖上畫一個圓,但我不明白爲什麼。請做一些人可以告訴我我的問題,由我是新的使用這個平臺,我的英語不太好,所以這是我的代碼。無法在Google地圖中繪製圓圈?

<!DOCTYPE html> 
<html> 
<head> 
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 
<style type="text/css"> 
    html { height: 100% } 
    body { height: 100%; margin: 0px; padding: 0px } 
    #map_canvas { height: 100% } 
</style> 
<script type="text/javascript" 
src="http://maps.google.com/maps/api/js?sensor=false"> 
</script> 


</script> 
<script type= "text/javascript"> 

    var map; 
    var latlng = new google.maps.LatLng(30.397, -100.644); 
    var marker = new google.maps.Circle({ 
     strokeColor: #200444, 
     strokeOpacity: 0.8, 
     strokeWeight: 2, 
     fillColor: #2E6444, 
     fillOpacity: 0.5, 
     map: map, 
     center: latlng, 
     radius:20 
    }); 
    function initialize() 
    {   
     var myOptions = {  
     zoom: 3,  
     center: latlng,  
     mapTypeId: google.maps.MapTypeId.ROADMAP  
     }  
     map = new google.maps.Map(document.getElementById("map_canvas"),myOptions); 

    marker.setMap(map); 
    } 


</script> 
</head> 
    <body onload="initialize()"> 
     <div id="map_canvas" style="width:500px; height:460px;"></div> 
</body> 

回答

1
  1. 則strokeColor和填充顏色必須是字符串:

    strokeColor: "#200444", 
    fillColor: "#2E6444", 
    
  2. 您圓的半徑僅20米,你,如果你想看到它需要一點點接近放大:

    zoom: 15,  
    

working example