GeoJSON (Geographic JavaScript Object Notation) Writer Parameters
The character set encoding in which the GeoJSON text will be written. If a character set is not specified, the GeoJSON text will be written in the UTF-8 character set.
Specifies whether or not the GeoJSON writer should preface the JSON text with a byte order marker to indicate the endianness of the Unicode text. The default value is No.
The value of this parameter controls the structure of the GeoJSON file produced by this writer. The options are:
- Single FeatureCollection object containing all features – The writer will put all features into one FeatureCollection object. This will lose feature type information if the writer has more than one feature type.
- Array of FeatureCollection objects - one per feature type – The writer will output a JSON array which contains one FeatureCollection for each feature type. Note that while each FeatureCollection is a valid GeoJSON object, the array as a whole is not a standard compliant GeoJSON value.
- Object with feature type names as keys, FeatureCollection objects as values – The writer will output a JSON object. The keys in the object will be feature type names, and the values will be a FeatureCollection object containing the corresponding features. As with the array option, the object as a whole is not a standard compliant GeoJSON value.
Specifies whether the writer outputs an “id” member at the feature level using the value of the feature’s id attribute. If a feature has no id attribute, the “id” member is omitted for that feature. The default value is Yes.
Specifies whether the writer should produce output with nested objects and arrays, or a flat structure where attributes are written as simple key/value pairs.
- When set to Yes (the default), attribute names that include dots or list notation (for example, my_object.value or my_object.list{}) are written as nested JSON objects or arrays.
- When set to No, attributes are written as flat key/value pairs using their full names as keys (for example, “my_object.int_value”).
Formatting Parameters
The formatting of the output JSON file.
- Linear – The entire JSON document is output on one line. This option produces the smallest possible JSON files.
- Pretty Print – The JSON document will contain additional whitespace characters, making it much more human-readable.
This parameter controls the indentation style in the JSON document, and is enabled when Formatting Type is Pretty Print. The indentation style can use either tab characters, or a variable number of space characters.
Spatial
Coordinate systems may be extracted from input feature data sources, may come predefined with FME, or may be user-defined. FME allows different output and input coordinate systems, and performs the required coordinate conversions when necessary.
If a coordinate system is specified in both the source format and the workspace, the coordinate system in the workspace is used. The coordinate system specified in the source format is not used, and a warning is logged. If a source coordinate system is not specified in the workspace and the format or system does not store coordinate system information, then the coordinate system is not set for the features that are read.
If a destination coordinate system is set and the feature has been tagged with a coordinate system, then a coordinate system conversion is performed to put the feature into the destination system. This happens right before the feature enters into the writer.
If the destination coordinate system was not set, then the features are written out in their original coordinate system.
If a destination coordinate system is set, but the source coordinate system was not specified in the workspace or stored in the source format, then no conversion is performed. The features are simply tagged with the output system name before being written to the output dataset.
For systems that know their coordinate system, the Coordinate System field will display Read from Source and FME will read the coordinate system from the source dataset. For most other input sources, the field will display Unknown (which simply means that FME will use default values). In most cases, the default value is all you'll need to perform the translation.
You can always choose to override the defaults and choose a new coordinate system. Select More Coordinate Systems from the drop-down menu to open the Coordinate System Gallery.
Changing a Reprojection
To perform a reprojection, FME typically uses the CS-MAP reprojection engine, which includes definitions for thousands of coordinate systems, with a large variety of projections, datums, ellipsoids, and units. However, GIS applications have slightly different algorithms for reprojecting data between different coordinate systems. To ensure that the data FME writes matches exactly to your existing data, you can use the reprojection engine from a different application.
To change the reprojection engine, Select Workspace Parameters > Spatial > Reprojection Engine. In the example shown, you can select Esri (but the selection here depends on your installed applications):
- The coordinate systems file coordsys.db in the FME installation folder contains the names and descriptions of all predefined coordinate systems.
- Some users may wish to use coordinate systems that do not ship with FME, and in those cases, FME also supports custom coordinate systems.
- Learn more about Working with Coordinate Systems in FME.
The writer will use the value of this parameter to limit the number of decimal digits printed for each coordinate.
Valid values range from 1 to 15. The default value gives sub-millimeter accuracy when writing WGS84 coordinates. A lower number of digits can dramatically reduce the size of the output file when writing out a large number of coordinates.
This parameter has no effect on attribute values that contain floating point numbers.
Geometry
- Yes (default) – Area and donut geometries will be converted to a "right-hand" orientation (that is, outer boundaries will be in a counterclockwise orientation and inner boundaries will be in a clockwise orientation).
- No – These geometries will be written out in their existing orientation.
By default, the GeoJSON writer will reproject all features to the WGS84/EPSG:4326 coordinate system.
Setting this parameter to No will disable this automatic reprojection, and feature geometries will be written in the coordinate system they had when arriving at the writer.
Features with no coordinate system will be assumed to already be in the WGS84 coordinate system.