Add -T option to coerce the types of feature attributes

This commit is contained in:
Eric Fischer
2017-04-17 15:20:03 -07:00
parent 65ee2cf0a5
commit 178b5d0054
9 changed files with 275 additions and 43 deletions
+5
View File
@@ -129,6 +129,11 @@ resolution is obtained than by using a smaller _maxzoom_ or _detail_.
* `-x` _name_ or `--exclude=`_name_: Exclude the named properties from all features
* `-y` _name_ or `--include=`_name_: Include the named properties in all features, excluding all those not explicitly named
* `-X` or `--exclude-all`: Exclude all properties and encode only geometries
* `-T`_attribute_`:`_type_ or `--attribute-type=`_attribute_`:`_type_: Coerce the named feature _attribute_ to be of the specified _type_.
The _type_ may be `string`, `float`, `int`, or `bool`.
If the type is `bool`, then original attributes of `0`, `false`, `null`, or the empty string become `false`, and otherwise become `true`.
If the type is `float` or `int` and the original attribute was non-numeric, it becomes `0`.
If the type is `int` and the original attribute was floating-point, it is rounded to the nearest integer.
### Dropping a fixed fraction of features by zoom level