xml-line
This is a composite builder that constructs a line geometry. The coordinates of the line may be given via the data-string parameter or via point geometries.
builder type: composite: accepts point geometries.
geometry constructed: line geometry.
data parameters:
Data Name |
Value |
Required/Optional
|
data-string |
The string containing the coordinate data. Range: String |
Optional |
axis-order |
Indicates the axis order for a coordinate. Range: A permutation of the numbers 1..N, where N is the number of dimensions. Each number is separated by a comma “,”. Default: “1,2,...,N” |
Optional |
dimension |
The dimension of the coordinates. Range: String representing a positive integer, or the “implicit” literal, which forces the dimension to be automaticallly determined even if axis-order is specified. Default: When not specified the dimension will be automatically determined. |
Optional |
axis-separator |
The string separating each axis of a coordinate in the data-string. Range: String | “whitespace” this includes the tab, newline, and space characters. Default: “,” |
Optional |
coord-separator |
The string separating each coordinate in the data-string. Range: String Default: “whitespace” this includes the tab, newline, and space characters. |
Optional |
decimal |
The string representing the decimal point for each real number in the data-string. Range: String Default: “.” |
Optional |
coordinate-system |
Specifies the coordinate system name. If the expression sequence for the coordinate-system evaluates to the empty string, then the coordinate system for the feature being built will not be set. Range: String |
Optional |
demote-incomplete-geometry |
A line is incomplete if it doesn’t have at least two distinct points, if only one coordinate is given then the line geometry builder will halt on error, setting this optional parameter to true allows a point geometry to be constructed when only one coordinate is given. Range: false | true Default: false |
Optional |
allow-incomplete-geometry |
A line is incomplete if it doesn’t have at least two distinct points, setting this optional parameter to true allows a degenerate one coordinate line geometry to be constructed. Note that this parameter overrides the demote-incomplete-geometry parameter. Range: false | true Default: false |
Optional |
keep-duplicate-coordinates |
Consecutive duplicate coordinates coming from the data-string or from geometry points are not be discarded when this parameter is set to true. Range: false | true Default: false |
Optional |
name |
Specifies the geometry’s name. Range: String |
Optional |
The document below contains two different type of line elements that we wish to map into FME features:
lines.xml
<?xml version="1.0"?> <lines> <line1> 0.0 0.0 1.0 10.0 10.0 1.0 20.0 30.0 1.0 </line1> <line2 coords="50.5,50.4 30.8,15.2 0,0"/> </lines>
The following xfMap document uses the xml-line geometry builder:
xml_line.xmp
<?xml version="1.0"?> <!DOCTYPE xfMap SYSTEM "xfMap.dtd"> <xfMap> <feature-map> <mapping match="line1"> <feature-type> <literal expr="line1"/> </feature-type> <geometry activate="xml-line"> <data name="data-string"> <extract expr="."/> </data> <data name="dimension"> <literal exptr="3"/> </data> </geometry> </mapping> <mapping match="line2"> <feature-type> <literal expr="line2"/> </feature-type> <geometry activate="xml-line"> <data name="data-string"> <extract expr="@coords"/> </data> </geometry> </mapping> </feature-map> </xfMap>
When the lines.xml and xml_line.xmp documents are fed into the XML Reader the following FME features are output:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: line1'
Attribute: fme_geometry' has value fme_line'
Attribute: xml_type' has value xml_line'
Geometry Type: Line (2)
Number of Coordinates: 3 -- Coordinate Dimension: 3 -- Coordinate System: '
(0,0,1) (10,10,1) (20,30,1)
===========================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: line2'
Attribute: fme_geometry' has value fme_line'
Attribute: xml_type' has value xml_line'
Geometry Type: Line (2)
Number of Coordinates: 3 -- Coordinate Dimension: 2 -- Coordinate System: '
(50.5,50.4) (30.8,15.2) (0,0)
===========================================================================