Locator problem

04-30-2011 08:23 AM
New Contributor
I have program that takes a Shapefile centerline layer and will break FROM/TO data ranges of the line segments into "100 block" ranges.  The program geocodes the start of each 100 block range as it runs.  When I run the program with one shapefile which contains around 5500 line segments and produces 20,000 block ranges, things run fine.  I have another shapefile that only contains about 1500 line segments and I am having problems with it.  At various points during the program run, it generates an exception error.  The address that causes the exception is not consistent.  The first time, it might be 4200 MAIN ST and the next time 5000 MAIN ST.

If I use the Locator within ArcMap, it consistently finds the addresses.

The exception is listed below and is taking place on the last line of this code that I have included (ws is an active IWorkspace that is being passed to the processing function):

System.Runtime.InteropServices.COMException was unhandled
  Message=Error HRESULT E_FAIL has been returned from a call to a COM component.

if (locatorManager == null)
[INDENT][INDENT]locatorManager = new LocatorManagerClass();
locatorWorkspace = (ILocatorWorkspace)locatorManager.GetLocatorWorkspace(ws);
if (locatorWorkspace == null)

IPropertySet addressProperties = new PropertySetClass();
addressProperties.SetProperty("Street", Addr);
addressProperties.SetProperty("City", City);

IAddressGeocoding addressGeocoding = (IAddressGeocoding)locatorWorkspace.GetLocator(LocatorName);
if (addressGeocoding == null)
IPropertySet matchProperties = addressGeocoding.MatchAddress(addressProperties);

Any ideas?  Thanks.
0 Kudos
1 Reply
New Contributor
Found the problem.  The program had introduced some bad block ranges to be searching and the exception was due to those addresses not existing afterall.
0 Kudos