[GIS] upload table to ArcGIS Server

arcgis-flex-viewerarcgis-serverarcgis-silverlight-viewerpython

We are building a process which will allow users to submit a table of GPS data to update our central repository for all GPS data. Let's say that the target is simply a SQL data table. At first I thought about trying to accomplish this with an SQL INSERT wrapped in a Python script (exposed a GP tool). However, a colleague suggested that we somehow just get the table to the server and let integration services handle the Insert/append to the SQL table.

My question is then, how to create a simple file retrieval service? I'm comfortable with the Python/GP service aspect of ArcGIS server. Basically it would be just the user submitting a table and placing it in a known location on the server.

EDIT: I should add i'm not looking to upload a file from HTTP location; it must allow access to 'local' files on the user's system.

Best Answer

You're approaching this from the wrong angle. You want the file upload to occur within the API in which your app works. Usually (always?) you have to use a aspx/php/other script to accomplish this.

Flex (say...) will present a dialogue box to the user to select the file, then Flex calls an aspx script to move that file from the users computer onto the server temp folder, then returns that (temp/random) path back to the Flex app - which in turn can call a geoProc, passing it the file.

The geoproc can then parse the NMEA sentences (or whatever data you have, CSV, etc) and [do whatever] to write it into SQL/ESRI FC.

I would start by looking up:

1 Your native API and a sample upload file code snippet (they are rampant) eg http://weblog.cahlan.com/2006/09/uploading-files-with-flex-and-php.html

2 A script (aspx or php) to fetch the file. eg http://www.w3schools.com/php/php_file_upload.asp

*1 actually contains a sample for the entire process, but I threw #2 in there for more context.

3 Then write a geoproc (or php still!!) to write to your SQL. (php if you are not writing into an ESRI GDB - for certain! I think this is required actually... Flex can't talk to SQL, if I'm not mistaken - or I've just never done it...)

I find this chained method to be very easy to follow, debug, and customize (control).

Best of luck!

Apologies: I totally missed the EDIT on the end... If your users are local, I would just get python to parse the file line by line and write to SQL directly. No GP Tool, no AGS required. I am missing something?

Related Question