我想使用Google Maps API和jQuery在地圖上繪製多個圈子。 只要帶有drawMapCircle()的行被註釋掉(標記位置正確),以下代碼就可以工作。在Google地圖中繪製多個圈子
我的代碼有什麼問題?
$.getJSON(
"ajax/show.php",
function(data)
{
$.each(data.points, function(i, point)
{
map.addOverlay(new GMarker(new GLatLng(point.lat, point.lng)));
drawMapCircle(point.lat, point.lng, 0.01, '#0066ff', 2, 0.8, '#0cf', 0.1);
});
}
);
function drawMapCircle(lat, lng, radius, strokeColor, strokeWidth, strokeOpacity, fillColor, fillOpacity)
{
var d2r = Math.PI/180;
var r2d = 180/Math.PI;
var Clat = radius * 0.014483; // statute miles into degrees latitude conversion
var Clng = Clat/Math.cos(lat * d2r);
var Cpoints = [];
for (var i = 0; i < 33; i++)
{
var theta = Math.PI * (i/16);
Cy = lat + (Clat * Math.sin(theta));
Cx = lng + (Clng * Math.cos(theta));
var P = new GLatLng(Cy, Cx);
Cpoints.push(P);
}
var polygon = new GPolygon(Cpoints, strokeColor, strokeWidth, strokeOpacity, fillColor, fillOpacity);
map.addOverlay(polygon);
}
的Javascript引發以下錯誤:
Error: a is undefined
Source: http://maps.gstatic.com/intl/de_ALL/mapfiles/208a/maps2.api/main.js
Line: 317
function Nh(){x(pd).sV();eval(arguments[1])}
它會拋出任何javascript錯誤? (用螢火蟲檢查) – 2010-04-17 09:41:27