I am working on a Javascript Web Application using the ESRI Javascript API v3.3. My application allows the user to edit and query data and also provides a table for attributes.

I would like the user to be able to export map data to a Shapefile or export the table data to a CSV.

Is this possible with Javascript along? If not, my web application is running on Amazon's Elastic Beanstalk service with PHP. I've never written anything in PHP, but can this be done with PHP? How would I go about doing this in PHP?

1 Answer 1


1) If you want to create a shapefile for download, you should be able to publish an async geoprocess that will return a link to the location of the generated shapefile on your ArcGIS Server. You call this service from the javascript API using esri.tasks.Geoprocessor. Take a look at the clip-and-ship example. It uses a file gdb, but you should be able to change it to a shapefile if you need.

javascript side:

server side: http://resources.arcgis.com/en/help/main/10.1/index.html#/Clip_and_ship/01540000035r000000/

2) In javascript, I've successfully used the jquery based DataTables library to create a very functional data grid http://www.datatables.net/. DataTables has a plugin called TableTools that can save table data as a CSV file among other things -- it includes a tiny flash plugin for the local file saving. It has worked well for me. You could potentially put json geometry into a column. See this post for a sample Spatial query in ArcGIS Javascript Api 3.1

3) I'm sure you could do it with php accessing a shapefile library, write it out, zip it up and send back a link, but I don't have a recipe for you.

  • Thanks for your response. We aren't actually using ArcGIS server for our app. Instead, we are using ArcGIS Online to host the feature services. Do you know if AGOL allows geoprocessing like in the Clip and Ship example you provided?
    – Brian
    Mar 15, 2013 at 22:07
  • I am using a dojo dgrid for my table. Do you think it is possible to mix and match the dgrid table with the TableTools?
    – Brian
    Mar 15, 2013 at 22:07
  • No, unfortunately it does not resources.arcgis.com/en/help/main/10.1/index.html#/…
    – awesomo
    Mar 15, 2013 at 22:09
  • Yes, you should be able to mix and match. Of course, there is the slight issue that it makes the initial download a touch larger, but it's not that big a deal.
    – awesomo
    Mar 15, 2013 at 22:11
  • 1
    The link to the JavaScript example is currently dead -- do you know a different link?
    – Erica
    Dec 9, 2015 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.