Thnks for you reply.
My code is:
I have a kml file(http://165.230.77.82/RIJAN_1/upload/lancashire.kml)
which is located on remote server.
I have to display this file on Google map.The problem with this file
is, it has 4 different Placemark each having diff. polygons.
The code i have written is decoding the xml doc 1st and then I am
trying to read it:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">

<maps:Map xmlns:maps="com.google.maps.*"
  id="map" width="100%" height="100%"
key="ABQIAAAAmhf97bxAvnvAElwf2oBgThTeqI0CJ5Ez1bnkcqDQSoGi9AoZ8RSuzoarjBEkZVxW5z7Dg19H4DUZWA"
  mapevent_mapready="onMapReady(event)" sensor="true"/>

<mx:Script>
<![CDATA[
import com.adobe.xml.syndication.kml.KmlObject;

import com.google.maps.LatLng;
import com.google.maps.LatLngBounds;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapMouseEvent;
import com.google.maps.MapType;
import com.google.maps.controls.MapTypeControl;
import com.google.maps.controls.ZoomControl;
import com.google.maps.overlays.GroundOverlay;
import com.google.maps.overlays.Marker;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.overlays.Polyline;
import com.google.maps.overlays.PolylineOptions;
import com.google.maps.styles.FillStyle;
import com.google.maps.styles.StrokeStyle;

import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.utils.ByteArray;

import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.TextArea;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.xml.SimpleXMLDecoder;
import mx.utils.ObjectUtil;
import mx.utils.XMLUtil;

private var loader:URLLoader;
private var urlRequest:URLRequest;

private function onMapReady(event:Event):void {

map.setCenter(new LatLng(54.17956,-2.66382), 9,
MapType.NORMAL_MAP_TYPE);
map.addControl(new ZoomControl());
map.addControl(new MapTypeControl());
map.enableScrollWheelZoom();

loader = new URLLoader();
urlRequest = new URLRequest();

urlRequest.url = "http://165.230.77.82/RIJAN_1/upload/lancashire.kml";;
loader.load(urlRequest);

var bytes:ByteArray = loader.data as ByteArray;
htp.send();

}

private function myresult(event:ResultEvent):void
{
var retxml:XML = XML(event.result);
var retDoc:XMLDocument = new XMLDocument(retxml);
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
var resultObj:Object = decoder.decodeXML(retDoc);
var resultTag_Polygon:String =
resultObj.kml.Document.Placemark.MultiGeometry.Polygon.outerBoundaryIs.LinearRing.coordinates;
//I am having problem here to read Placemark ass it has multiple
Placemark it is getting confused and not returning the coordinates
}

]]>

</mx:Script>

<mx:HTTPService id = "htp"
resultFormat="e4x"
url="http://165.230.77.82/RIJAN_1/upload/lancashire.kml";
result="myresult(event)" />
Can you help me here?

On Jul 8, 3:21 pm, Bruce Ralston <[email protected]> wrote:
> You might want to use the libkml developed by Pam Fox of Google (and
> others).  It is athttp://code.google.com/p/libkml/.  There is also a link
> to a simple demo at that site.  For a more robust discussion of using this
> with KML files that contain polystyles and other information, you can go 
> tohttp://tnatlas2.geog.utk.edu/tutorhome.  Chapter 5 of that tutorial is about
> using the libkml.
>
> Bruce Ralston
>
>
>
>
>
>
>
>
>
> On Fri, Jul 8, 2011 at 1:40 PM, jijo <[email protected]> wrote:
> > Can someone tell me how to import a multiple polygon KML file into
> > Google Maps using flex code?
> > kml file is located on remote server and has multiple placemarks.
> > var retxml:XML = XML(event.result);
> >                                var retDoc:XMLDocument = new
> > XMLDocument(retxml);
> >                                var decoder:SimpleXMLDecoder = new
> > SimpleXMLDecoder(true);
> >                                var resultObj:Object =
> > decoder.decodeXML(retDoc);
> >                                //var resultTag_Polygon:String =
>
> > resultObj.kml.Document.Placemark.MultiGeometry.Polygon.outerBoundaryIs.Line 
> > arRing.coordinates;
> >                                var resultTag_Polygon:String =
> > resultObj.kml.Document.Placemark.name.description;
> >                                Alert.show("resultTag_Polygon:" +
> > resultTag_Polygon );
> > something like this....but its not working.
>
> > --
> > 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.
>
> --
> Bruce Ralston
> Professor Emeritus
> Department of Geography
> University of Tennessee
> Knoxville, TN 37996-0925
> Phone: 865-974-6043
> FAX: 865-974-6025

-- 
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