Parameters:
map - the initialized Map object
nFinder - the number of a given finder
args - an array of parameters
For the USA map you can use the following constants:
ADDRESS = 0
INTERSECTION = 1
ZIP = 2
CITY = 3
COUNTY = 4
AREACODE = 5
COORDINATES = 6
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:
String args[] = {"380 New York St", "92373", "Redlands", "CA"};
FoundLocation locs[] = findLocation( map, ADDRESS, args);
Other examples:
String args[] = {"Redlands", "CA"};
FoundLocation locs[] = findLocation( map, CITY, args);
String args[] = {"Redlands", ""};
FoundLocation locs[] = findLocation( map, CITY, args); (results equal Redlands, CA and Redlands, CO)
String args[] = {"Orange"};
FoundLocation locs[] = findLocation( map, COUNTY, args);
String args[] = {"New York St", "W Park Ave", "", "Redlands", "CA"};
FoundLocation locs[] = findLocation( map, INTERSECTION, args);
or
FoundLocation locs[] = findLocation( map, INTERSECTION, new String[]{"New York St", "W Park Ave", "", "Redlands", "CA"});
Returns:
An array of the FoundLocation objects, or null if the location is not found (see the FoundLocation object)
// Finders (USA map) static final int ADDRESS = 0; static final int INTERSECTION = 1; static final int ZIP = 2; static final int CITY = 3; static final int COUNTY = 4; static final int AREACODE = 5; static final int COORDINATES = 6; // Finders (North American map) static final int NA_US_ADDRESS = 0; static final int NA_CA_ADDRESS = 1; static final int NA_US_INTERSECTION = 2; static final int NA_CA_INTERSECTION = 3; static final int NA_US_ZIP = 4; static final int NA_US_ZIP3 = 5; static final int NA_CA_POSTALCODE = 6; static final int NA_US_CITY = 7; static final int NA_CA_CITY = 8; static final int NA_US_COUNTY = 9; static final int NA_AREACODE = 10; static final int NA_COORDINATES = 11; public FoundLocation[] findLocation( Map map, int nFinder, String[] args) throws RMException, IOException { if( args.length < 1) return null; FinderList Finders = map.getFinders(); Finder Finder = Finders.getFinder( nFinder); for(int i=0; i < Finder.getFieldCount(); i++) { String fValue = i >= args.length ? "" : args[i]; Finder.setFieldValue(i, fValue); } Recordset rs = Finder.find(); if( isRSEmpty( rs)) return null; FoundLocation locs[] = new FoundLocation[rs.getRecordsCount()]; int i = 0; do { locs[i++]=new FoundLocation( rs.getAsIntByName("SCORE"), rs.getAsStringByName( "NAME"), rs.getAsDoubleByName( "X"), rs.getAsDoubleByName( "Y"), rs.getAsDoubleByName( "LAT"), rs.getAsDoubleByName( "LONG") ); } while( rs.moveNext()); return locs; } public boolean isRSEmpty(Recordset rs) throws RecordsetException { return rs == null || rs.getRecordsCount() == 0; } public class FoundLocation { public int score; public String label; public double x; public double y; public double lat; public double lon; FoundLocation (int cscore, String clabel, double cx, double cy, double clat, double clon) { score = cscore; label = clabel; x = cx; y = cy; lat = clat; lon = clon; } }