[Google Maps API v2] Re: only showing first polygon from xml
> here's the map:http://www.xelawho.com/map/zones2.htm
Your XML reading code defines a function createPolygon() multiple
times in a loop.
It doesn't do much, and will only ever return a null value.
Polygons are created at this line
var poly = new GPolygon(pts,colour,[category],name);
but the parameters are incorrect for a GPolygon
http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GPolygon
only the first two have any meaningful value - the points array and
the colour string. An array is no good for the strokeweight and a
string is no good for opacity.
The useless function is called at this line
createPolygon (pts,colour,category,name);
but nothing is done with the null result, so it doesn't matter much.
The loop stepping through the XML 'zones' array is controlled by a
variable 'i'
The inner loop stepping through each zones 'points' array is
controlled by the same variable 'i'
After the first set of points is read, 'i' has been messed up.
The outer loop exits after the first run through.
Maybe change the inner one to 'j' to prevent the clash.
This is not a maps issue, its basic javascript about nesting loops.
--
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 google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home