Skip to main content

I am using FME 2021.2 with a PostGIS reader and an XML Templater and XML Formatter to write an XML output file. This works fine, but the coordinate X/Y output appears in scientific notation as below:

 <Vertex>

  <X>2.010340655257836E6</X>

  <Y>6.7378739141772166E6</Y>

 </Vertex>

I have tried all kinds of different things, however I can't get FME to format the output they way I want it like below:

    <Vertex>

      <X>2010340.655257836</X>

      <Y>6737873.914177217</Y>

    </Vertex>

This code fragment in the XML Templater works:

<Vertex>

 <X>{geom:get-x-coord()}</X>

 <Y>{geom:get-y-coord()}</Y>

</Vertex>

This does not:

<Vertex>

 {

 let $l := geom:get-x-coord()

 let $r := @Format(%.2f,$l)

 return $r

 }

</Vertex>

I can't figure out how to pass the X value above into the format function, or find another workaround.

Hi @sdfghjk7777​ 

Please try the following in the XMLTemplater

<Vertex>
    <X>{xs:decimal(geom:get-x-coord())}</X>
    <Y>{xs:decimal(geom:get-y-coord())}</Y>
</Vertex>

This returns decimal notation coordinates in my tests. I hope this information helps.


Thank you, that solved my problem. You guys are fantastic. I am just not familiar enough with all the xsd syntactical elements in combination with using the XML Templater.


Reply