Maptitude GISDK Help |
This macro has been deprecated. Please use Data.Finder Class and Data.Geocoder Class
Creates or adds to a point geographic file by locating records using a Streets file or a Location index.
RunMacro("GISDK Locate View", array options)
An option is required unless listed as optional:
Option |
Type |
Contents |
ViewSet |
String |
The records to be located, either "view|set" or "point layer name|set" |
ID |
String |
Input view ID field |
Address |
String |
Street address field |
Address2 |
String |
Optional second address field |
PostalCode |
String |
Optional postal code field |
City |
String |
Optional city field |
State |
String |
Optional state field |
StreetLayer |
String |
Name of the Street layer, or null if using the Caliper US Streets file |
LocationIndex |
String |
Optional name of the Location index file; if null, locate using StreetLayer |
OutputDatabase |
String |
Name for the new geographic file, or name of the geographic file for an existing point layer |
OutputLayer |
String |
Layer name for the new geographic file, or layer name for an existing point layer |
OutputStandard |
String |
Name of the file that can store the standardized output table; can be dBASE (dbf), fixed-format binary (bin), fixed-format ASCII (asc), or Excel (xls); for more information, see "Creating a Report File" in the Maptitude Help |
AddressRules |
String |
Name of the street address standardization rules file |
CityRules |
String |
Name of the "City, State" standardization rules file |
OffsetDistance |
Real |
Optional offset distance from street; if null, use the default offset |
OffsetUnits |
String |
The name of the offset distance units (plural), such as Feet or Meters; if null, use the default offset units |
Map |
String |
Optional name of the map to which to add the layer |
AddLayer |
Boolean |
Optional; True to add a new layer to the map, otherwise False (default) |
AlternateZips |
Integer |
1 to look up nearby ZIP Codes, 0 by default; works only for US numeric postal codes, and uses altzip.bin |
For a newer way to locate records, see Data.Geocoder Class.
In Caliper Script, you must set the Geocode UI to be the alternate interface by calling SetAlternateInterface("geocode") before running this macro. When calling these macros from VBScript, add "geocode" after the macro name and before the first argument.
The Locate View macro can be used to geocode a dataview or a selection set using a Location index. It will work by either creating or adding to a standard (.dbd) point geographic file.
If a Location index is not indicated, the macro will geocode the records using a Streets layer and the Locate by Address methodology.
If a Streets layer is used for geocoding, it must be present in a map.
If the Locate View macro creates a new standard (.dbd) point geographic file, the input dataview will be joined to it permanently, and the point geographic file can be added to a map. You can then determine which records were not located by calling SelectByQuery() with the "Select * Where Longitude = null" query.
When using a Location index, the Location index does not need to be in memory. The Locate View macro will take care of getting the Location index, geocoding the records, and then dropping the Location index.
For AddressRules you can specify the following rule files, which are shipped with the geocode UI and are located in the program folder:
caliper.rul: Normal U.S. and Canadian addresses
caliper1.rul: U.S. addresses with hyphenated numbers
str_num.rul: Street followed by number (e.g., "Via Nazionale 123")
num_str.rul: Number followed by street, with no American abbreviations
Unless specified in the options array, this macro will use the default geocoding settings on the Locating tab in the User Preferences dialog box.
The matching method can be set programmatically by setting the value of the shared integer variable d_strictness where:
1 = Very strict, requiring an exact match
2 = Normal, the default
3 = Not strict
Here is an example of a macro for setting this variable:
Macro "Set Matching Method" (value)
shared d_strictness
d_strictness = value
endMacro
// Locate using a Streets layer
// Open customer.dbf and the Hartford.cdf street layer in the Tutorial folder
Macro "Test GISDK Locate View"
view_set = "CUSTOMER|"
options = { {"ViewSet" , view_set},
{"ID", "ID"},
{"Address", "ADDRESS"},
{"PostalCode" , "ZIP"},
{"StreetLayer" , "Hartford Streets"},
{"OutputDatabase", "C:\\temp\\SelectionCustomers.dbd"},
{"OutputLayer", "Located Customers"},
{"OutputStandard", "C:\\temp\\SelectionStd.bin"},
{"AddressRules", "caliper.rul"},
{"CityRules", "cityzip.rul"}}
ShowArray(options)
SetAlternateInterface("geocode")
error_msg = RunMacro("GISDK Locate View", options)
Return(error_msg)
endMacro
// Locate using a Location index
// Open customer.dbf and the Hartford.cdf street layer in the Tutorial
// folder and create a location index file hartford.idx in that folder using the
// Tools-Locate-Index Locations command before running this macro
Macro "Test GISDK Locate View"
view_set = "CUSTOMER|"
folder = RunMacro("G30 Tutorial Folder")
options = { {"ViewSet" , view_set },
{"ID", "ID"},
{"Address", "ADDRESS"},
{"PostalCode" , "ZIP"},
{"StreetLayer" , "Hartford Streets"},
{"LocationIndex", folder + "Hartford.idx"},
{"OutputDatabase", folder + "SelectionCustomers.dbd"},
{"OutputLayer", "Located Customers"},
{"OutputStandard", folder + "SelectionStd.bin"},
{"AddressRules", "caliper.rul"},
{"CityRules", "cityzip.rul"}}
ShowArray(options)
SetAlternateInterface("geocode")
error_msg = RunMacro("GISDK Locate View", options)
Return(error_msg)
endMacro
©2025 Caliper Corporation | www.caliper.com |