Question

XML Templater Grouping

  • 10 September 2019
  • 2 replies
  • 5 views

Badge +9

Hello all,

I am trying to create an XML file that has a structure where there is a single plan, non-spatial, that has one or more polygon features(parcels). Each polygon feature is made up of multiple line which in turn is made up of multiple points.

 

The plan is a database table without any geometry so I have done a feature merge using the bounding box of the parcels. I then chop the parcels into points and lines and feed the three outputs into the XML templater, using the plan as the root feature.

What I am trying to acheive is the following

 

Plan

Parcel 1

Line 1

Line 2

Line 3

Line 4

Parcel 2

Line 5

Line 6

Line 7

Line 8

 

Point 1

Point 2

...

Point n

 

but what is coming out is a list of all lines rather than just the lines for the individual parcel.

 

Plan

Parcel 1

Line 1

Line 2

Line 3

Line 4

Line 5

Line 6

Line 7

Line 8

Parcel 2

Line 1

Line 2

Line 3

Line 4

Line 5

Line 6

Line 7

Line 8

Line 5

Line 6

Line 7

Line 8

 

Point 1

Point 2

...

Point n

 

I have tried grouping but that then seems to have affects on other features.

Attached is my XML workspace.

Any tips would be greatly appreciated.

 

Regards

 

Dean


2 replies

Userlevel 2
Badge +17

Hi @deanhowell, if "parcelid" is unique ID for each parcel and lines derived from a parcel have the same "parcelid", this expression groups lines by "parcelid".

...
    <lines>
    {fme:process-features("LINES", "parcelid", fme:get-attribute("parcelid"))}
    </lines>
...

See here to learn more how to use the "fme:process-features": XQuery Functions

Badge +9

Hi @deanhowell, if "parcelid" is unique ID for each parcel and lines derived from a parcel have the same "parcelid", this expression groups lines by "parcelid".

...
    <lines>
    {fme:process-features("LINES", "parcelid", fme:get-attribute("parcelid"))}
    </lines>
...

See here to learn more how to use the "fme:process-features": XQuery Functions

Thanks @takashi, that worked a treat. I must have tried a hundred variations yesterday :) thanks again.

Reply