1

I am creating a simple text search application, where the user can enter an address search and the result appear in a listbox, which they can then select it and zoom to the address.

Now the problem I am having is that I have set layer definition, within the layer I am working with to only show Residential addresses ( and this works, as i can only see residential addresses in the attribute table), however when I enter a street (in the app), that contains not only residential address, the records appear in my list box when though I have set the layer definition.

Is this behavior normal ? and what is the best way to get round this?

Thanks

1

It is a normal behaviour.

You can use IGeoFeatureLayer. It will search only within your definition query.

Dim pGeoFtrLyr As IGeoFeatureLayer
Set pGeoFtrLyr = pMap.Layer(0)

Dim pQueryFilter As IQueryFilter
Set pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = "STNAME = 'Stack Street'"

Dim pFtrCur As IFeatureCursor
Set pFtrCur = pGeoFtrLyr.Search(pQueryFilter, False)

Or you can simply set set your QueryFilter to include the Layer Definition Query too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.