Bug in the SOAP API? GeocodeAddresses ignoring OutputSpatialReference

Discussion created by toiyabe on Apr 3, 2013
Latest reply on Feb 6, 2015 by sacdou
Hello everyone,

I've read other threads here that talk about problems with setting the OutputSpatialReference as a property modification when using SOAP to call and ArcGIS Server (10.0) Geocoder Service.  The REST API totally works when specifying outSR=102100 (Web Mercator). The locator is WGS 84 by default by the way.

Here is the code I use to create the output spatial reference, I even go to the effort of using the Geometry service on the same ArcGIS Server to define the spatial reference, then, I transfer the properties of that spatial reference to the SR object defined by the Geocoding service:

// Create a new property set to modify the geocoder
geocodeMods = new PropertySet();

// Get the spatial ref. def from the Geometry Server
            var spatRef = this.GeometryServer.FindSRByWKID("EPSG", 102100, -1, true, true);
// Before I tried this by setting only the WKID and WKIDSpecified fields--that did not work.
// So to make sure I've not left anything out, I copy all possible attributes over!
            ESRI.ArcGIS.SOAP.SpatialReference outputSpatialReference = new ESRI.ArcGIS.SOAP.ProjectedCoordinateSystem()
                    HighPrecision = spatRef.HighPrecision,
                    HighPrecisionSpecified = spatRef.HighPrecisionSpecified,
                    LeftLongitude = spatRef.LeftLongitude,
                    LeftLongitudeSpecified = spatRef.LeftLongitudeSpecified,
                    MOrigin = spatRef.MOrigin,
                    MOriginSpecified = spatRef.MOriginSpecified,
                    MScale = spatRef.MScale,
                    MScaleSpecified = spatRef.MScaleSpecified,
                    MTolerance = spatRef.MTolerance,
                    MToleranceSpecified = spatRef.MToleranceSpecified,
                    VCSWKID = spatRef.VCSWKID,
                    VCSWKIDSpecified = spatRef.VCSWKIDSpecified,
                    WKID = spatRef.WKID,
                    WKIDSpecified = spatRef.WKIDSpecified,
                    WKT = spatRef.WKT,
                    XOrigin = spatRef.XOrigin,
                    XOriginSpecified = spatRef.XOriginSpecified,
                    XYScale = spatRef.XYScale,
                    XYScaleSpecified = spatRef.XYScaleSpecified,
                    XYTolerance = spatRef.XYTolerance,
                    XYToleranceSpecified = spatRef.XYToleranceSpecified,
                    YOrigin = spatRef.YOrigin,
                    YOriginSpecified = spatRef.YOriginSpecified,
                    ZOrigin = spatRef.ZOrigin,
                    ZOriginSpecified = spatRef.ZOriginSpecified,
                    ZScale = spatRef.ZScale,
                    ZScaleSpecified = spatRef.ZScaleSpecified,
                    ZTolerance = spatRef.ZTolerance,
                    ZToleranceSpecified = spatRef.ZToleranceSpecified

// Add the property to the PropertyArray
            List<PropertySetProperty> mods = new List<PropertySetProperty>();
            mods.Add(new PropertySetProperty()
                Key = "OutputSpatialReference",
                Value = outputSpatialReference
            geocodeMods.PropertyArray = mods.ToArray();

Next, I set the property modification when I do the geocoding:

RecordSet results = this.geocodeServerProxy.GeocodeAddresses(addressTable, geocodePropSet, geocodeMods);

I hope someone has run into this same problem and found a fix. One of the more promising threads seems to show that the programmer coded everything correctly, and it didn't work. Then, suddenly after a long while, it started working--without knowing why it started working.

One last thing, I'm checking the point that is being returned (PointN) in the SHAPE field. And it is indeed, lat/long coordinates, not at all in Web Mercator.

I'm starting to think there is a BUG in the SOAP Api?