LocalLocatorTask "one or more of the locator's properties is invalid"

1388
11
08-17-2017 11:03 AM
EdwardBlair
Occasional Contributor

Am trying to create a LocalLocatorTask using a composite locator.  This works when I use it in ArcMap.   But when providing the .loc file to Runtime I get the error "One or more of  the locator's properties is invalid".   Are there Runtime-specific requirements for locators?  Code is below.  Any insights would be much appreciated.

Ed

private void SetupLocator()

{

try

{

string locatorPath = @"C:\GISData\Data\Snapshot\CompositeStreetLocator.loc";

_locatorTask = new Esri.ArcGISRuntime.Tasks.Geocoding.LocalLocatorTask(locatorPath);

}

catch (Exception ex)

{

this.Log.LogException(ex);

}

}

0 Kudos
11 Replies
NagmaYasmin
Occasional Contributor III

Hi Radihika,

You could set the OutputSpatialReference of the GeocodeParameters to "SpatialReferences.Wgs84" to get the lat/long coordinates

 

GeocodeParameters gcParams = new GeocodeParameters();
gcParams.OutputSpatialReference = SpatialReferences.Wgs84;

 

IReadOnlyList<GeocodeResult> results = await localLocatorTask.GeocodeAsync("address", gcParams);

Debug.WriteLine("Latitude: " + results[0].InputLocation.Y + " Longitude: " + results[0].InputLocation.X);

Hope that helps.

Nagma

0 Kudos
MariusRocher1
New Contributor

Ed

Fancy running into you here on the forum.    I suspect your environment was much like mine.

Here is what I found:

1. I created the Runtime content and locator (composite locator) using ArcGIS 10.5.

2. I used a runtime application built on 10.2.7 to access the locator much like your posted code does.

3. Got the error you are reporting.

4. I created the Runtime content and locator (composite locator) using ArcGIS 10.2.2.

5. Tried this locator with the same 10.2.7 based app and it works.

There appears to be a compatibility issue that I did not expect and perhaps missed in Esri documentation.  
Perhaps Esri folks can shed light on this?

Regards

Marius

0 Kudos