/// <summary> Triggers the geocoding of the given multi field data. The call is asynchronously i.e. the caller /// is not blocked. The result is stored in the <see cref="GeocoderBase.Addresses"/> property. </summary> /// <param name="data"> The data to geocode. </param> public void LocateMultiField(MultiFieldData data) { Addresses.Clear(); if (data.IsEmpty()) { return; } #region doc:call xlocate XLocateWS xLocate = XServerClientFactory.CreateXLocateClient(Properties.Settings.Default.XUrl); var address = new Address { country = data.Country, state = data.State, postCode = data.PostalCode, city = data.City, street = data.Street }; try { xLocate.BeginfindAddress(new findAddressRequest { Address_1 = address, CallerContext_5 = new CallerContext { wrappedProperties = new[] { new CallerContextProperty { key = "CoordFormat", value = "PTV_MERCATOR" } } }, }, LocateMultiFieldComplete, xLocate); } catch (EntryPointNotFoundException) { errorDelegate.Invoke(Properties.Resources.ErrorGeocodeEndpointNotFound); } catch (Exception ex) { errorDelegate.Invoke(ex.Message); } #endregion }
/// <summary> Triggers the suggestion calculation for the given string. The call is synchronously i.e. the /// caller is blocked until the server responds. The result is stored in the <see cref="Suggestions"/> property. </summary> /// <param name="toLocate"> The string to look up suggestions for. </param> public void Suggest(string toLocate) { if (!string.IsNullOrEmpty(toLocate)) { #region doc:suggest XLocateWS xLocate = XServerClientFactory.CreateXLocateClient(Properties.Settings.Default.XUrl); var response = xLocate.findSuggestion(new findSuggestionRequest { String_1 = toLocate }); Suggestions = response.result.wrappedSuggestionList; #endregion } else { Suggestions = new Suggestion[] { } }; }
/// <summary> Triggers the geocoding of the given string. The call is asynchronously i.e. the caller is not /// blocked. The result is stored in the <see cref="GeocoderBase.Addresses"/> property. </summary> /// <param name="toLocate"> The string to geocode. </param> public void LocateSingleField(string toLocate) { Addresses.Clear(); if (string.IsNullOrEmpty(toLocate)) { return; } #region doc:call xlocate XLocateWS xLocate = XServerClientFactory.CreateXLocateClient(Properties.Settings.Default.XUrl); try { xLocate.BeginfindAddressByText(new findAddressByTextRequest { String_1 = toLocate, String_2 = Properties.Settings.Default.XUrl.ToUpper().Contains("-CN-N")? "CHN " : null,// decarta needs Country for OpenLR geocoding CallerContext_6 = new CallerContext { wrappedProperties = new[] { new CallerContextProperty { key = "CoordFormat", value = "PTV_MERCATOR" } } } }, LocateSingleFieldComplete, xLocate); } catch (EntryPointNotFoundException) { errorDelegate.Invoke(Properties.Resources.ErrorGeocodeEndpointNotFound); } catch (Exception ex) { errorDelegate.Invoke(ex.Message); } #endregion }