Select to view content in your preferred language

Locator won't match close street number in single address locator

16113
77
11-26-2013 06:49 AM
PeterHanmore
Emerging Contributor
We have built a locator in ArcGIS 10 SP5 which is based on the US Street - Single Address style.
We have been able to tweak most other settings but are still having issues with street number scoring.
Basically, we would like the locator to rank similar house numbers on the same street/town with a high score.
The default action (from my testing and based on one other forum thread) seems to indicate that the locator is VERY strict about the house number matching - to the point that it will give a high ranking to an address that matches the house number and street in a town hundreds of miles away, but fail to even score the address 100' away.
We have tried playing with the scoring of the FullNormalAddress, NormalAddress and House components but nothing seems to allow addresses with close house numbers in the desired city to be ranked higher than exact house number matches in a different city.

For example:
Search for 100 Main Street, Mytown

Geocoder responds with:
Score: 90, Address: 100 Main Street, Yourtown (could be large distance away from Mytown and therefore totally wrong location).

Yet 98 Main Street, Mytown is only two house numbers away from the desired address.  I would like the locator to return something like:

Score: 98, Address: 98 Main Street, MyTown
Score: 50, Address: 100 Main Street, Yourtown

Has anyone found a solution for this?  Any workarounds?  Apparently this worked as desired in 9.3.1 but was "improved" in 10.0?
Tags (2)
77 Replies
BradNiemand
Esri Regular Contributor

Elizabeth,

Maybe try adding quotes around the field name "Status" like this.

qf.WhereClause = "\"Status\" = 'M' OR \"Status\" = 'T'";

I am to 100% sure but I found a link to the IQueryFilter doc that states "If you are querying data in a file geodatabase, shapefile, dBase table, coverage, INFO table, then field names are enclosed in double quotes:"

Brad

0 Kudos
ElizabethWare1
Emerging Contributor

You two, Brad Niemand‌ and Joe Borgione, have been such a great help to me. I think we have it working pretty well now. Thank you both so much for walking me through my issues. I believe the biggest issue what the addresses. I wondered if they had to be split out like that. I will hopefully remember for next time. You two are amazing. Thank you so much!!

0 Kudos
JoeBorgione
MVP Emeritus

Glad you got things going in the right direction!

That should just about do it....
0 Kudos
ElizabethWare1
Emerging Contributor

Yeah I see where that error about the owner SID. It seems to happen when a call can't be plotted. I have one test address that isn't in the geocode and it throws that error. 

Nevermind, I think that was on my end. I was looking for a lat/long fields to be 0 value, but in the data, those fields are empty. So i put tick marks around the '0' and check for empty string as well.

pQFiltXY.WhereClause = "\"status\" = 'U' AND (\"LonX\" <> '0' AND \"LonX\" <> '') AND (\"LatY\" <> '0' AND \"LatY\" <> '')";

UPDATE - I do get an error when I try to refresh my calls. It is supposed to delete all the new geocoded files that were created from the csv file and replace them with new ones, but some of the files get locked because they are in the map (my ActiveCalls layer) and then this throws an error. I haven't had to remove the layer before deleting the files before. Even removing the layer, I still get files locked that can't be deleted until I close my map. Any ideas?

0 Kudos
JoeBorgione
MVP Emeritus

I'm nothing of an arc objects guy, however, ArcMap is famous for locking down files until the program exits. Is the a particular reason you are sticking with the arc objuts approach over something like python?

That should just about do it....
0 Kudos
ElizabethWare1
Emerging Contributor

I have limited time to do a total rewrite at this time. I think the issue is when I am getting the record count, I am opening the feature class. How do I close it?

// Get number of records plotted
IWorkspaceFactory2 wFactory = (IWorkspaceFactory2)new ShapefileWorkspaceFactory();
IWorkspace wSpace = wFactory.OpenFromFile(localMapFolder, 0);

IFeatureClass fClass = ((IFeatureWorkspace)wSpace).OpenFeatureClass("ActiveCalls");  // Opening class
ITable geoTable = (ITable)fClass;

IQueryFilter QF = new QueryFilterClass();
//QF.WhereClause = "Statis = 'M' OR Status = 'T'";
recordCount = geoTable.RowCount(null);

0 Kudos
BradNiemand
Esri Regular Contributor

Elizabeth,

I don't know if this will fix it but you can give it a try.  At the end of some of my test code, I do the following for a lot of the ArcObjects COM objects to clean them up so that they are not getting held onto by lazy .NET garbage collection.

if (workspace != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(workspace);
workspace = null;
}

if (ocatorWorkspace != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(locatorWorkspace);
locatorWorkspace = null;
}

Then I call into this helper method I created:

cleanupCOM();

Here it is:

public void cleanupCOM()
{
do
{
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
}
while (System.Runtime.InteropServices.Marshal.AreComObjectsAvailableForCleanup());

CoFreeUnusedLibraries();
}

You can try doing that for the interfaces like IWorkspaceFactory2, IWorkspace, IFeatureClass, etc....

Brad

0 Kudos
ElizabethWare1
Emerging Contributor

Unfortunately, that did not help. I can't get rid of those locks unless I close the map. I can't do that everytime my calls get updated. When the csv file is recreated, it gets re-geocoded. So how can I get rid of that lock without having to reload my map control? It seems to be when I add that new layer created from the CSV. 

UPDATE:

This could be causing the lock: 
GP.Execute("GeocodeAddresses_geocoding", parameters, null);

I have released the com object and set to null and it is still locked.

0 Kudos
BradNiemand
Esri Regular Contributor

Elizabeth,

You released the IGeoProcessor COM object, is that what you are saying?  Have you tried using a FGDB instead of a Shapefile?  I have test code that geocodes a table, counts the geocoded features and then deletes the result and I have no locking issues so I don't think it is the GP.Execute() code that is doing this.  It might be time to call tech support if you are still having issues.  Maybe a tech support SDK specialist will have some additional suggestions for you.

Brad

0 Kudos
ElizabethWare1
Emerging Contributor

I don't know what a FGDB is. I have only worked with this code. It was written by a co-worker who no longer works with us, so I am left with a huge learning curve on top of modifying to a newer version. So whatever would help, I would be incredibly grateful.

I went back to look at opening the csv file, I figured out why that wasn't working. I was supplying the whole path instead of just the file name. But now I am having issues creating the Feature class. The error message don't help at all. It just says something went wrong.

0 Kudos