Replace elevation value

suzukisuzuki Global Mapper UserPosts: 6
 how can i do elevation value  from -3 to +3 , reassign to Zero
 the value between -3 ~ +3 will output as zero
 the formula follow didn't work
 i need the correct GM Script language sample

Best Regard.


Best Answer

  • geomanniegeomannie Global Mapper User Posts: 171
    Answer ✓
    Nested conditional?



  • suzukisuzuki Global Mapper User Posts: 6
    Dear Geomannie :
    that's really great solution!!
    thanks a lot , 


  • JeffH@BMGJeffH@BMG Global Mapper Developer Posts: 269Trusted User
    Great answer, Geomannie. Thanks!

    You can also accomplish the same thing using the formula: if( elevation < 3 and elevation > -3. 0, elevation ), or equivalently, if ( elevation < 3 & elevation > -3, 0, elevation )


  • JeffH@BMGJeffH@BMG Global Mapper Developer Posts: 269Trusted User
    By the way, I don't believe that a formula like "if(-3<B1<3,0,B1)" works in Excel either, which is more or less what the Global Mapper formula calculator tries to emulate. The formula will parse fine (both in Excel and in Global Mapper), but  it won't be interpreted in the way that's intended. Essentially, the way that "-3 < B1 < 3" is interpreted is by first evaluating whether B1 is greater than -1, which yields a Boolean result (0 or 1 under the hood), and then evaluating whether that Boolean result is < 3 (which it always is). 

    Modifying the grammar to handle this type of construct could probably be done, but it's a little tricky, and then it also wouldn't work in the same way that Excel formulas do.

    Best regards,

Sign In or Register to comment.