bpokorny

Using Composite Address Locator in Engine

Discussion created by bpokorny on Oct 21, 2010
Latest reply on Oct 22, 2010 by bpokorny
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

Outcomes