Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

i want to import a python(2.7) script to arcmap 10.1 my script has 2 inputs variables one for workspace and another raster dataset and i want o convert input raster as feature class polygon . i want to create a file geodatabase and import in her a export feature class,run this script and finaly show me complete message(not error)... but created the basis is empty,nowhere feature class.my feature class=Catchment and i want to import in gdb(my file geodatabase) but if i run this script show me complete message but the gdb(my file geodatabase) is empty

import arcpy
import sys
import os
from arcpy import env as e
from arcpy.sa import *
arcpy.ImportToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\Arc Hydro Tools.tbx", "archydrotools")
try:
 e.workspace = arcpy.GetParameterAsText(0) # import workspace
 Cat = arcpy.GetParameterAsText(1)         # import raster dataset
 ws = e.workspace
 gdb = "teleia"                            # import name of geodatabase
 # Local variables:
 arcpy.CheckOutExtension("spatial")
 arcpy.env.overwriteOutput = True
 arcpy.CreateFileGDB_management(ws,gdb)
 out = ws + os.sep + gdb + os.sep
 # Process: Catchment Polygon Processing
 arcpy.CatchmentPolyProcessing_archydrotools(Cat, Catchment)
 Catchment =out + "Catchment"
except:
 arcpy.GetMessages()

any idea ?

share|improve this question

closed as unclear what you're asking by PolyGeo, Chad Cooper, Fezter, Jason Scheirer, Simbamangu Mar 27 at 8:14

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
There seems to be a lot of extra code in your script than what you need to accomplish according to the text of your stated aim in your Question. Consequently, I recommend that you try to create a (largely) working snippet of Python code so that what you are asking becomes clearer. To do this I think you should start with a new *.py and just copy into it the parts you need to "create a file geodatabase and import in her a export feature class". Once you get this working then, and only then, would I advise starting to complicate it with additional code. –  PolyGeo Mar 26 at 3:29
    
i edit my question –  user27818 Mar 26 at 9:12
    
try with the ".gdb" extension on you gdb name –  radouxju Mar 26 at 20:21
    
gdb = "teleia" + ".gdb" that is a right ? –  user27818 Mar 26 at 20:22
    
thanx that right –  user27818 Mar 26 at 20:42

1 Answer 1

Still difficult to interpret your question but untested code below may help.

import arcpy
import os
arcpy.CheckOutExtension("spatial") # only required if CatchmentPolyProcessing requires it
arcpy.env.overwriteOutput = True
arcpy.ImportToolbox(r"C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\Arc Hydro Tools.tbx", "archydrotools")

try:
    ws = arcpy.GetParameterAsText(0)      # workspace
    rasCat = arcpy.GetParameterAsText(1)  # raster dataset
    gdb = "teleia"                        # geodatabase name
    catchment = "Catchment"

    arcpy.CreateFileGDB_management(ws,gdb)
    outGDB = os.path.join(ws,gdb)

    # Process: Catchment Polygon Processing
    polyCat = os.path.join(outGDB, catchment)
    arcpy.AddMessage('CatchmentPolyProcessing inputs = \n\t%s\n\t%s' %(rasCat, polyCat))
    arcpy.CatchmentPolyProcessing_archydrotools(rasCat, polyCat)
    arcpy.AddMessage('Complete')
except:
    arcpy.AddMessage(arcpy.GetMessages())
share|improve this answer
    
look cat is a raster dataset and i want to convert to polygon and import that convert in file geodatabase. 1. step create a file geodatabase 2.step convert raster to polygon 3.step import that polygon in to file geodatabase my proplem is can not to import that polygon feature class in file geodatabase,after the run file gedatabase is still empty... and your code has same problem after the run your code file geodatabase is empty –  user27818 Mar 26 at 17:32

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