Composite Locator returns no results

2899
4
Jump to solution
02-23-2014 09:50 PM
SolomonPulapkura
Occasional Contributor III
Ive implemented a composite locator package but I always get "No results". When I pass in one of the individual locators as a package, I do get a valid search result. What am I doing wrong?

The code below is from the sdk geocoding sample

 LocalGeocodeService.GetServiceAsync("E:\\2_Prototype 1\\CompositeLocator.gcpk", "CompositeLocator", (gs) =>                          {                 if (gs.Error != null)                 {                     MessageBox.Show(gs.Error.Message);                 }                 if (gs.Status == LocalServiceStatus.Running)                 {                     _localGeocodeService = gs;                      IsBusy = false;                 }             });   private void SearchTextBox_KeyDown(object sender, KeyEventArgs e)         {             if (e.Key == Key.Return)             {                 IsBusy = true;                 string searchText = SearchTextBox.Text;                 Locator locatorTask = new Locator(_localGeocodeService.UrlGeocodeService);                 locatorTask.AddressToLocationsCompleted += (object sender1, AddressToLocationsEventArgs args) =>                 {                     if (args.Results.Count > 0)                     {                         AddressCandidate bestCandidate = args.Results[0];                         foreach (AddressCandidate candidate in args.Results)                             bestCandidate = (candidate.Score > bestCandidate.Score) ? candidate : bestCandidate;                          MapPoint geographicPoint = new MapPoint(bestCandidate.Location.X, bestCandidate.Location.Y, new SpatialReference(4326));                          Graphic graphic = new Graphic()                         {                             Geometry = geographicPoint,                             Symbol = SearchBarGrid.Resources["FlagMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol,                         };                         _locationGraphicsLayer.Graphics.Clear();                         _locationGraphicsLayer.Graphics.Add(graphic);                         IsBusy = false;                     }                     else                     {                         MessageBox.Show("No results found");                         IsBusy = false;                     }                 };                  locatorTask.Failed += (s2, e2) =>                 {                     MessageBox.Show("Geocode failed with error: " + e2.Error.Message);                 };                  AddressToLocationsParameters addressParameters = new AddressToLocationsParameters();                 Dictionary<string, string> address = addressParameters.Address;                 address.Add("Single Line Input", searchText);                 locatorTask.AddressToLocationsAsync(addressParameters);             }


Thanks for any help.
0 Kudos
1 Solution

Accepted Solutions
PreetiBora
New Contributor
Hi Solomon,

You can modify the following line of code address.Add("Single Line Input", searchText); to address.Add("Street", searchText);

This sure will work.

View solution in original post

4 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

I recommend investigating a problem with the composite locator first - it could be something related to the packaging process where perhaps the data, indexes and locator become disconnected.

Cheers

Mike
0 Kudos
SolomonPulapkura
Occasional Contributor III
Hi Mike, thanks for responding.

I tested the composite locator in ArcGIS Desktop and it works fine. It returns results from the individual locators. The moment I package it up and use it in my code I get the "No Results" message.

But if I package only one of the individual locators and use it in my code, I do get results.

Any other tips on what I might try?

Thank you!
0 Kudos
PreetiBora
New Contributor
Hi Solomon,

You can modify the following line of code address.Add("Single Line Input", searchText); to address.Add("Street", searchText);

This sure will work.
SolomonPulapkura
Occasional Contributor III
Thanks Preeti!
0 Kudos