Register  |  Login   Search
ThinkGeo - GPS Tracking and Mapping Solutions  |  Home  |  Cygnus Track  |  Developer Community
 
LivePerson Chat

Discussion Forums

The online community for users of Map Suite GIS components

Geocode Settings & Displaying the Match Accuracy of the Geocode
Last Post 11-27-2007 01:21 PM by ThinkGeo. 0 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
ThinkGeoUser is Offline
MVP
MVP
Posts:1594
Avatar

--
11-27-2007 01:21 PM

One question that comes up quite often is.  “What settings should I use for the geocoder to find a match?” 

This answer will vary depending upon your application requirements and how important the accuracy of a match is to your application.   To help answer this question for all audiences I have provided a code snippet below that shows how most programmers would use the settings to find various geocode match levels and accuracy.

In the function below we start with an ExactMatch search which is the most accurate and most desirable in almost all cases.  Then we start to loosen the match criteria by removing Street Types & Street Directional’s.  Next we check for a close street number in case the street number was miss keyed.  After that we check for a street name misspelling and try to match to a street with a similar sound or spelling.  After that we check nearby zip codes for the address and see if we can find a match, and finally if we can't find anything we can return the center point of the Zip code (Assuming it's a valid zip code).

private GeoCodeResult multiGeocode(string address, string city, string state, string zip,ref string matchLevel)

{

if (geoEngine == null)

{

try

{

geoEngine = new GeoCodeEngine(this.txtDataDirectory.Text, false);

}

catch (Exception ex)

{

MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

return null;

}

}

GeoCodeUSASettings gcSettings = new GeoCodeUSASettings();

GeoCodeResult gcResult;

//Exact Match

gcSettings.ExactMatch = true;

gcResult = geoEngine.AdvancedGeoCode(address, city, state, zip, ref gcSettings);

if (gcResult.FailureCode == FailureCode.None)

{

matchLevel = "Exact Match";

return gcResult;

}

//Ignore Street Directionals

gcSettings.ExactMatch = false;

gcSettings.IgnoreDirectionals = true;

gcResult = geoEngine.AdvancedGeoCode(address, city, state, zip, ref gcSettings);

if (gcResult.FailureCode == FailureCode.None)

{

matchLevel = "Ignore Street Directionals";

return gcResult;

}

//Ignore Street Type & Directionals

gcSettings.ExactMatch = false;

gcSettings.IgnoreDirectionals = true;

gcSettings.IgnoreStreetType = true;

gcResult = geoEngine.AdvancedGeoCode(address, city, state, zip, ref gcSettings);

if (gcResult.FailureCode == FailureCode.None)

{

matchLevel = "Ignore Street Type & Directionals";

return gcResult;

}

//Found Closes Street Number

gcSettings.ExactMatch = false;

gcSettings.IgnoreDirectionals = true;

gcSettings.IgnoreStreetType = true;

gcSettings.ClosestStreetNumber = true;

gcSettings.FuzzyStreetName = false;

gcResult = geoEngine.AdvancedGeoCode(address, city, state, zip, ref gcSettings);

if (gcResult.FailureCode == FailureCode.None)

{

matchLevel = "Found Closes Street Number";

return gcResult;

}

//Found Street with Similar Spelling (Possible Misspelled Street Name)

gcSettings.ExactMatch = false;

gcSettings.IgnoreDirectionals = true;

gcSettings.IgnoreStreetType = true;

gcSettings.ClosestStreetNumber = true;

gcSettings.FuzzyStreetName = true;

gcResult = geoEngine.AdvancedGeoCode(address, city, state, zip, ref gcSettings);

if (gcResult.FailureCode == FailureCode.None)

{

matchLevel = "Fuzzy Street Name (Misspelled)";

return gcResult;

}

//Check Nearby Zip Codes

gcSettings.ExactMatch = false;

gcSettings.IgnoreDirectionals = true;

gcSettings.IgnoreStreetType = true;

gcSettings.FuzzyStreetName = true;

gcSettings.ClosestStreetNumber = true;

gcSettings.NearbyZip = true;

gcResult = geoEngine.AdvancedGeoCode(address, city, state, zip, ref gcSettings);

if (gcResult.FailureCode == FailureCode.None)

{

matchLevel = "Found a possible match in a near by zipcode.";

return gcResult;

}

//Return Zip Centroid

gcSettings.ExactMatch = false;

gcSettings.IgnoreDirectionals = true;

gcSettings.IgnoreStreetType = true;

gcSettings.FuzzyStreetName = true;

gcSettings.ClosestStreetNumber = true;

gcSettings.NearbyZip = true;

gcSettings.ZipCentroid = true;

gcResult = geoEngine.AdvancedGeoCode(address, city, state, zip, ref gcSettings);

//We should always find a Zip Centroid if the Zip code is valid

matchLevel = "Zip Centroid";

return gcResult;

}

 

You are not authorized to post a reply.

Active Forums 4.1