xml-area
The xml-area geometry builder constructs area geometries. The coordinates given to the data-string parameter must form a single closed polygon (first and last coord must equal).
Notice that all of the <data> elements are optional; that is, they do not need to appear in the <geometry> element. When this is the case, this builder cannot build an area geometry unless the XML Reader at some point passes other area geometries (either simple polygons, a donuts, or an aggregate of areas) to it; the builder geometrically integrates all of these area geometries into one area geometry, for example, if 3 area geometries (say 3 simple polygons: 1 outer shell, and 2 holes) are given to it in any arbitrary order, the builder will geometrically integrate the 3 areas into one donut geometry.
builder type: composite - but it only accepts and closed-curve geometries
geometry constructed: area 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 |
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 |
An area is incomplete if it does not have at least three distinct points. If only one or two coordinates are given then the area 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 and a line geometry to be constructed when only two coordinates are given. Range: false | true Default: false |
Optional |
aggregate-to-multi |
Specifies whether an aggregate of areas should be converted into a multi area. Range: false | true Default: false |
Optional |
name |
Specifies the geometry’s name. Range: String |
Optional |
example 1, building simple polygons
The following xml_area_simple_polygon.xmp document instructs the XML Reader to output two FME features that are simple closed polygons from the input polygons.xml document.
polygons.xml
<?xml version="1.0"?> <polygons> <polygon>60.0,60.0 80.0,60.0 80.0,80.0 60.0,80.0 60.0,60.0</polygon> <polygon>40.0,40.0 50.0,40.0 50.0,50.0 40.0,50.0 40.0,40.0</polygon> </polygons>
xml_area_simple_polygon.xmp
<?xml version="1.0"?> <!DOCTYPE xfMap SYSTEM "xfMap.dtd"> <xfMap> <feature-map> <mapping match="polygon"> <feature-type> <literal expr="simple polygon"/> </feature-type> <geometry activate="xml-area"> <data name="data-string"> <extract expr="."/> </data> </geometry> </mapping> </feature-map> </xfMap>
FME features constructed:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: simple closed polygon'
Attribute: fme_geometry' has value fme_polygon'
Attribute: xml_type' has value xml_area'
Geometry Type: Polygon (4)
Number of Coordinates: 5 -- Coordinate Dimension: 2 -- Coordinate System: '
(60,60) (80,60) (80,80) (60,80) (60,60)
===========================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: simple closed polygon'
Attribute: fme_geometry' has value fme_polygon'
Attribute: xml_type' has value xml_area'
Geometry Type: Polygon (4)
Number of Coordinates: 5 -- Coordinate Dimension: 2 -- Coordinate System: '
(40,40) (50,40) (50,50) (40,50) (40,40)
===========================================================================
example 2, building donuts
The donuts.xml document contains an element representing a donut. In this example we show how to use the xml-area geometry builder, in the xml_area_donut.xmp, to make the XML Reader output an FME donut feature. The xfMap document has two feature mapping rules matching the <donut> and <polygon> elements. Note that the <outershell> and <hole> elements are ignored by the mapping rules; this distinction is not necessary for the construction of the area-donut geometry, since the xml-area builder geometrically determines which polygon is an outer boundary or a hole.
The xml-area geometry builder that is activated in the feature mapping rule matching the <donut> element just waits for geometry builders to passed it area geometries so that it can geometrically integrate them into one donut feature.
donuts.xml
<?xml version="1.0"?> <donuts> <donut> <outer-shell> <polygon>0.0,0.0 100.0,0.0 100.0,100.0 0.0,100.0 0.0,0.0</polygon> </outer-shell> <hole> <polygon>60.0,60.0 80.0,60.0 80.0,80.0 60.0,80.0 60.0,60.0</polygon> </hole> <hole> <polygon>40.0,40.0 50.0,40.0 50.0,50.0 40.0,50.0 40.0,40.0</polygon> </hole> </donut> </donuts>
xml_area_donut.xmp
<?xml version="1.0"?> <!DOCTYPE xfMap SYSTEM "xfMap.dtd"> <xfMap> <feature-map> <mapping match="donut"> <feature-type> <literal expr="donut"/> </feature-type> <!-- Note that no data parameters are required for the xml-area geometry builder since its whole purpose is to sit and wait for other builders to hand it area geometries. --> <geometry activate="xml-area"/> </mapping> </feature-map> <feature-content-map> <mapping match="polygon"> <!-- This xml-area geometry builder uses the content of the polygon element to construct a single closed polygon area geometry. When this geometry builder de-activates the area geometry is handed over to the top geometry builder on the stack (in this case it is the xml-area that was activated in the mapping rule above. --> <geometry activate="xml-area"> <data name="data-string"> <extract expr="."/> </data> </geometry> </mapping> </feature-content-map> </xfMap>
FME feature constructed:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: donut'
Attribute: fme_geometry' has value fme_donut'
Attribute: xml_type' has value xml_area'
Geometry Type: Donut (8)
Total Number of Coords: 15 -- Coordinate Dimension: 2 -- Coordinate System: '
Number of Shells: 3
Outer Shell -- Part Number: 0 -- Number of Coordinates: 5
(0,0) (100,0) (100,100) (0,100) (0,0)
Inner Shell -- Part Number: 1 -- Number of Coordinates: 5
(40,40) (50,40) (50,50) (40,50) (40,40)
Inner Shell -- Part Number: 2 -- Number of Coordinates: 5
(60,60) (80,60) (80,80) (60,80) (60,60)
===========================================================================