1

I have two layers . Now I want to say that the spatial references of these layers are same or not ..

I am using .Net technologies in arcmap.

I have successfully got spatial reference information from layers and now I want to compare these spatial references ..

Example

sp1 , sp2

if(sp1 == sp2)

       give message to user that spatial references are same;

else

     give message to user that spatial references are  not same;

How do I know if these spatial references are same?

1
  • 1
    This is very nearly not a GIS question, since the language family, and in fact most modern language families, all have comparison operators for objects, reserving the equivalence operator for scalar values (base numeric types) and object equivalence (same object).
    – Vince
    Apr 9, 2015 at 11:29

1 Answer 1

2
public static bool CompareSpatialRefs(ISpatialReference sourceSR, ISpatialReference targetSR)
        {
            IClone sClone = sourceSR as IClone;
            IClone tClone = targetSR as IClone;

            // first level test compares the coordinate system component  
            if (!sClone.IsEqual(tClone))
                return false;

            return true;
        }
0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.