Wait nevermind, I got that issue with the "alert" working now. It shows 12 lines as it should though now no polyline wishes to plot. I'll look into this now...
On Oct 20, 12:06 pm, Derek23 <[email protected]> wrote: > Okay you have a very good point, it makes sense now. > > So I modified my xml file slightly to this type of format: > <datapoints> > <line width="5"> > <point latPoly=" " longPoly=" " /> > <point latPoly=" " longPoly=" " /> > . > </line> > <line width="5"> > <point latPoly=" " longPoly=" " /> > <point latPoly=" " longPoly=" " /> > . > . > </line> > <line width="5"> > <point latPoly=" " longPoly=" " /> > <point latPoly=" " longPoly=" " /> > . > . > </line> > </datapoints> > > So now it "should" be able to recognise the multiple lines and not > overwrite the previous "lines" like the previous function this. I've > also updated that > processPolyLines(colour) function to this (removing the unwanted > loops): > > function processPolyLines(colour) { > alert("The value of the argument colour is " + colour); // > This works perfecty > var xmlDoc = GXml.parse(request.responseText); > alert("Status is " + request.status); > > var lines = xmlDoc.documentElement.getElementsByTagName("line"); > alert("The length of lines is " + lines.length); // > This returns a "lines" value of zero, when it should return 12. > for > ( var a = 0; a < lines.length; a++) { > var width = > parseFloat(lines[a].getAttribute("width")); > var points = > lines[a].getElementsByTagName("point"); > var pts = []; > for (var i = 0; i < points.length; i++) { > alert(points.length); > pts[i] = new > GLatLng(parseFloat(points[i] .getAttribute("latPoly")), > parseFloat(points[i] .getAttribute("longPoly"))); > } > p[a] = new GPolyline(pts,colour,width) > map.addOverlay(p[a]); > > } > > However that "alert statement" which I put up: > alert("The length of lines is " + lines.length); > > It returns that the length of "lines" is 0 when it should be 12. > Actually even when I comment out the entire "for loop" I am still > getting the same issue. Am I missing something here? > > Thanks Rossko for all your help and everyone else as well who gave > sound advice. -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" 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.
