Global Mapper Pro Coming Soon

How to use 'ATTR_EXISTS' and 'ATTR_MISSING'

Eric123Eric123 Posts: 38
edited August 28 in GM Script Language
Can someone share a script example with ATTR_EXISTS and ATTR_MISSING been used?

Answers

  • Eric123Eric123 Posts: 38
    Is it possible to change a Defined value to a different value when ATTR_EXISTS found an available attribute? 
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,328
    Hello,
    Eric123 said:
    Can someone share a script example with ATTR_EXISTS and ATTR_MISSING been used?
    Here is an example where all features that do not have an attribute called CLASS are moved to a new layer called "No Class Attr":
    EDIT_VECTOR MOVE_TO_NEW_LAYER=YES NEW_LAYER_NAME="No Class Attr" \
     ATTR_MISSING="CLASS"

    Eric123 said:
    Is it possible to change a Defined value to a different value when ATTR_EXISTS found an available attribute? 
    If you mean that you want to change the value of a variable that was set up using DEFINE_VAR, then the answer is no. You can do something like add a new attribute or change the value of the attribute that you searched for using ATTR_EXISTS.

    Cheers,
    Bob
  • Eric123Eric123 Posts: 38
    Thanks. bmg_bob. I was trying to see how I could use the 'ATTR_EXISTS' with the 'IF' statement to change a value where an attribute is present in a shapefile. Confuse on how the IF statement can be used in GM.
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,328
    Hello,

    ATTR_EXISTS and ATTR_MISSING can only be used with the EDIT_VECTOR command. The scripting language does not have a way to query whether or not a particular attribute is present in a shapefile layer. 

    Cheers,
    Bob
  • Eric123Eric123 Posts: 38
    Thanks bmg_bob for the reply
Sign In or Register to comment.