CALC_ATTR_FORMULA

I'm trying to do an operation with two fields, one existing DSM and the ELEVATION which is renamed as DTM in the previous line.
I do not get any result after running this part of the script. Am I doing something wrong?
This piece of code is inserted into a dir loop and is part of a script that performs other operations without problems.

IMPORT FILENAME="%FNAME_W_DIR%" TYPE=SHAPEFILE

EDIT_VECTOR FILENAME="%FNAME_W_DIR%" ATTR_TO_RENAME="ELEVATION=DTM"
CALC_ATTR_FORMULA NEW_ATTR="ALTURA" CALC_MODE="NUMERIC" FORMULA="DSM - DTM"

EXPORT_VECTOR FILENAME="%DIR%%FNAME_WO_EXT%_Int.shp" TYPE=SHAPEFILE SHAPE_TYPE=POINTS GEN_PRJ_FILE=YES GEN_3D_FEATURES=NO INC_ELEV_ATTR=NO

Comments

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,218
    Have you tried splitting the command into two separate ones: first, an EDIT_VECTOR command to rename the attribute, then a second EDIT_VECTOR command to perform the CALC_ATTR?
  • falqnfalqn Global Mapper User Posts: 123Trusted User
    Bob, but CALC_ATTR_FORMULA is an independent command like EDIT_VECTOR. There is no need to use EDIT_VECTOR before calculating formula.
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,218
    falqn said:
    Bob, but CALC_ATTR_FORMULA is an independent command like EDIT_VECTOR. There is no need to use EDIT_VECTOR before calculating formula.
    You are correct.  I must have read through the script too quickly.  @josegeomatico, if you are still watching this thread, please post a small script and data file that illustrate the problem.  Also, what do you mean by, "I do not get any result"?  Was an output file exported?  Did the EDIT_VECTOR and CALC_ATTR_FORMULA work correctly?  Did you get an error message or warning?

Sign In or Register to comment.