AnsweredAssumed Answered

Specify geometry type using python...?

Question asked by ahmednasserhassan on Dec 7, 2016
Latest reply on Dec 9, 2016 by LukeW
  1. OK, here is the story :
    I am working with ORACLE enterprise 12c DB 
    created big number of  feature classes from oracle with SDO geometry type.

  2. what i want :
     I want to register every feature class so ESRI can identify the geometry type using python.
    but the problem is to specify the geometry type before registering. 

    P.s: I can do that using arc catalog  right click on every feature class.Manage.Register with the DB.then a popup will appear and I have to enter the geometry type from a drop down list , but this will take forever!.

  3. what i have done
    I wrote this python code i need to add on it the part to specify the geometry but i don't know the function or the way to that.
    in line 11 is the path to the sde connection to the oracle DB.
    in line 12  is the path for a file containing the names for all my feature classes.

     

    # -*- coding: cp1252 -*-

    import sys
    import traceback
    import subprocess
    import arcpy


    try:
        arcpy.env.workspace = r"C:\xxESRI\Desktop10.4\ArcCatalog\12C_oracle.sde"
        txtPath = r"C:\Users\FCList.txt"
        txt = open(txtPath, "r")
        for line in txt.readlines():
            fcName = line.split(":")[0]
            print (fcName)
            arcpy.RegisterWithGeodatabase_management(fcName)
            print ("{0} ist registriert".format(fcName))
        txt.close()


    except:
        try:
            txt.close()
        except:
            pass
        tb = sys.exc_info()[2]
        tbinfo = traceback.format_tb(tb)[0]
        pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n    " + \
                str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"
        print(pymsg)
        msgs = "Arcpy ERRORS:\n" + arcpy.GetMessages(2) + "\n"
        print(msgs)

     

Outcomes