Skip to main content

Given an XML of the form

<event>
<LineGeometry srid="4326"> x_1,y_1;x_2,y_2;x_3,y_3;....</LineGeometry>
<OtherProperty> foo</OtherProperty>
...
</event>

I would like to create the line geometry for this event.

While there are myriad of examples that match this almost completely, I always got stuck at some point. I mostly got stuck because the number of x/y pairs is not bounded, and so I coudn't find out how to properly split the LineGeometry-string into a list and then create coordinates from it.

I might want to add that I started using FME (2013 SP3) yesterday, so apologies if there is a very simple way for this that I should have seen.

Extract coords from line:


I would one of the xml tools to extract or flatten the xml, depending on what else you want to do with the feature, such that you end up with an attribute LineGeometry containing just the coordinates. and then convert that to WKT, and replace the geometry.

 

 

 


have a look at the geometryreplacer transformer set to GML.

Tip try to upgrade tour FME ....if possible


have a look at the geometryreplacer transformer set to GML.

Tip try to upgrade tour FME ....if possible

to structure your data as gml you would need to replace the ; with a space

 

and wrap it with the gml tags.

 

<gml:LineString>
<gml:coordinates>x1,y1 x2,y2 x3,y3</gml:coordinates>
</gml:LineString>

have a look at the geometryreplacer transformer set to GML.

Tip try to upgrade tour FME ....if possible

If you use GML encoding, replace both , and ; with a space.

 

 


Reply