1

As the title says I've several feature classes. I want to check whether they have same spatial reference using arcpy

asked Jun 4, 2012 at 7:09

1 Answer 1

2

you can do it with this way:

import arcpy
env.workspace = "D:/test/data.gdb"
fcs = arcpy.ListFeatureClasses()
ary = []
for ft in fcs: 
 desc = arcpy.Describe(ft)
 spatialRef = desc.SpatialReference
 ary.append([spatialRef.Name, ft])
 print spatialRef.Name
# Finding the same Spatial Reference Object
for a in range(len(ary)):
 if ary[a][0] == 1:
 print ary[a]
# Finding different form other Spatial Reference Object
for a in range(len(ary)):
 if ary[a][0] > 1:
 print ary[a]

i hope it helps you...

answered Jun 4, 2012 at 7:19
2
  • I'm just a programmer working on a GIS software. Do spatialRef.Name always identifies the projection? Is checking spatialRef.Name equals is enoguh? Commented Jun 4, 2012 at 7:22
  • spatialRef.Name will give you Map Projections as Mercator, Gauss-Kruger or Lambert Conformal Conic. if you want to learn spatial reference code you can use desc.SpatialReference.factoryCode Commented Jun 4, 2012 at 8:59

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.