Hi All,
There are several threads and/or examples dealing with xml-based
points, but I want to create polygons. I'm trying to develop a site
that accesses a database for the coordinates to generate a polygon in
a google map. I've tried to use the GDownloadUrl function to get the
xml from a database with no luck. I've developed this as a spry data
set because I have some experience working with that, and I'd also
like to be able to use other elements of the data set for the rest of
the page. The base map works without a problem, and I'm able to use
the spry data in the page, so I know that the xml is being created
successfully. The problem is I can't get the code below to do
anything. Is there something obviously wrong here? Or, is this even
possible? Any help or tips are greatly appreciated.
var dsPoly = new Spry.Data.XMLDataSet("datasets_xml_dev.asp", "root/
row");
if (dsPoly.getDataWasLoaded()){
var xmlrow = dsPoly.getData();
for (var i = 0; i < xmlrow.length; i++) {
var ullat = parseFloat(xmlrow["ul_lat"]);
var ullon = parseFloat(xmlrow["ul_long"]);
var lrlat = parseFloat(xmlrow["lr_lat"]);
var lrlon = parseFloat(xmlrow["lr_long"]);
var polygon = new GPolygon([
new GLatLng(ullat, ullon),
new GLatLng(ullat, lrlon),
new GLatLng(lrlat, lrlon),
new GLatLng(lrlat, ullon),
new GLatLng(ullat, ullon)
], "#f33f00", 5, 1, "#ff0000", 0.2);
map.addOverlay(polygon);
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---