Skip to main content
Question

Choosing contour of same interval

  • September 10, 2013
  • 8 replies
  • 40 views

Forum|alt.badge.img
I would like to know if there is any process to pick contour of same interval. 

 

ie.) i have a contour  file  in DGN format of 1m interval (1,2,3,4,5,6,7,8,9,10, etc) from this contour i need to pick only (2,4,6,8,10,12, etc) .

 

 

8 replies

david_r
Celebrity
  • September 10, 2013
Hi,

 

 

you could use the modulo operator in the ExpressionEvaluator in conjunction with a tester for this.

 

 

In the ExpressionEvaluator, use something like:

 

 

@int(@Value(CONTOUR_HEIGHT)) % 2

 

Then use the Tester to check if the result of the ExpressionEvaluator = 0. The features that pass have a CONTOUR_HEIGHT divisible by 2.

 

 

David

takashi
Evangelist
  • September 10, 2013
Hi Vijai,

 

 

This is a kind of programmatic issue. I like it :-)

 

When both of n and m are positive integer values, "n % m" returns the remainder of n divided by m.

 

0 % 2 --> 0

 

1 % 2 --> 1

 

2 % 2 --> 0

 

3 % 2 --> 1

 

and so on.

 

 

So you can select contours of the same interval using a Tester transformer with such an expression.

 

If the contour feature has the elevation value as an attribute named "elevation" and you want to get 2m interval lines, for example, specify the Tester parameter like this:

 

Left Value: =@Value(elevation)%2   <-- use the Arithmatic Editor to set this.

 

Operator: =

 

Right Value: 0

 

 

Just be aware that % operator assumes the operands are positive integer values. If the elevation values may be decimal numbers, consider converting them to integer values using AttributeRounder, @int function etc.

 

 

Takashi

fmelizard
Safer
Forum|alt.badge.img+19
  • Safer
  • September 10, 2013
Hi,

 

How about testing for ends with 2,4,6 etc?

davideagle
Contributor
Forum|alt.badge.img+21
  • Contributor
  • September 14, 2013
Just use the AttributeParity transformer and filter off your even contours:

 

 

http://fmepedia.safe.com/articles/Samples_and_Demos/AttributeParity

 


Forum|alt.badge.img
  • Author
  • September 18, 2013
Hi David,

 

 

Can you send me a snap showing this.

 

Vijai

Forum|alt.badge.img
  • Author
  • September 18, 2013
Hi All,

 

 

Many thanks for your help , i found the answer to my question,  i used the following applications ,

 

ElevationExtractor,SubstringExtractor,AttributeClassifier,ExpressionEvaluator,Tester .

 

 

Vijai Lal

 

 


davideagle
Contributor
Forum|alt.badge.img+21
  • Contributor
  • September 22, 2013
There you go:

 

 

 


dos_gis
Contributor
Forum|alt.badge.img+3
  • Contributor
  • March 24, 2014
I'm looking to expand on this and select contours at different intervals (1,2,5,10,20,25,50,100,250,500). I'm using AttributeValueMapper.  Would the FMOD function work for this?

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