private static IEnumerable <GeocodeMatch> GetMatchedResult(IEnumerable <Feature> matchedFeatures) { Collection <GeocodeMatch> resultMatches = new Collection <GeocodeMatch>(); foreach (Feature feature in matchedFeatures) { GeocodeMatch geocodeMatch = GetGeocodeMatch(feature); resultMatches.Add(geocodeMatch); } return(resultMatches); }
private static GeocodeMatch GetGeocodeMatch(OpenStreetGeocodeMatch item) { GeocodeMatch match = new GeocodeMatch(); match.MatchResults["CentroidPoint"] = "POINT(" + string.Join(" ", new[] { item.Longitude, item.Latitude }) + ")"; match.MatchResults["BoundingBox"] = new RectangleShape(item.BoundingBox[2], item.BoundingBox[1], item.BoundingBox[3], item.BoundingBox[0]).GetWellKnownText(); match.MatchResults["City"] = item.Address?.City; match.MatchResults["State"] = item.Address?.State; match.MatchResults["Country"] = item.Address?.Country; return(match); }
private static Collection <GeocodeMatch> GetGeocodeMatches(IEnumerable <OpenStreetGeocodeMatch> matches) { Collection <GeocodeMatch> resultMatches = new Collection <GeocodeMatch>(); foreach (var item in matches) { GeocodeMatch match = GetGeocodeMatch(item); resultMatches.Add(match); } return(resultMatches); }
private static GeocodeMatch GetGeocodeMatch(Feature feature) { GeocodeMatch geocodeMatch = new GeocodeMatch(); geocodeMatch.MatchResults["BoundingBox"] = feature.GetBoundingBox().GetWellKnownText(); geocodeMatch.MatchResults["CentroidPoint"] = feature.GetBoundingBox().GetCenterPoint().GetWellKnownText(); if (feature.ColumnValues.ContainsKey(InternalProjectionKey)) { geocodeMatch.MatchResults[InternalProjectionKey] = feature.ColumnValues[InternalProjectionKey]; } foreach (var item in feature.ColumnValues) { if (item.Key.Equals("City")) { geocodeMatch.MatchResults["City"] = item.Value; } if (item.Key.Equals("State")) { geocodeMatch.MatchResults["State"] = item.Value; } if (item.Key.Equals("County")) { geocodeMatch.MatchResults["County"] = item.Value; } if (item.Key.Equals("Zip")) { geocodeMatch.MatchResults["Zip"] = item.Value; } if (item.Key.Equals("Street")) { geocodeMatch.MatchResults["Street"] = item.Value; } if (item.Key.Equals("SearchSegment")) { geocodeMatch.MatchResults["SearchSegment"] = item.Value; } } geocodeMatch.MatchType = MatchType.None; return(geocodeMatch); }
public void Load(GeocodeMatch match) { centroidPoint = null; boundingBox = null; if (match.MatchResults.Count > 0 && (match.MatchResults.ContainsKey("City") || match.MatchResults.ContainsKey("State") || match.MatchResults.ContainsKey("County") || match.MatchResults.ContainsKey("Zip") || match.MatchResults.ContainsKey("Street") || match.MatchResults.ContainsKey("CentroidPoint") || match.MatchResults.ContainsKey("BoundingBox"))) { if (match.MatchResults.ContainsKey("City")) { City = match.MatchResults["City"]; } if (match.MatchResults.ContainsKey("State")) { State = match.MatchResults["State"]; } if (match.MatchResults.ContainsKey("County")) { County = match.MatchResults["County"]; } if (match.MatchResults.ContainsKey("Zip")) { Zipcode = match.MatchResults["Zip"]; } if (match.MatchResults.ContainsKey("CentroidPoint")) { centroidPoint = new PointShape(match.MatchResults["CentroidPoint"]); } if (match.MatchResults.ContainsKey("BoundingBox")) { boundingBox = new RectangleShape(match.MatchResults["BoundingBox"]); } if (match.MatchResults.ContainsKey("Street")) { if (match.MatchResults.ContainsKey("HouseNumber")) { Address = match.MatchResults["HouseNumber"] + " " + match.MatchResults["Street"]; } else { Address = match.MatchResults["Street"]; } } if (match.MatchResults.ContainsKey(SearchPlaceViewModel.InternalProjectionKey)) { internalProjection = match.MatchResults[SearchPlaceViewModel.InternalProjectionKey]; } if (match.MatchResults.ContainsKey("SearchSegment")) { searchSegment = match.MatchResults["SearchSegment"]; } } else if (match.MatchResults.ContainsKey("mtrs") || match.MatchResults.ContainsKey("COUNTYNA") || match.MatchResults.ContainsKey("ABSTRACT")) { if (match.MatchResults.ContainsKey("CenterWkt")) { centroidPoint = new PointShape(match.MatchResults["CenterWkt"]); } if (match.MatchResults.ContainsKey("BoundingBoxWkt")) { PolygonShape polygon = new PolygonShape(match.MatchResults["BoundingBoxWkt"]); boundingBox = polygon.GetBoundingBox(); } string addressText = string.Empty; if (match.MatchResults.ContainsKey("mtrs")) { addressText = match.MatchResults["mtrs"]; } else { if (match.MatchResults.ContainsKey("COUNTYNAME")) { addressText = match.MatchResults["COUNTYNAME"]; } if (match.MatchResults.ContainsKey("ABSTRACT")) { addressText += "," + match.MatchResults["ABSTRACT"]; } if (match.MatchResults.ContainsKey("SECTION")) { addressText += "," + match.MatchResults["SECTION"]; } if (match.MatchResults.ContainsKey("FID")) { addressText += "," + match.MatchResults["FID"]; } if (match.MatchResults.ContainsKey("SURVEY")) { addressText += "," + match.MatchResults["SURVEY"]; } if (match.MatchResults.ContainsKey("BLOCK")) { addressText += "," + match.MatchResults["BLOCK"]; } if (match.MatchResults.ContainsKey("SUBSURVEY")) { addressText += "," + match.MatchResults["SUBSURVEY"]; } if (match.MatchResults.ContainsKey("COUNTYID")) { addressText += "," + match.MatchResults["COUNTYID"]; } } Address = addressText; } RaisePropertyChanged(() => IsEmpty); }