There are two easy options you can try:
1) Load the Shapefile natively in Flex using vanrijkom classes. Read the geometries and create overlays for the mapping api.
2) Process them in PHP using the ShapeFile.inc.php class developed by Juan Carlos Ulloa, send them, using AMFPHP, as AS3 objects using similar to the mapping API and overlay.
I have tried both ways now. You can check the code of the first try and a demo at:
I am still not sure which way I am gonna take for BiodiversityAtlas as both look fine to me. I probably will use the PHP way as in any case, if the user has to upload the file to the server then I can process i there anyway and I might store them directly on PostGIS even before displaying... so that looks my router.
But in any case is great to see I can go both ways and that both are surprising fast.
If anybody is interested on the PHP example please let me know.
6 comments:
Good work. I like that your solution is very fast.
I used the same shp file library and made my own little polygon only solution a few months ago.
Here's a link:
http://www.dreamingwell.com/articles/archives/2008/06/viewing_shapefi.php
Good to see.
I recently had been playing with encoded polylines in the Google Maps for Flash. It could be interesting to add to this example the processing routine to analyze the polylines of the polygons and create encoded polylines with different resolutions at different zoom levels.
But as I said i ended up processing the shapefiles on the server and sending them to the client using AMF as encoded Polylines... This is I think the fastest i can get.
I'd really appreciate getting the source code of your PHP example if you'd be willing to share.
Hi. I dont have any more the PHP source. But it was very straightforward. I used this library:
http://www.phpclasses.org/browse/package/1741.html
With the library you can read the SHP files in PHP and create data that you can send to Flex to create polygons, points, etc. in Google Maps.
not sure if you still check this or not, but I'm not able to get this to work - using Flash Develop and the latest Flex SDK. I open up the project and get all sorts of errors (Map is undefined...makes no sense since I see the google maps api libs are loaded). I made a new project and just copied the files there...this works (displays map) but won't display any of the shapefiles - always says "Encountered unknown shape type" for each of the 3 provided shapefiles.Any ideas?
thanks a lot .it's helpful for me.
Post a Comment