On Oct 22, 7:02 am, jameslove <[EMAIL PROTECTED]> wrote:

> for (var i=0; i< gdir.getPolyline().getVertexCount(); i++) {
>  var point = gdir.getPolyline().getVertex(i);
> document.getElementById("polyline").value
> +=point.lat().toFixed(6)+","+point.lng().toFixed(6)+"|";
>  }

What makes it slow is the DOM operation in every round of the loop.
Try to increment the

> +=point.lat().toFixed(6)+","+point.lng().toFixed(6)+"|";

to a variable, and after the loop has finished, do the dom operation

document.getElementById("polyline").value = variable.

Internet Explorer is slow doing even string increments. That is why
you can often see that pieces of a string are pushed to an array and
in the end the array is joined. In your case it might be.
In the loop:
ddArray.push(point.lat().toFixed(6)+","+point.lng().toFixed(6));
And after the loop:
document.getElementById("polyline").value = ddArray.join("|");

You can also replace
point.lat().toFixed(6)+","+point.lng().toFixed(6)
by
point.toUrlValue()


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to