What's the best method to confirm user's intended units?

kbelliskbellis Global Mapper UserPosts: 518Trusted User
This didn't work, but it gets the idea across as to what I need to do in order to make sure calculations downstream end up in the user's intended units.

// Confirm users intended units

DEFINE_VAR NAME="CHECK_PLANAR_UNITS" PROMPT="YES" PROMPT_TEXT="Should coordinate attributes be expressed in feet or meters (case sensitive)?"

IF COMPARE_STR="%CHECK_PLANAR_UNITS%=feet"
    DEFINE_VAR NAME="UNITS_MULTIPLIER" FORMULA="3.280833333333" DEFINE_VAR NAME="UNITS_MULTIPLIER" FORMULA="1"
END_IF
What's the best method to confirm user's intended units?

Best Answer

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,973
    Answer ✓
    Hello,

    This should work:
    IF COMPARE_STR="%CHECK_PLANAR_UNITS%=feet"
        DEFINE_VAR NAME="UNITS_MULTIPLIER" VALUE="3.280833333333" 
    ELSE
    DEFINE_VAR NAME="UNITS_MULTIPLIER" VALUE="1"
    END_IF 
    Cheers,
    Bob

Answers

  • kbelliskbellis Global Mapper User Posts: 518Trusted User

    Here, this may be a little easier on the eyes:

  • kbelliskbellis Global Mapper User Posts: 518Trusted User
    Consider a Vanilla Plugin for syntax highlighting in this forum:

    So that Code doesn't have to look so awful :)
    // Confirm users intended units

    DEFINE_VAR NAME="CHECK_PLANAR_UNITS" PROMPT="YES" PROMPT_TEXT="Should coordinate attributes be expressed in feet or meters (case sensitive)?"

    IF COMPARE_STR="%CHECK_PLANAR_UNITS%=feet"
        DEFINE_VAR NAME="UNITS_MULTIPLIER" FORMULA="3.280833333333" DEFINE_VAR NAME="UNITS_MULTIPLIER" FORMULA="1"
    END_IF 


  • kbelliskbellis Global Mapper User Posts: 518Trusted User
    bmg_bob said:
    Hello,

    This should work:
    IF COMPARE_STR="%CHECK_PLANAR_UNITS%=feet"
        DEFINE_VAR NAME="UNITS_MULTIPLIER" VALUE="3.280833333333" 
    ELSE
    DEFINE_VAR NAME="UNITS_MULTIPLIER" VALUE="1"
    END_IF 
    Cheers,
    Bob
    Yes, I think it will, THANK_YOU!
    I just need get the downstream calcs to agree ;)
  • kbelliskbellis Global Mapper User Posts: 518Trusted User
    Just to follow up; that work perfectly Bob. Thank you very much for this help!!
Sign In or Register to comment.