Skip to main content
Question

Create Geometry from String in an XML


Forum|alt.badge.img

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.

5 replies

tomfriedl
Contributor
Forum|alt.badge.img+13
  • Contributor
  • April 21, 2017

Extract coords from line:


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • April 21, 2017

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.

 

 

 


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • April 21, 2017

have a look at the geometryreplacer transformer set to GML.

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


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • April 21, 2017
itay wrote:

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>

takashi
Influencer
  • April 21, 2017
itay wrote:

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.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings