IMPORT CITIES Statement |
This statement converts GIS-formatted city data to GBFS data.
IMPORT CITIES [name = %name_col] FROM "path\src_file" WHERE condition;
name_col | Optional. A column within the source table containing the names of the cities. |
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. |
The following example imports city data from a table. The (fictional) table has a column 'NAM' that contains the names of the cities.
IMPORT CITIES [ name = dress(%NAM) ] FROM "nz_cities";
The following GBFS columns are available for population through the Alchemy IMPORT CITIES command.
Column | Description | Type | Length | Values |
NAME | The name of the city, used by the GeoCoder to find a location. | Text | Variable |
Tip |
---|
The city data imported by the IMPORT CITIES command is not used to draw features on the map, instead this column is used to aid the GeoCoder in finding a location. |
To import cities from CSV format text files, use the following format.
IMPORT CITIES [name = %name, geom = wkt(%point)] FROM "csv://src_file";
name | Optional. An expression referencing one or more column in the CSV source file. |
geom | A column of point data stored as well known text (WKT) in the CSV source file. |
city_label,city_data Telogis Town,POINT(-118.271425 34.371585)
Note |
---|
Note the formatting of our point. For Well Known Text, the location should be formatted as 'Longitude Latitude', reversing the conventional GeoBase standard of 'Latitude Longitude'. Note also the use of a space as a separator rather than a comma. |
The IMPORT CITIES statement required to import data from the example CSV file shown above is:
IMPORT CITIES [ name = %city_label, geom = wkt(%city_data) ] FROM "csv://mycsvfile.csv";
The 'city_label' column provides a name for each city. The 'city_data' column provides point data stored as WKT points.
Cities are used for geocoding purposes only and cannot be used to draw on a map, unlike POIs, polygons and streets.