Select to view content in your preferred language

Web-based geoprocessingresults to Excel spreadsheet

2289
3
03-06-2013 05:22 AM
bradeckrose
Deactivated User
I need a strategy to create an and return an Excel spreadsheet as the result of a web-initiated GeoProcessing tool.   It feels like a common problem that has probably been solved already.

Would one process the result on the web-client (javascript) to create rows in a spreadsheet or CSV, or put the result, say a table in an in_memory workspace, then write python to create an Excel file from the geoprocessing result on the server.   If I used the python way, how do I stream it back to the client?  Use native python web-api?

Or would I have the javascript client initiate the GP task, and when notified of completion, send another AJAX request to fetch the Excel result from a web-service, say ASP.Net or Django?

Need some patterns to play with!

Thanks,

Brad
0 Kudos
3 Replies
KevinHibma
Esri Regular Contributor
I can't speak from the JavaScript (other web languages) > Excel point of view (there might be solutions that do this).
I can tell you from a Geoprocessing Service point of view that you can certainly send features/rows to a geoprocessing service and create either a CSV or .XlS file. The GP Service would send that file back to your web application and your user can download that.

You've got a couple questions here. To answer the "getting the file back" - your GP Service (most likely a python script) would create a .XLS file. The tool (gp task) would return a file. In your say, JavaScript based web app, you'd invoke the service and the GP Service would return the file. Check out the clip and ship sample. This demonstrates executing a task that returns a file.

The part of your question I'm unsure of is whats happening on the web client (which sounds like it sends data?) to the GP Service which in turn gets turned into excel? Theres multiple ways to interact with GP via the web in regards to input parameters. I dont want to suggest 1 way as ultimately it depends on how you have data and how the service will accept it. For this part of your task your web development and task (python script) development will have to work together. You'll probably need to build an app that is capable of sending data in an expected way to the gp task. OR you have to build your python script to accept data and possible massage it so you can then convert it.

Hope these ideas move you forward some.
0 Kudos
bradeckrose
Deactivated User
You've got a couple questions here. To answer the "getting the file back" - your GP Service (most likely a python script) would create a .XLS file. The tool (gp task) would return a file. In your say, JavaScript based web app, you'd invoke the service and the GP Service would return the file. Check out the clip and ship sample. This demonstrates executing a task that returns a file.

The part of your question I'm unsure of is whats happening on the web client (which sounds like it sends data?) to the GP Service which in turn gets turned into excel? Theres multiple ways to interact with GP via the web in regards to input parameters. I dont want to suggest 1 way as ultimately it depends on how you have data and how the service will accept it. For this part of your task your web development and task (python script) development will have to work together. You'll probably need to build an app that is capable of sending data in an expected way to the gp task. OR you have to build your python script to accept data and possible massage it so you can then convert it.

Hope these ideas move you forward some.


Thanks for the quick response.   I'm sorry if I was unclear, but I am not sending data to the GP Service, just initiaiting it from a button or some control on the client browser.   Something like "Create Quarter Section Report"

What I want to do is execute a script tool on the server that calls a toolbox tool that does some spatial queries, say by Make Query Layer, or Make Query Table, or ArcSDEExecute and use the results of those tools to format into a report and return the Excel file back to the browser when complete.

Ideally it would be an async initiate/ response, so the GUI isn't blocked and waiting for the GP Service to finish.   And I'd like the Excel creation to all be Python if possible, so I don't have to fake an output stream in .NET by setting mime-types in a response header.

I did not realize you could set an output argument of type file for a ArcGIS Server Published GP Service.  I will look at the example you provided and proceed from there.

Thanks again,

Brad
0 Kudos
KevinHibma
Esri Regular Contributor
Ok cool.
Just to get you started, check out these Python scripts which create excel output:
http://www.arcgis.com/home/item.html?id=f3d91b8f852042e289e09a7ec8342431
You just may need to tweak the inputs or take the tool as-is and combine it with another tool for getting your data into it.
Once you got the tool / service, its just a matter of including it in a webapp and it sounds like you've got a good grasp on that.
0 Kudos