ERROR

Unable to set MatchKey field

Last Published: April 25, 2020

Error Message

When geocoding through Avenue, ArcView returns this error:"Unable to set MatchKey field."

Cause

Use of the SetZoneKey request when matching intersections is not allowed. ArcView does not support intersection matching with zones through Avenue.

Solution or Workaround



If the theme's MatchSource is using an address style with Zone (US Streets with Zone, US House with Zone, and so forth), don't set the Zone to the MatchKey (aMatchKey.SetZoneKey). The following script does basic matching:

Code:
theInput = msgbox.multiinput("","",{"address","zone"},{"",""})
theGraphicList = av.getactivedoc.GetGraphics
address=theInput.get(0)
city=theInput.get(1)
matchTheme = av.getactivedoc.FindTheme("Streets")
aMatchSource = matchTheme.GetMatchSource
aMatchSource.OpenIndex
aMatchKey = MatchKey.Make(aMatchSource.GetStanRules)
aMatchKey.AllowIntersections("us_intsc.stn", " & ")
aMatchCase = MatchCase.Make(aMatchSource, aMatchKey)
aMatchCase.AllowIntersections(aMatchSource, aMatchKey)
aMatchPref = MatchPref.Make
aMatchKey.SetKey(address)

if (address.Contains("&").Not) ' <******
then ' <******
if (aMatchSource.HasZone) ' <******
then ' <******
aMatchKey.SetZoneKey(city) ' <******
end ' <******
end ' <******

numCand = aMatchSource.Search(aMatchKey,80,aMatchCase)
if (numCand = 0) then
av.ShowMsg(address.Proper++"not found!")
return nil
else
aMatchCase.ScoreCandidates
bestCand = aMatchCase.GetBestCand
Location = aMatchSource.GetPoint( bestCand )
aMatchSource.EndMatch
gPt = GraphicShape.Make(Location)
theGraphicList.Add(gPt)
end


Note the test for the condition where the input address contains an ampersand. This would indicate the address is an intersection. If the address is not an intersection, use the SetZoneKey request. If it is an intersection, don't use this request. Also, don't use the SetZoneKey request if the MatchSource.HasZone is false; in other words, if the theme was not built with a Zone address style.

Article ID:000003616

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic