1

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)?

1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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