Question

Slope calculator

  • 15 December 2014
  • 5 replies
  • 11 views

Hello,

 

 

I'm using the custom transformer "slope calculator", developped by Safe and which can be downloaded at http://fmestore.safe.com/transformers/SlopeCalculator.htm

 

 

It happens from time to time that one of the triangles produced in the slope calculator is so small that the _nz and _length values are null, thus producing a fatal error (attribute_creator_6 is traying to make a division through zero...).

 

 

We managed to overcome this limitation by testing the "sloped" area of the produced triangle and adding a tester passing features having an area > 0.000001. This does not alter much the transformer as, at the end, it uses the average slope value.

 

 

I think it would be really good to have something like that by default in this custom transformer... or am I completely wrong ?

 

 

If yes, is there a way to contribute ?

 

 

Best regards

 

 

Michael

 

 

5 replies

Userlevel 3
Badge +13
Hi,

 

You can always try to contact Safe about it.

 

Itay
Userlevel 2
Badge +17
Hi,

 

 

I looked at the implementation of the transformer.

 

The expression in the AttributeCreator_6 will fail if the length is equal to zero (vertical face) , as you mentioned.

 

To avoid the error caused by zero dividing, you can replace the expression with this.

 

-----

 

3.14159/2.0-@atan2(@abs(@Value(_nz)),@abs(@Value(_length)))

 

-----

 

 

Takashi
Badge +3
Things falling within or out of tolerance are a fact any analyser should keep his/her eyes open for.

 

 

Like when building some algorithm, you need to take into account the range of inputs and possible outputs. Failing to do so will eventually yield an zero division or else encounter...
Badge
Just passed on the info to my colleague Dmitri. Hopefully he'll be able to upload a fixed version.

 

 

Mark
Hi everbody,

 

 

Thanks a lot for all your answers, I really appreciated !

 

 

I just hope we can make this transformer even better then it already is ;-)

 

 

By the way, the fmestore is a really great ressource for FME !

 

 

Thanks again

 

 

Michael

Reply