AnsweredAssumed Answered

GeocodeAddress - Specifying OutputSpatialReference does not project Geocoded points

Question asked by dpmarley on Jun 8, 2012
Latest reply on Feb 6, 2015 by bniemand-esristaff
The SOAP API Documentation (Geocode Services > GetLocatorProperties) states that you can add an OutputSpatialReference property to the locator property array (PropMods) for a service, and then the service will project the resulting locations to that spatial reference. From the documentation:

OutputSpatialReference - Every geocode service uses the spatial reference of its reference data and returns match locations in this spatial reference. You can use this property to define the spatial reference of (reproject) the geocoded point returned from an address match operation.

However this is not working for me. I have tried it with single addresses via GeocodeAddress and with batches via GeocodeAddresses. Even after adding the OutputSpatialReference property my results are still coming back as Longitude/Latitude. I've tried a few different ways and just can't seem to get it.

Note: I'm aware that I can use the Geometry service and project my resulting Longitude/Latitude coordinates to my desired final coordinate system but since I am working with large amounts of data I would rather avoid the extra service call and processing. And since the documentation states that this should be able to be done via GeocodeAddress/GeocodeAddresses, I would like to find out why it is not working for me.

Here are the relevant portions of some test code I am using to try to sort this out:

// Define address inputs List<PropertySetProperty> propList = new List<PropertySetProperty>(); PropertySetProperty geocodeProp = new PropertySetProperty(); geocodeProp.Key = streetField; geocodeProp.Value = "2601 W Broward Blvd"; propList.Add(geocodeProp); PropertySetProperty geocodeProp1 = new PropertySetProperty(); geocodeProp1.Key = zoneField; geocodeProp1.Value = "33312";  propList.Add(geocodeProp1); PropertySet geocodePropSet = new PropertySet(); geocodePropSet.PropertyArray = propList.ToArray();  SpatialReference outputSpatialReference = new ProjectedCoordinateSystem(); outputSpatialReference.WKID = 2881; // esriSRProjCS_NAD1983HARN_StatePlane_Florida_East_FIPS_0901_Ft outputSpatialReference.WKIDSpecified = true;  PropertySet propModsSpatRef = new PropertySet(); PropertySetProperty[] propModsArray = new PropertySetProperty[1]; propModsArray[0] = new PropertySetProperty {  Key = "OutputSpatialReference",  Value = outputSpatialReference }; propModsSpatRef.PropertyArray = propModsArray;  PropertySet results = geocodeServerProxy.GeocodeAddress(geocodePropSet, propModsSpatRef); PropertySetProperty[] resultsArray = results.PropertyArray;

Resulting X/Y still comes back as Lat/Long:
X: -80.176754
Y: 26.121718

I have also tried creating the PropMods array by getting the existing settings and appending a new OutputSpatialReference setting to the end like so:

PropertySet propModsSpatRef = geocodeServerProxy.GetLocatorProperties(); List<PropertySetProperty> locatorPropertySetList = propModsSpatRef.PropertyArray.ToList<PropertySetProperty>(); locatorPropertySetList.Add(new PropertySetProperty {  Key = "OutputSpatialReference",  Value = outputSpatialReference }); propModsSpatRef.PropertyArray = locatorPropertySetList.ToArray();
Has anyone been successful at doing this? Thanks in advance for any thoughts...