Hi,

The first thing to be sure is that the coordinates you have in your  
XML file can create a polygon, but I suppose you know that already.

First you create an array that will hold all the LatLngs of the polygon.

var coords:Array = new Array();

Normally you would iterate trough all your LatLng in your xml file and  
create LatLng objects that you have to push into the coords array.

The array at the end should hold all the LatLngs object and you have  
to be careful that the last one you add has to be the same one as the  
first. For example:

[[12,4],[13,4][13,5],[12,5],[12,4]]

It is the way to somehow close the polygon.

Then to create a polygon is very simple:

var pol:Polygon = new Polygon(coords);

And to show it in the map you just add it as an overlay.

map.addOverlay(pol);

Hope this helps.


Javier de la Torre
www.vizzuality.com

On Jan 17, 2009, at 10:44 AM, [email protected] wrote:

>
> Hey,
>
> I'm working on an applet in which I receive data from an XML file
> containing LatLng info, and I need to convert that info into a
> polygon. I don't have any information on how many lines the polygon
> has.
> I tried to figure out how to use the fromEncoded method, but failed
> miserably... I also couldn't find any good example of how to use it.
> I'd really appreciate it if someone could either direct me to a good
> example online, or write a short example that clarifies it.
>
> Thanks!
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" 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-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to