AnsweredAssumed Answered

compare spatial references

Question asked by HimBromBeere on Oct 26, 2018
Latest reply on Oct 29, 2018 by HimBromBeere

In order to compare the spatial reference of my map and this of my database I use the following code:

 

var mapSR = myMap.ActiveView.SpatialReference;
var gdbSR = ((IGeoDataset)myFeatureClass).SpatialReference;

bool areSame = ((IClone)mapSR).IsEqual((IClone)gdbSR);
if(areSame)  // also compare map-resolution as suggested here: https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#ISpatialReference_IsPrecisionEqual.htm
    mapSR.IsPrecisionEqual(gdbSR, out areSame);

After calling IsPrecisionEqual areSame will be false (I ensured the method was called by setting a breakpoint), which I don´t understand. When I dive into the spatial references, e.g. using a watch, I can´t see any (meaningful) differences:

 

(ISpatialReferenceResolution)mapSR
COM Object
    [System.__ComObject]: COM Object
    Abbreviation: ""
    Alias: ""
    FactoryCode: 0
    MResolution: 0.0001
    MResolution: 0.0001
    MTolerance: 0.001
    MToleranceValid: esriSRToleranceOK
    Name: "ETRS89_UTM32"
    PrecisionExImpl: 1529763776
    PrecisionImpl: 1533456216
    Remarks: ""
    SpatialReferenceImpl: 689094056
    VerticalCoordinateSystem: null
    XYTolerance: 0.0001
    XYToleranceValid: esriSRToleranceOK
    ZCoordinateUnit: null
    ZTolerance: 0.001
    ZToleranceValid: esriSRToleranceOK
(ISpatialReferenceResolution)gdbSR
COM Object
    [System.__ComObject]: COM Object
    Abbreviation: null
    Alias: null
    FactoryCode: 0
    MResolution: 0.0001
    MResolution: 0.0001
    MTolerance: 0.001
    MToleranceValid: esriSRToleranceOK
    Name: "ETRS89_UTM32"
    PrecisionExImpl: 1103993808
    PrecisionImpl: 1100159248
    Remarks: null
    SpatialReferenceImpl: 689094056
    VerticalCoordinateSystem: null
    XYTolerance: 0.0001
    XYToleranceValid: esriSRToleranceOK
    ZCoordinateUnit: null
    ZTolerance: 0.001
    ZToleranceValid: esriSRToleranceOK

Also get_XYResolution(false) returns 0.00001 (which is 10times the XYTolerance, as seen above) for both the maps and the databases spatial reference.

 

I also tried to use ISpatialReference3.IsXYResolutionEqual, because I´m only interested in plane resolution and tolerance. However this also returns false when comparing the two spatial references. So what do IsXYResolutionEqual and IsResolutionEqual compare asside from the above properties? Are those Impl- and ExImp-properties considered as well (which is not documented)?

Outcomes