当我添加一条线时,我想用谷歌地图计算距离,但我被困在这里。这是我的 Javascript:
function startLine()
{
select("line_b");
var color = getColor(false);
var line = new GPolyline([], color);
startDrawing(line, "Distance " , function()
{
var cell = this;
var len = line.getLength();
cell.innerHTML = (Math.round(len / 10) / 100).toFixed(2) + " km";
cell.innerHTML = x;
}, color);
startDrawing(line, "Total " , function()
{
var cell = this;
var len = line.getLength();
cell.innerHTML = ((Math.round(len / 10) / 100)*0.25)+x.toFixed(2) + " km";
}, color);
}
有人可以帮忙吗?