Skip to main content
Hi,

 

 

Let me explain what I want to do: I have a ".obj" file, and a ".xml" file which contains some metadata. The coordinates in the ".obj" file are in a local reference frame. Thus, to get them in a projected SRS, I need to translate them using some values that I can parse in the ".xml" file. What I want to do is:

 

  1. Read ".obj" and ".xml" file
  2. Compute convex (concave) hull of the geometries in the ".obj" file
  3. Translate the hull with values read from the ".xml" file
  4. Save the translated geometry in a ".shp" and force its EPSG with a value read in the ".xml" file
In the ".xml" file, the EPSG is in the tag <SRS> (e.g. <SRS>EPSG:2154</SRS>) and the origin of the coordinates (the transltion I want to apply) is in the tag <SRSOrigin> (e.g. <SRSOrigin>652367,6862971,0</SRSOrigin>). These tags are enclosed in a ModelMetadata tag.

 

 

To do the translation, here is what I do:
  1. Read ".obj" and ".xml" files
  2. Remove unused attributes (optional)
  3. Split the SRSOrigin attribute with an AttributeSplitter in a _coord list ("," separator and expose 3 _coords elements
  4. Use a StringFormatter to convert _coord{} elements to floating point values (format string: f)
  5. Use a 3DAffiner on the output of a HullReplacer with A=_coord{0}, F=_coord{1} and K=_coord{2} (all other elements to 0)
When I run the translation, I get the following error:

 

 

3DAffiner: Unable to convert @Affine parameter A value `' to a floating point value

 

 

If I use a logger on the StringFormatter, here is what I get:

 

Attribute(encoded: utf-16): `SRS' has value `EPSG:2154'

 

Attribute(encoded: utf-16): `SRSOrigin' has value `652367,6862971,0'

 

Attribute(32 bit integer) : `Source Brancher 0.BranchingFactory.Count' has value `1'

 

Attribute(32 bit integer) : `Source Feature Router.BranchingFactory.Count' has value `1'

 

Attribute(encoded: utf-8) : `_coord{0}' has value `652367.000000'

 

Attribute(encoded: utf-8) : `_coord{1}' has value `6862971.000000'

 

Attribute(encoded: utf-8) : `_coord{2}' has value `0.000000'

 

 

To me, it seems that _coord list elements are not well converted to floating point values ("encoded: utf-8").

 

Could you please help me on how to fix the problem?

 

And please, could you also tell me how to force output EPSG to the oneread in the ".xml" file?

 

 

Hope you could help.

 

 

Best regards

 

 

Olivier
Hi Olivier,

 

 

FME basically treats all the attribute value as character string, and converting between string and numeric value will be performed automatically when it's needed; I don't think the encoding caused the error.

 

 

According to the error message, there seems to be an empty string as coordinate value somewhere. The empty string cannot be converted to a numeric value.

 

 

Takashi
I guessed the situation from the error message: 3DAffiner: Unable to convert @Affine parameter A value `' to a floating point value

 

 

I think the message means a value was empty string.

 

To check whether there are empty coordinate values, you can use the Tester with the settings like this:

 

Pass Criteria: One Test (OR)

 

Left Value  |  Operator

 

_coord{0}  |  Attribute Is Empty

 

_coord{1}  |  Attribute Is Empty

 

_coord{2}  |  Attribute Is Empty
If I use a Tester on _coord{0} as you suggested, and log the result, it goes through the "failed" port. So, attribute is neither empty nor null ....
Cannot see exactly what happened...

 

According to your first post, I guess you are sending output features from the HullReplacre to the 3DAffiner. Do those features have "_coord{}" list as attribute?
Here is a screenshot of the workbench:

 

 


The error reason clarified. That is, the feature from the HullReplacer does not have "_coord{}" list.

 

If you need to perform 3D affine against the concave feature from the HullReplacer based on "_coord{}" of the feature from the AttributeSplitter, consider merging "_coord{}" to the concave feature before inputting to the 3DAffiner.

 

The FeatureMerger transformer can be used to do that.
Thanks Takashi! I also had to add an AttributeCreator to create a join attribute.
Glad to know you got a solution.

 

 

If you are using FME 2013 SP2 or later, you can specify a constant value to the "Join On" of the FeatureMerger. Maybe this functionality can be used instead of creating new attribute with the AttributeCreator.

 

For your information.

Reply