Hi. Unfortunately I don't have a copy of the non-working script; the problem was seen a couple days ago and the code has progressed since then, and it would take too much time to go back and break it again. :-)
The cause was an extra element being generated from the split command, and I suspect that likely arose from either a terminal space after the final point but before the </coordinates> tag in the KML file generated by Google Earth. Google earth is inconsistent when it generates its <coordinate> tags: when creating a point the tag is on the same line as the point's lat/ lng and there are no spaces between the point data and the tag brackets, but when generating for a polyline then the leading tag is on one line, then the coordinates are on the next line, and there is a space before the closing tag. Therefore, when extracting coordinates data from the XML file, these differences must be accounted for. The problem appeared in Firefox 3 on a Mac and I believe on Safari 3 on a Mac. No other browsers were tested for this, since if it didn't work there there wasn't much point in trying others. Perhaps other browsers' execution of JavaScript would differ, which would make tracking down the problem even harder. In any case, it should be easy to replicate: try creating a new GLatLng point by passing in elements from a JavaScript array where the element itself is of type "undefined," and then pass that point (at the end or within) a series of good ones into new GPolyline. The result should be a lack of error messages in either step, and a non- drawing line at the end. -Ken On Jan 14, 5:35 pm, "warden [Andrew Leach - Maps API Guru]" <[email protected]> wrote: > On Jan 14, 6:35 pm, Ken <[email protected]> wrote: > > > In case it helps anyone, here's a little "gotcha" related to creating > > polylines that may be obvious to others but was not to me. > > What browser did you experience the problem in? Did you work out what > was actually causing the problem? > > I'd guess from your description that IE was objecting to a final comma > in a list of array elements: IE uses that to introduce the next > element, and there wasn't one. Firefox treats the comma as finishing > the element immediately preceding it, so it doesn't care what follows > it. > > I'm surprised that there was no error produced in the API though. Do > you have a demo? > > Andrew --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
