Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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:

2) In javascript, I've successfully used the jquery based DataTables library to create a very functional data grid 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.

share|improve this answer
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 '13 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 '13 at 22:07
No, unfortunately it does not… – awesomo Mar 15 '13 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 '13 at 22:11
The link to the JavaScript example is currently dead -- do you know a different link? – Erica Dec 9 '15 at 19:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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