xml-aggregate

The xml-aggregate geometry builder builds aggregate objects.

This builder does not require any data parameters, so the only way for it to build an aggregate geometry is from existing geometry objects. This means that before the xml-aggregate builder is deactivated, other geometry builders should have been activated and deactivated; moreover, their constructed geometries should have been passed to it.

builder type: composite - accepts any type of geometry

geometry constructed: aggregate

data parameters:

Data Name

Value

Required/Optional

xml_type

This data parameter applies only if an aggregate was constructed. This data parameter sets the xml_type for the feature under construction. Note that this xml_type may be overwritten by geometry builders or attribute rules from mapping rules that are activated before the one containing the activation of the current aggregate builder.

Range: xml_point | xml_line | xml_area | xml_aggregate

Default: xml_aggregate

Optional

keep-as-aggregate

When the value for this data parameter is set to “false” and the xml-aggregate geometry consists solely of one feature, then an aggregate geometry will not be constructed.

Range: false | true

Default: true

Optional

allow-empty-aggregate

This data parameter determines if an aggregate with zero components should be returned.

Range: true | false

Default: false

Optional
contains-individual-geometries

When the value for this data parameter is set to “true” then a flag will be set on the aggregate signaling that the aggregate is merely a placeholder containing individually named geometries; e.g., in a destination system each named geometry component may be interpreted as a separate geometry column in a table.

Range: false | true

Default: false

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

name

Specifies the geometry’s name.

Range: String

Optional

The following example shows how the xml-aggregate geometry builder is used in the xml_aggregate.xmp to construct a geometry that is an aggregate of point geometries. The previous, points1.xml, is used as the input XML document and is reproduced below for convenience:

points1.xml

<?xml version="1.0"?>
<points>
	<point name="myPoint" num="0">
		<color>
			<red>0.324</red>
			<green>0.233</green>
			<blue>0.596</blue>
		</color>
		<location x="10.0" y="0.0"/>
	</point>
	<point name="myPoint" num="1">
		<color>
			<red>0.874</red>
			<green>0.948</green>
			<blue>0.554</blue>
		</color>
		<location x="5.0" y="5.0"/>
	</point>
</points>

xml_aggregate.xmp

<?xml version="1.0?>
<!DOCTYPE xfMap SYSTEM "xfMap.dtd">

<xfMap>
	<feature-map>
		<mapping match="points">
			<feature-type> <literal expr="points"/> </feature-type>
			<!-- This geometry builder integrates all the 
				geometries that it receives into one aggregate 
				geometry -->
			<geometry activate="xml-aggregate">
		      <data name="xml_type">
					<literal expr="xml_point"/>
			   </data>				
       </geometry>
		</mapping>
	</feature-map>

	<feature-content-map>
		<mapping match="point">
			<geometry activate="xml-point">
				<data name="data-string">
					<extract expr="./location[@x]"/>
					<literal expr=","/>
					<extract expr="./location[@y]"/>
				</data>
			</geometry>
		</mapping>
	</feature-content-map>
</xfMap>

FME feature constructed:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: points'
Attribute: fme_geometry' has value fme_aggregate'
Attribute: xml_type' has value xml_point'
Geometry Type: Aggregate (512)
Total Number of Coords: 2 -- Coordinate Dimension: 2 -- Coordinate System: '
Number of Aggregate Parts: 2
---------------------------------------------------------------------------
Geometry Type: Point (1) -- Part Number: 0 -- Number of Coordinates: 1
(10,0)
---------------------------------------------------------------------------
Geometry Type: Point (1) -- Part Number: 1 -- Number of Coordinates: 1
(5,5)
===========================================================================