Parameters:
nFinder - number of a finder
For the USA map you can use the following constants:
ADDRESS = 0
INTERSECTION = 1
ZIP = 2
CITY = 3
COUNTY = 4
AREACODE = 5
COORDINATES = 6
Additional parameters depend on the amount and order of the fields of the specified finder.
For example, the ADDRESS finder has the following fields (the order of the fields is important):
'Address', 'ZIP', 'City', 'State'. Therefore, if you want to find an address you
must use the following syntax:
Dim fields() = { "380 New York St", "92373", "Redlands", "CA"}
Dim locs() = findLocation( map, ADDRESS, fields)
Another examples:
Dim fields() = {"Redlands", "CA"}
Dim locs() = findLocation( map, CITY, fields)
Dim fields() = {"Redlands"}
Dim locs() = findLocation( map, CITY, fields) (found results equal Redlands, CA and Redlands, CO)
Dim fields() = {"Orange", "CA"}
Dim locs() = findLocation(map, COUNTY, fields)
Dim fields() = {"New York St", "W Park Ave", "", "Redlands", "CA"}
Dim locs() = findLocation(map, INTERSECTION, fields)
or if you want to make another search:
fields = new String() {"New York St", "W Park Ave", "", "Redlands", "CA"}
locs = findLocation( map, INTERSECTION, fields)
Returns:
An array of the FoundLocation objects, or Nothing if the location is not found (see the FoundLocation object)
' Finders (USA map) Const ADDRESS = 0 Const INTERSECTION = 1 Const ZIP = 2 Const CITY = 3 Const COUNTY = 4 Const AREACODE = 5 Const COORDINATES = 6 ' Finders (North American map) Const NA_US_ADDRESS = 0 Const NA_CA_ADDRESS = 1 Const NA_US_INTERSECTION = 2 Const NA_CA_INTERSECTION = 3 Const NA_US_ZIP = 4 Const NA_US_ZIP3 = 5 Const NA_CA_POSTALCODE = 6 Const NA_US_CITY = 7 Const NA_CA_CITY = 8 Const NA_US_COUNTY = 9 Const NA_AREACODE = 10 Const NA_COORDINATES = 11 Function findLocation( map, nFinder, fields) Dim rs, Finders, Finder, j Finders = map.getFinders() Finder = Finders.getFinder( nFinder) For j = 0 To UBound( fields) Finder.setFieldValue( j, fields(j)) Next rs = Finder.find() If Not rs Is Nothing Then Dim Locations(), i ReDim Locations(rs.getRecordsCount - 1) i = 0 : rs.moveFirst Do Locations(i) = new FoundLocation _ (rs.getAsIntByName("SCORE"), _ rs.getAsStringByName( "NAME"), _ rs.getAsDoubleByName( "X"), _ rs.getAsDoubleByName( "Y"), _ rs.getAsDoubleByName( "LAT"), _ rs.getAsDoubleByName( "LONG")) i = i + 1 Loop While rs.moveNext findLocation = Locations Else findLocation = Nothing End IF End Function Class FoundLocation Public score Public label Public x Public y Public lat Public lon Sub New ( iscore, ilabel, ix, iy, ilat, ilon) score = iscore label = ilabel x = ix y = iy lat = ilat lon = ilon End Sub End Class