9.15. Fixed-Width Text Converter¶
The fixed-width text converter handles text files that follow a fixed format.
9.15.1. Configuration¶
The fixed-width converter supports the following configuration keys:
Key |
Required |
Type |
Description |
|---|---|---|---|
|
yes |
String |
Must be the string |
9.15.2. Field Configuration¶
The fields element in a fixed-width converter supports additional keys:
Key |
Description |
|---|---|
|
The starting offset of a field. |
|
The width/length of a field. |
9.15.3. Transform Functions¶
The transform element supports referencing the fixed-width substring through $0. Each column will initially
be a string, so further transforms may be necessary to create the correct type. See Transformation Functions for
available functions.
9.15.4. Example Usage¶
Suppose you have a SimpleFeatureType that consists of a sole geometry: *geom:Point:srid=4326. Your
input data is a fixed-width file where the latitude and longitude are defined as 2 digit numbers, following
a single digit prefix:
14555
16565
The following configuration defines an appropriate converter for transforming this into our SimpleFeatureType:
geomesa.converters.example = {
type = "fixed-width",
id-field = "uuid()",
fields = [
{ name = "lat", start = 1, width = 2, transform = "$0::double" },
{ name = "lon", start = 3, width = 2, transform = "$0::double" },
{ name = "geom", transform = "point($lon, $lat)" }
]
}