Map Layer From Local Shapefile
In this post, I will demo how to load a local shapefile from your hard drive, and overlay it on an map whose base layer is derived from a remote ArcGIS server. Using the Flash Player 10 FileReference API, this task is fairly easy. However, I did not want the user to be prompted for each imported file as a shapefile is composed of a .shp file holding the geometry and a .dbf file holding the attributes. So, the idea is to zip the shp and dbf and load the zip, and then let the application unzip the content and parse the shp and dbf entries. The application is using the Flex API for AGS and makes use of two wonderful as3 library; the shp library from Edwin van Rijkom, and a zip library from David Chang. In this application, I created a custom geometry to take advantage of the coordinate array format in the shapefile reducing the impedance and taking advantage of the "compression". Well, this not truly compressed - this an array of x,y,x,y,etc... rather than an array of MapPoint instances :-) and since this a custom geometry, well then you need a custom symbol to render that geometry. In this demo, I wanted to load and display the output of a plume model/process, and here is the result:

You can download the zip file from here, and you can see the application in action here. And like usual, the source code is here.
10/10/09 - I've updated the source to be a bit more robust - BTW, this only handles polygon shapes.

You can download the zip file from here, and you can see the application in action here. And like usual, the source code is here.
10/10/09 - I've updated the source to be a bit more robust - BTW, this only handles polygon shapes.
Comments
Vote for this !!
http://bugs.adobe.com/jira/browse/FP-2909
This has tons of value for us!
Thank you for posting the idea, description and source code!
Ole
Error
Description Resource Path Location Type
unable to open '\Users\mraad\ArcGIS\ArcGIS\RIA\FlexAPI\api\dist\agslib-SNAPSHOT.swc' ShpOverlay Unknown Flex Problem
shp:ShpSymbol id="shpSymbol"
i want know how to overlay the shape file and mdb file contains point,line&polygons features.using flash builder flex api did you have any special MXML source code & step by step procedure for this
Please Help me thank you
Hope this helps.
I'm implementing a load shape file as a tool on my flex app, but I'd like to know in which API is possible to take the attributes from *.lyr file. I'm using API 1.3 and know it works fine... just the chiefs asked me about it.
Regards, thanks in advance
I'm implementing a load shape file as a tool on my flex app, but I'd like to know in which API is possible to take the attributes from *.lyr file. I'm using API 1.3 and know it works fine... just the chiefs asked me about it.
Regards, thanks in advance