Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Problem using .sde featureclass in the GetCount tool

$
0
0
My app needs to test the user-selected feature class for a selected set before it continues. The only method I have found in the forum to accomplish this is to use the GetCount function on the map layer and on the source feature class and compare them. So far, so good, this works fine on shapefiles. But I need for it to work on .sde feature classes, too. The documentation and posts in the forum suggest using the arcpy.mapping.layer.DataSource function to get the connection to the .sde feature class. This is not working for me. Any help?

This is the path which is returned by the DataSource function:
>>> lyr = arcpy.mapping.Layer(r"New Group Layer\Property Line")
>>> str = lyr.dataSource
>>> print str
C:\Documents and Settings\acsmith\Application Data\ESRI\ArcCatalog\gisviewer@sde.pepopcogis2.sde\SDE.SDE.cadastre_real_estate\SDE.SDE.parcel_area
(gisviewer is the connection name, pepopcogis2 is the server, SDE.SDE.cadastre_real_estate is the dataset, and SDE.SDE.parcel_area is the feature class)

This is the error which is returned by the failed GetCount function:
>>> count1 = arcpy.GetCount_management(arcpy.mapping.Layer(r"New Group Layer\Property Line").dataSource)
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\management.py", line 13637, in GetCount raise e ExecuteError: ERROR 000732: Input Rows: Dataset C:\Documents and Settings\acsmith\Application Data\ESRI\ArcCatalog\gisviewer@sde.pepopcogis2.sde\SDE.SDE.cadastre_real_estate\SDE.SDE.parcel_area does not exist or is not supported

Viewing all articles
Browse latest Browse all 2485

Trending Articles