Sorry i got it...there was some syntax problem. Can you please tell me how it will create a kml file,I mean where i can see kml file(HTML?)?
Thanks a lot!!! On Jul 20, 4:53 pm, kanak3 <chaudhari.kanc...@gmail.com> wrote: > Thanks shaun, > Based on ur application i wrote the code: > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > creationComplete="creationCompleteHandler(event)" > xmlns:maps="com.google.maps.*" > viewSourceURL="srcview/index.html"> > > <maps:Map xmlns:maps="com.google.maps.*" > id="map" width="100%" height="100%" > > key="ABQIAAAAmhf97bxAvnvAElwf2oBgThTeqI0CJ5Ez1bnkcqDQSoGi9AoZ8RSuzoarjBEkZV > xW5z7Dg19H4DUZWA" > mapevent_mapready="onMapReady(event)" sensor="true" x="31" > y="20"/ > > > > <mx:Script> > <![CDATA[ > import com.google.maps.LatLng; > import com.google.maps.MapEvent; > import com.google.maps.MapType; > 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.overlays.Polygon; > import com.google.maps.overlays.PolygonOptions; > import com.google.maps.styles.FillStyle; > import com.google.maps.styles.StrokeStyle; > import com.google.maps.controls.ZoomControl; > import com.google.maps.controls.MapTypeControl; > > import mx.events.FlexEvent; > import mx.controls.Alert; > import mx.controls.TextArea; > import mx.rpc.events.*; > > import flash.utils.ByteArray; > import flash.net.URLLoader; > import flash.net.URLRequest; > import flash.display.*; > import flash.display.DisplayObject; > > import org.vanrijkom.shp.ShpHeader; > import org.vanrijkom.shp.ShpPoint; > import org.vanrijkom.shp.ShpObject; > import org.vanrijkom.shp.ShpPolygon; > import org.vanrijkom.shp.ShpPolyline; > import org.vanrijkom.shp.ShpPolygon; > import org.vanrijkom.shp.ShpRecord; > import org.vanrijkom.shp.ShpType; > > private var dataIn:Boolean; > private var mapReady:Boolean; > private var byteArrayResult:ByteArray = new > ByteArray(); > > private function > creationCompleteHandler(event:Event):void > { > var loader:URLLoader = new URLLoader(); > loader.dataFormat = > URLLoaderDataFormat.BINARY; > loader.load(new > URLRequest("http://165.230.77.82/RIJAN_1/upload/ > shapes/test.shp")); > > byteArrayResult = loader.data as ByteArray; > Alert.show("byteArrayResult:" + byteArrayResult); > dataIn = true; > //Alert.show("dataIn:" + dataIn); > parseShapes(); > } > > private function onMapReady(event:MapEvent):void > { > mapReady=true; > //Alert.show("mapReady:" + mapReady); > parseShapes(); > } > > private function parseShapes():void > { > if (!mapReady || !dataIn) > Alert.show("mapReady:" + mapReady); > //Alert.show("dataIn:" + dataIn); > //Alert.show("shpFileHeader:" + mapReady); > return; > > var shpFileHeader:ShpHeader = new > ShpHeader(byteArrayResult); > Alert.show("shpFileHeader:" + shpFileHeader); > var polygonArr:Array = new Array(); > > while(byteArrayResult.position != > byteArrayResult.length) > { > var shpFileRecord:ShpRecord = new > ShpRecord(byteArrayResult); > > if (shpFileRecord.shapeType == > ShpType.SHAPE_POLYGON) > { > > for (var i:Number=0; > i<(shpFileRecord.shape as > ShpPolygon).rings[0].length; i++) > { > var > shpFilePolygon:ShpPolygon = (shpFileRecord.shape as > ShpPolygon); > //Alert.show(":" + > shpFilePolygon.rings[0]); > var > shpFileLatLng:LatLng = new LatLng(shpFilePolygon.rings[0] > [i].y,shpFilePolygon.rings[0][i].x); > > polygonArr.push(shpFileLatLng); > > var > shpPolygon:Polygon = new Polygon(polygonArr, > > new PolygonOptions > > ( > > > {strokeStyle: new StrokeStyle > > > ( > > > {color: 0xFF0000, thickness: 10, alpha: 0.7} > > > ), > > fillStyle: > new FillStyle > > > ( > > > {color: 0xff0000, alpha: 0.7} > > > ) > > } > > )); > > map.addOverlay(shpPolygon); > > } > } > > if (shpFileRecord.shapeType == > ShpType.SHAPE_POINT) > { > var shpFilePoint:ShpPoint = (shpFileRecord.shape > as ShpPoint); > var shpPtsLatLng:LatLng = new > LatLng(shpFilePoint.y, shpFilePoint.x); > > var shpFileMarker:Marker = new > Marker(shpPtsLatLng); > map.addOverlay(shpFileMarker); > } > > /*if (shpFileRecord.shapeType == > ShpType.SHAPE_POLYLINE) > { > > //for (var r:Number=0; r<(shpFileRecord.shape as > ShpPolyline).l > }*/ > } > > } > ]]> > > </mx:Script> > > </mx:Application> > but i am getting a problem here. > I can not see the contents of a shape file.and so i can not parse the > header,recordsand further. > Could you help me? > > On Jul 19, 11:07 pm, Shaun <shaun.hus...@gmail.com> wrote: > > > > > > > > > Also other resources I've used for data so far in exploring this > > are:http://txsdc.utsa.edu/txdata/shapefiles/ > > >http://opendatasearch.org/ > > links tohttp://www.datadotgc.ca/dataset/geogratisnat_populatedplaces_v100 > > > And as an initial reference for what it was you were talking > > about:http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf > > > Anyhow glad to have a bit more info about GIS, fun exploration. I'm done > > for the night, but ping back if you still have issues. > > > Thanks, > > Shaun -- 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 google-maps-api-for-flash@googlegroups.com. To unsubscribe from this group, send email to google-maps-api-for-flash+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-api-for-flash?hl=en.