Skip to main content
Question

Slope calculator

  • December 15, 2014
  • 5 replies
  • 23 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

fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • December 16, 2014
Hi,

 

You can always try to contact Safe about it.

 

Itay

takashi
Influencer
  • December 16, 2014
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

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • December 16, 2014
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...

Forum|alt.badge.img
  • December 17, 2014
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

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