Using Composite Address Locator in Engine

521
1
10-21-2010 03:07 PM
BobPokorny
New Contributor
Hi folks. 

I just created a composit address locator using  three different address point layers all having different fields.  When I used a particular address locator that had the address in one field, my application worked fine.  However when I changed to my composit locator, I get no results back.

I am using ArcEngine 10.0 in VB.NET 2010.

Below is the code I created to date:

        Dim addressInputs As IAddressInputs = TryCast(AddressLocator, IAddressInputs)
        Dim addressFields As IFields = addressInputs.AddressFields
        Dim addressProperties As IPropertySet = New PropertySet

        addressProperties.SetProperty(addressFields.Field(0).Name, addressToSearch.FullAddress)

        ' Add additional properties here in time

        ' Find closest Address
        Dim addressCandidates As IAddressCandidates2 = AddressLocator
        Dim resultsArray As IArray = addressCandidates.FindAddressCandidates(addressProperties)

        ' Display the candidate fields
        Dim resultFields As IFields = addressCandidates.CandidateFields
        Dim resultPropertySet As IPropertySet2
        Dim Addresses As New List(Of Address)

        For resultIndex As Integer = 0 To resultsArray.Count - 1
            Dim foundAddress = New Address

            resultPropertySet = resultsArray.Element(resultIndex)

            foundAddress.MatchAddress = resultPropertySet.GetProperty("Match_Addr").ToString
            foundAddress.MatchScore = resultPropertySet.GetProperty("Score")
            foundAddress.Point = resultPropertySet.GetProperty("Shape")

            Addresses.Add(foundAddress)
        Next
        Return Addresses

My concern is setting the addressProperties.SetProperty({fieldname}) line of code.  If I understand the IFields interface, that would indicate what fields to map my data too.  Well using a composit locator, in ArcMap, it requested a singline address (123 Main St).  It found it in ArcMap, but nothing in Engine.

Can someone take a peek at the code and lead me in the direction to best use the locator.
One more thing.  To add complexity to the application, the locators can be configured to use whatever locator they wish.

please let me know if you have any questions or need better definition.

Thanks
0 Kudos
1 Reply
BobPokorny
New Contributor
Hi there -

Here is a little more information I found and am able to accomplish.

Apparenty, there is the ICompositLocator interface that gives you access to the individual locators within the composit locator.

So my next question is, do I treat a composit locator the same as an individual locator by spinning through each locator?  For each locator, I apply the address field properties, execute it and determine any results?

If each independent locator uses different fields, such as a single key field or a multiple range of fields, I need a way to determine which properties to set for the particular locator...any idea how to do that?  I know that's a stretch, but any help is appreciated.

Thanks,
Bob
0 Kudos