localize Function |
When data is not available in tabular form the localize function may be used to locate (and then name) a geometry. The localize function is often used within an IMPORT STREETS statement to populate the L_REGION and R_REGION fields of a street.
localize(expr, %geom);
expr | The name of a localizer, created with the CREATE LOCALIZER statement |
%geom | Required. An Alchemy identifier used to reference the geometry |
For a localizer covering n region levels, localize will return an array with 2*n elements containing the region names for the left- and right-hand sides of the geometry. See the example, below.
First we create a nested localizer using the CREATE LOCALIZER statement:
CREATE LOCALIZER NESTED "myRegions" ON (%sbrb_name, %town_name, %cnty_name) FROM ("path_to\suburbs", "path_to\towns", "path_to\counties");
We then use the localize function to populate the region fields of the street:
IMPORT STREETS { $regnames = localize("myRegions", %geom); } [ ... L_REGION 1 = $regnames[0], R_REGION 1 = $regnames[1], L_REGION 2 = $regnames[2], R_REGION 2 = $regnames[3], ... ] FROM "path_to\street_data";
Caution |
---|
The region types must be in ascending order (most specific first) when working with a localizer. In this example the suburb (smallest and most specific region type) is specified first, followed by the town and then the county. A smaller region number indicates a more specific region. |
lookup - used to create a lookup table (analogous to a Map-Key structure), which may be used to identify regions from tabular data