protected override Collection <Feature> SearchPlacesCore(string inputAddress, Layer layerToSearch) { Collection <Feature> results = new Collection <Feature>(); try { SearchPlaceHelper.GetGeocodeMatches(inputAddress).ForEach(m => { Feature feature = new Feature(); foreach (var item in m.MatchResults) { feature.ColumnValues[item.Key] = item.Value; } results.Add(feature); }); } catch (WebException webException) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, webException.Message, new ExceptionInfo(webException)); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } return(results); }
private static void FillMatchesInGeocoder(PointShape pointShape, SearchedResultViewModel searchedResultViewModel) { try { Collection <GeocodeMatch> matches = SearchPlaceHelper.GetGeocodeMatches(pointShape.X, pointShape.Y); Application.Current.Dispatcher.BeginInvoke(obj => { Collection <GeocodeMatch> tempMatches = (Collection <GeocodeMatch>)obj; if (searchedResultViewModel.City.Equals(loadingText)) { searchedResultViewModel.City = string.Empty; } foreach (var match in tempMatches) { if (match.MatchResults.ContainsKey("City")) { searchedResultViewModel.City = match.MatchResults["City"]; } else if (searchedResultViewModel.City.Equals(loadingText)) { searchedResultViewModel.City = ""; } if (match.MatchResults.ContainsKey("State")) { searchedResultViewModel.State = match.MatchResults["State"]; } if (match.MatchResults.ContainsKey("County")) { searchedResultViewModel.County = match.MatchResults["County"]; } if (match.MatchResults.ContainsKey("Zip")) { searchedResultViewModel.Zipcode = match.MatchResults["Zip"]; } } }, matches); } catch (Exception ex) { if (searchedResultViewModel.City.Equals(loadingText)) { searchedResultViewModel.City = ""; } GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } }
private static void FillMatchesInGeocoder(string searchAddress, Collection <GeocodeMatch> resultMatches, Collection <string> errorMessages) { try { var matches = SearchPlaceHelper.GetGeocodeMatches(searchAddress); matches.ForEach(m => resultMatches.Add(m)); } catch (WebException webException) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, webException.Message, new ExceptionInfo(webException)); errorMessages.Add(GisEditor.LanguageManager.GetStringResource("SearchPlaceViewModelOnlineSearchFailedText")); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); errorMessages.Add(ex.Message); } }
private static void FillMatchesInGeocoder(Feature feature) { try { if (feature.GetWellKnownBinary() != null) { PointShape searchWorldCenter = feature.GetBoundingBox().GetCenterPoint(); var matches = SearchPlaceHelper.GetGeocodeMatches(searchWorldCenter.X, searchWorldCenter.Y); foreach (var match in matches) { if (match.MatchResults.ContainsKey("City")) { feature.ColumnValues["City"] = match.MatchResults["City"]; } if (match.MatchResults.ContainsKey("State")) { feature.ColumnValues["State"] = match.MatchResults["State"]; } if (match.MatchResults.ContainsKey("County")) { feature.ColumnValues["County"] = match.MatchResults["County"]; } if (match.MatchResults.ContainsKey("Zip")) { feature.ColumnValues["Zip"] = match.MatchResults["Zip"]; } if (match.MatchResults.ContainsKey("CentroidPoint")) { feature.ColumnValues["CentroidPoint"] = match.MatchResults["CentroidPoint"]; } if (match.MatchResults.ContainsKey("BoundingBox")) { feature.ColumnValues["BoundingBox"] = match.MatchResults["BoundingBox"]; } } } } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } }