Select to view content in your preferred language

Check Topology Presence with Python -?

1801
2
03-01-2011 01:16 AM
by Anonymous User
Not applicable
Original User: htouyeras

Hi Python users,

I would like to use Python with ArcGIS 9.3.1 to check if a dataset contains topology.
Several posts relate to interacting with the topology, but I did not find anything on finding the topology to start with.
Would anyone know how to go about this?

Many thanks!

Helene.
0 Kudos
2 Replies
BradPosthumus
Frequent Contributor
You can use gp.ListDatasets to find the topology in a feature dataset.
import arcgisscripting
gp = arcgisscripting.create(9.3)
gp.workspace = "<full path to your feature dataset>" # e.g. C:/workspace/geodatabase.gdb/featureDataset
blnTopologyFound = False
for objDataset in gp.ListDatasets():
    if gp.Describe(objDataset).DataType == "Topology":
        blnTopologyFound = True
        break
if blnTopologyFound:
    print "Topology exists and is called " + str(objDataset)
else:
    print "No topology found"

0 Kudos
by Anonymous User
Not applicable
Original User: htouyeras

Hi Brad,

BRILLIANT! Thanks a lot  for your advice and sample code, which I had no problem implementing here. This is really helping me out - my thanks again!!

Cheers,

Helene.
0 Kudos