First, according to all the red text, here's a link:
http://rhomesonline.com/issues/001/route.html

Like the title says, I've got a driving polyline with 20k vertices
that's throwing an unresponsive script error, naturally because 20k
vertices are too damn many. Why do I have this polyline?

I've got an XML file from which I am reading various driving points,
e.g.

<marker lat="34.420831" lng="-119.69819" location="Santa Barbara, CA" /
>
<marker lat="34.59582" lng="-120.137648" location="Solvang, CA" />

I'm then stringing these lat and lng values into a drivingPoints
variable to make the format of
from: 34.42083, -119.69819 to 34.59582, -120.137648

I basically want to draw the polyline, but remove all the markers.
This part was easy. Then I decided to make the driving polyline a
different color--not the same transparent blue, but a nice solid red.
Combining these two desires led me to putting a GListener on the
"load" function of calculating directions:

var dirs = new GDirections();
dirs.load(drivingPoints, {getPolyline: true});

GEvent.addListener(dirs, "load", function() {
                        var drivingPolyline = dirs.getPolyline();
                        var points = [];

// getVertexCount() is about 20,000 . This loop is to extract the
polyline and
// below, make it a red one. I got this sample from this very group
                        for (var i = 0; i < drivingPolyline.getVertexCount(); 
i++) {
                                points[i] = drivingPolyline.getVertex(i);
                        }

                        var mypoly = new GPolyline(points, "#ff0000", 3, 1);
                        map.addOverlay(mypoly);

                        polylineGroups['planned'].push(mypoly);
});

Of course, removing the loop and adding the polyline directly
eliminates the problem. But, then, how do I make my polyline a
different color?

Thanks--
Garen

--

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