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

We are developing a web GIS using Flexviewer and we want to allow users to upload a shp file and insert it into a ArcSDE geodatabase. I think there are two steps at least.

  1. upload the shp file (zip) to a directory on the server
  2. call some function to load it to the ArcSDE geodatabase

How can I do this using ArcObjects or Geoprocessing service (ArcPy)?

share|improve this question

Your problem seems pretty straightforward. Grab files from ftp or network drive, unzip and import them into your geodatabase. I would likely wrap the steps in a batch file, where I would run the move and unzip through command line and then call the python script to work the GIS magic.

Stack Overflow - Moving file locations through command line

Stack Overflow - Unzipping files through command line

You'll want to use the arcpy.FeatureClassToGeodatabase_conversion method to convert the shapefile (see Feature to Geodatabase - ArcGIS help page):

# Name: FeatureClassToGeodatabase_Example2.py
# Description: Use FeatureClassToGeodatabase to copy feature classes
#  to geodatabase format
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:/data"

# Set local variables
inFeatures = ["climate.shp", "majorrds.shp"]
outLocation = "C:/output/output.gdb"

# Execute TableToGeodatabase
arcpy.FeatureClassToGeodatabase_conversion(inFeatures, outLocation)

In addition, you'll probably want to make sure that you are running some form of scan or virus protection on anything coming from outside sources.

share|improve this answer

Your Answer

 
discard

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.