Select to view content in your preferred language

Scripting Feature Compare Tool for Multiple Layers

1456
6
07-17-2014 01:07 PM
JenniferDick
Deactivated User

Hello,

I have hundreds of layers that I need to do a feature compare on to see if there are any differences between our 9.1 SDE layers and our recently created 10.1 layers from the same source.

I need to confirm that during the porting process from 9.1 to 10.1 that the layers were not changed / distorted, etc. Row counts are the same, etc.

Since I have so many layers I'm looking for a way to script a process that takes in many layers at at time and compares them to the new ones.

I'm not a programmer by nature, so any help would be great!

Thanks

Jennifer 

0 Kudos
6 Replies
ChristianWells
Esri Regular Contributor

This should be some that is doable for your work. One tool that will be helpful in scripting is the Feature Compare tool which will compare a number of variables. Using this tool we should be able to script this for all of your layers. This could also be done through ModelBuilder.

Feature Compare:

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

This is a sample workflow logic that could be used to script this process:

import arcpy, os

#Create DB Connections to both databases
gdb91 = r"DB Connection"
gdb101 = r"DB Connection"

#Create a list to store the feature classes from both databases
list91 = []
list101 = []

#List the feature classes
arcpy.env.workspace=gdb91
fcList = arcpy.ListFeatureClasses()
for fc in fcList:
     list91.append(fc)
arcpy.env.workspace=gdb101
fcList = arcpy.ListFeatureClasses()
for fc in fcList:
     list101.append(fc)

#Compare the feature name and them compare the feature classes themselves
for fc91 in list91:
     try:
          idx = list101.index(fc91)
          fc101 = list101[idx]
          path91 = os.path.join(gdb91,fc91)
          path101 = os.path.join(gdb101,fc101)
          arcpy.FeatureCompare_management(path91, path101, out_compare_file=r"C:\CompareFile\{0}.txt".format(fc91))
     except:
          print "Cannot compare layer {0}".format(fc91)




JenniferDick
Deactivated User

Thanks Christian,

Here's another conundrum:

I need to compare layers from our 9.1 database connection to our 10.1 database connection. Both of those connections do not have the same number of layers in them and the layer names in which I wan to compare are not the same.

How would I handle this through model building, by the use of special characters?

0 Kudos
ChristianWells
Esri Regular Contributor

Hi Jennifer,

We can handle the issue of not having the same number of layers. The layer names may be a little harder to automate, but may be doable. How have the new names changed and do you have a list of which ones line up?

0 Kudos
JenniferDick
Deactivated User

Hi Christian,

I could make up a list of comparable layer names, but here is an example of the differences:

GIS_FCT_.GDM_CO_AREA_83

compares to

GDM_VLT.GDM_CO_AREA_83

in this particular care the 5,6, and 7 characters are different. But not 100% sure at this particular moment without diving into more if this is the case with each comparable layer.

0 Kudos
ChristianWells
Esri Regular Contributor

In this case, the two differences only point to the Schema owner in the database. If the base name "GDM_CO_AREA_83” has not changed, you could control for the schema owner name change.

0 Kudos
JenniferDick
Deactivated User

okay so here is another example:

SPATIAL_VLT.IHS_PARK_27

Compares to

GIS_FCT.IHS_PARK_27

how would I handle all these one offs in the model?

0 Kudos