I am using GeoCoder Version 9.0.0.0 assembly. I am seeing this trying to do a search by Street, City and State.
My code is below along with a result screen shot. This is a newly written app from the ground up. I am not using your demo.
Dim
dataPath
As
String
=
"L:\MyData\MapSuiteGeoCoderFullData"
Dim
results
As
System.Collections.ObjectModel.Collection(Of GeocoderMatch)
Dim
usaGeocoder
As
New
UsaGeocoder(dataPath, MatchMode.ExactMatch, StreetNumberMatchingMode.ExactMatch)
Try
usaGeocoder.Open()
If
Me
.txtZipcode.Text.Trim =
“”
Then
results = usaGeocoder.Match(
Me
.txtAddress.Text,
Me
.txtCity.Text,
Me
.txtState.Text)
Else
results = usaGeocoder.Match(
Me
.txtAddress.Text,
Me
.txtZipcode.Text)
End
If
Finally
usaGeocoder.Close()
End
Try
The search is filtered down as I am checking for City and Zip match before displaying results in an attempt to narrow down to one result.
Dim
multiPointShape
As
New
MultipointShape()
Dim
matchString
As
String
=
If
(SearchType = GeocoderSearchType.Street,
“Street”
,
String
.Empty)
Dim
searchResultItems
As
New
System.Collections.ObjectModel.Collection(Of GeocoderMatch)()
For
Each
item
As
GeocoderMatch
In
results
If
String
.IsNullOrEmpty(matchString)
OrElse
item.NameValuePairs.ContainsKey(matchString)
Then
If
item.NameValuePairs(
“CityAlias”
).Trim =
Me
.txtCity.Text.Trim
Or
item.NameValuePairs(
“Zip”
).Trim =
Me
.txtZipcode.Text.Trim
Then
AddSearchResultMarkerWithToolTip(item, multiPointShape)
searchResultItems.Add(item)
End
If
End
If
Next
The system we are developing has separate Street, City, State and Zip from our customer database. I am looking to get the most precise address lookup with the least amount of redundant results. Even with a Zipcode I still get a redundant result. While I could just grab the first row I don’t see why I need to code for this.