curtvprice

Comparing coordinate systems with scripting

Discussion created by curtvprice Champion on May 3, 2011
I haven't found a good way to do this. My questions are:

1) Is there are better way than this
2) Are the keyword differences between workstation and desktop prj files documented anywhere?

Here is a little function I set up:

def CompareSR(SR1,SR2):
  """Compare Spatial Reference objects to see if they are different
  using basic parameters. If returns true, the SRs are at least similar."""
  try:
    if SR1.Type == "Projected":
      if SR1.ProjectionCode != SR2.ProjectionCode: raise
      if SR1.CentralParallel != SR2.CentralParallel: raise
      if SR1.LinearUnitCode != SR2.LinearUnitCode: raise
    else:
      if SR1.GCSCode != SR2.GCSCode: raise
      if SR1.DatumCode != SR2.DatumCode: raise
    return True
  except Exception, xmsg:
    return False


I have run into a problem however in that the keywords for workstation projection files seem to be different! For example, these two prj.adf files come up as different:

ArcGIS Desktop:

Projection    ALBERS
Datum         NAD83
Spheroid      GRS80
Units         METERS
Zunits        NO
Xshift        0.0
Yshift        0.0
Parameters
  29 30  0.0 /* 1st standard parallel
  45 30  0.0 /* 2nd standard parallel
 -96  0  0.0 /* central meridian
  23  0  0.0 /* latitude of projection's origin
0.0 /* false easting (meters)
0.0 /* false northing (meters)


ArcInfo Workstation:

Projection    ALBERS
Datum         NAD83
Zunits        NO
Units         METERS
Spheroid      GRS1980
Xshift        0.0000000000
Yshift        0.0000000000
Parameters
 29 30  0.000 /* 1st standard parallel
 45 30  0.000 /* 2nd standard parallel
-96  0  0.000 /* central meridian
 23  0  0.000 /* latitude of projection's origin
0.00000 /* false easting (meters)
0.00000 /* false northing (meters)

Outcomes