IMPORT REGIONS Statement |
This statement converts GIS-formatted region timezone data to GBFS data.
IMPORT REGIONS [id = %id_col, parent_id = %parent] FROM "path\src_file" WHERE condition;
Nomenclature
id_col | A column of unique numerical identifiers in the source table. |
parent | The ID of the containing (parent) region. For example, '0' for state. |
path\src_file | Specifies the path and file containing the GIS shapefile data. |
condition | A logic expression that is satisfied by a subset of the data in path\src_file. This expression, along with the WHERE keyword, is optional. |
IMPORT REGIONS [ ID = %ID, PARENT_ID = %PARENT, NAME = %NAME, TIMEZONE = lookup(timezone, %ID) ] FROM "myShapefile";
The following GBFS columns are available for population through the Alchemy IMPORT REGIONS command.
Column | Description | Type | Length | Values |
NAME | The name of the region. | Text | Variable | |
TIMEZONE | The region's timezone. | Text | Variable | See TIMEZONE Columns |
In order to use the TIMEZONE imported in the import regions statement, you will need to know how to access information stored with the regions. This is accomplished using the region_value_stack(id, column) function. The region_value_stack function gets the values of the specified column for a region.
Values are returned as an array with result[0] being the lowest level region where column is non-null and result[n] the highest. For example, if country and state both have timezone data stored but the county does not, then result[0] will be the state's timezone, and result[1] will be the country's.