Findclosematch – Pitney Bowes MapXtreme User Manual

Page 262

Advertising
background image

Chapter 13: Finding Locations

Overview of the Data.Find Namespace

MapXtreme v7.1

269

Developer Guide

_table = null;

}

}

}

find.Dispose();
}

FindCloseMatch

The FindCloseMatch object represents a close match item returned from the Find Search method.
The object is returned as part of the FindResult object. A close match item is a returned match that
closely matches the name of the requested search.

To use this feature, you must first set the UseCloseMatches and CloseMatchesMax properties of the
Find object before you execute your search. For example if you tried to search for “Washington
Street,” and UseCloseMatches was set to true, a close match would be “Washington Ave.”

Code Sample

public void CloseMatchesOnStreetTable()
{

Table _table;
_table = Session.Current.Catalog.OpenTable("Rensselaer.tab");

Find _find = new Find(_table,_table.TableInfo.Columns[1]);
_find.UseCloseMatches = true;
_find.CloseMatchesMax = 5;

FindResult _findResult= _find.Search("70 Washington");

if ((!_findResult.ExactMatch) && (_findResult.NameResultCode ==

FindNameCode.ExactMatchNotFound))

{

FindCloseMatchEnumerator _enum =

_findResult.GetCloseMatchEnumerator();

FindCloseMatch _findCloseMatch;
int _iIndex = 0;

while (_enum.MoveNext())
{

_findCloseMatch = _enum.Current;

Console.WriteLine(_findCloseMatch.Name);
_iIndex++;

}

}

if(_table != null)
{

_table.Close();
_table = null;

}

Advertising