Using Match Code and Matched Method

Using Match Code and Matched Method

You can get detailed information about results returned from MapPoint Web Service by using the Match Code and Matched Method values.

To determine the accuracy of returned results from a FindServiceSoap.FindAddress call, you can add a FindResultMask enumeration to your FindOptions object. By specifying the FindResultMask.MatchDetailsFlag, MapPoint Web Service returns the Match Code and Matched Method as entity properties for the returned entities.

Note Finding partial addresses may result in inaccurate Match Code and Matched Method values.

The following code shows one way in which you might use Match Code and Matched Method values:

[c#]
int matchCode = -1;
int matchedMethod = -1;
if(entity.Properties != null)
{
   foreach(EntityProperty prop in entity.Properties)
   {
      if(string.Compare(prop.Name, “MatchCode”)==0)
      {
         matchCode = (int) prop.Value;
      }
      else if(string.Compare(prop.Name, “MatchedMethod”)==0)
      {
         matchedMethod = (int) prop.Value;
      }
   }
}
if(matchCode == 0 && matchedMethod == 0)
{
   //address may be good
}
else
{
   //address may be bad
}