AddRuleToTopology_management error

5046
6
04-28-2013 11:13 PM
jordixirgo
New Contributor
AddRuleToTopology_management do not recognize a feature class, previously recognized and listed through arcpy.ListFeatureClasses() and checked by arcpy.CheckGeometry_manegement.

It is possible to add a new topology rule manually (arctoolbox > data management tools > topology > Addrule to topology) but not with Arcpy.

>>>>>>>>>>>>>>
arcpy.CreateTopology_management(espaiFGD,"CS_l","#") >> OK


arcpy.AddFeatureClassToTopology_management(espaiFGD+"/CS_l",espaiFGD+"/CS","1","1")  >> OK


fcLlista = arcpy.ListFeatureClasses()

for fc in fcLlista:
    print fc

arcpy.CheckGeometry_management(espaiFGD+"/CS,path+"/CS_CheckGeometry") >> OK

arcpy.AddRuleToTopology_management(Entrada1,"Must Not Overlap (Line)",espaiFGD+"/CS,"#","#","#")  >> Wrong

Error 000840: The value is not a  Feature Layer
Tags (2)
0 Kudos
6 Replies
ThomasTri
New Contributor II

I'm having exactly the same issue. I realize the topic is old, but were you ever able to resolve the issue?

0 Kudos
ShaunWalbridge
Esri Regular Contributor

Hello Thomas, could you try disabling background processing, then run the tool again? Alternatively, I'd try running the tool from an IDE or command line and not the Python window.

Cheers,

Shaun

0 Kudos
ThomasTri
New Contributor II

I was using the PyScripter IDE.

I was able to figure out the issue. In the AddFeatureClassToTopology and AddRuleToTopology geoprocessing tools, the full path to the feature class and topology name must be provided, even though arcpy.env.workspace was set.

TomGeo
by
Occasional Contributor III

Doesn't seem to get old...

I have the same problem, AddRuleToTopology_management is returning with ERROR 999999, even though topology is set with full path, and so is the feature class.

arcpy.env.workspace = gdb
topo_path = os.path.join(gdb, fd, topo)
fc_path = os.path.join(gdb, fd, fc)

arcpy.AddRuleToTopology_management(topo_path, "Must Not Intersect (Line)", fc_path)‍‍‍‍‍

All paths are actually correct and of type String, but I always get 999999 in my face. That's in a stand-alone script I am developing in Eclipse. ArcGIS is in version 10.5

When debuging then I can see the error is raised in line 16214 in the management.py file. Since I went step by step through the process I was able to confirm that all paths went correct through the gp_fixargs() function, and optional argument not given have been also correctly taken of the arguments list.

I assume the process is failing in the subsequent run of gp.AddRuleToTopology_management().

--> AddRuleToTopology

16208   from arcpy.geoprocessing._base import gp, gp_fixargs
16209   from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
16210   try:
16211       retval = convertArcObjectToPythonObject(gp.AddRuleToTopology_management(*gp_fixargs((in_topology, rule_type, in_featureclass, subtype, in_featureclass2, subtype2), True)))
16212       return retval
16213   except Exception, e:
16214       raise e
- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
0 Kudos
MarcHunter1
New Contributor II

Did you find a solution to this issue?  I am encountering the exact same thing.

0 Kudos
Spatial_Fabio
New Contributor III

jordi xirgo‌ you should add features in your topology dataset before add rule on its.

As you done in your first code block:

AddFeatureClassToTopology_management(in_topology, in_featureclass, xy_rank, z_rank)

0 Kudos