Global Mapper v24.0

Difficulty selecting base+data file in CALC_VOLUMES

Ellie
Ellie Global Mapper User
edited March 2015 in GM Script Language
Hi there,

We are looking at automating our volumes calculating but are hitting a snag at CALC_VOLUMES. Both toe to toe (no base) and surface to surface (base) csvs come out identical and it appears the script is only calculating a toe to toe... on the base, ignoring the actual data file completely.

We have tried using layer groups, to no avail. When we calculate manually (as in without the script), being able to select base and data files in the dialogue, it works fine.

The below is part of a greater script, which has a bit of projection/attr definition above this point. I can send the complete .gms and .bat, as well as some example files if requested, as well as what ballpark volume they should give (we are trying to switch to Global Mapper from a different program).
Before the point below in the script, we have set up a gmw with an elevation grid (this month's data) and have digitised on this our boundaries. We are looking to generate both a surface-to-surface csv and a toe-to-toe csv.

This is (the relevant area of) what we have:
LOG_MESSAGE ***** Loading Digitised data *****
EMBED_SCRIPT FILENAME="%area%_DIGITISE_%month%.gmw" SKIP_UNLOAD_ALL=NO


LOG_MESSAGE ***** Hiding Contours *****
SET_LAYER_OPTIONS FILENAME="%area%_CONTOURS" HIDDEN=YES


SET_LAYER_OPTIONS FILENAME="%area%_GRID" HIDDEN=NO


SET_LAYER_OPTIONS FILENAME="*bounds" HIDDEN=NO




LAYER_LOOP_START FILENAME="*bounds"


    SET_LAYER_OPTIONS FILENAME="%LAYER_DESC%" AREA_STYLE_NAME="SPILES" LAYER_GROUP="%LAYER_DESC%"   *******
    
    DEFINE_VAR NAME="BOUNDSFILE" VALUE="%LAYER_DESC%" REPLACE_STR="_bounds="
    
//    EXPORT_RASTER FILENAME="%BOUNDSFILE%_emb_%month%.tif" TYPE=GEOTIFF QUALITY=85 \
//        SPATIAL_RES_METERS=0.50 GEN_WORLD_FILE=YES LAYER_BOUNDS="%LAYER_DESC%" \
//        LAYER_BOUNDS_EXPAND="20.0" INC_VECTOR_DATA=YES EXPORT_LAYER="%area%_GRID" \
//        EXPORT_LAYER="%LAYER_DESC%" FILL_GAPS=YES


    DIR_LOOP_START DIRECTORY="BASES" FILENAME_MASKS="%area%*.dxf" RECURSE_DIR=NO
    
        IF COMPARE_STR="%FNAME_WO_EXT%=*%BOUNDSFILE%*"
        
            SET_LAYER_OPTIONS FILENAME="%area%_GRID" LAYER_GROUP="%LAYER_DESC%"   *******
            
            //move bounds file to correct group
            //SET_LAYER_OPTIONS FILENAME="%FNAME_WO_EXT%" LAYER_GROUP="%LAYER_DESC%"
            
            hide area_GRID so it does not affect the base grid generation
            SET_LAYER_OPTIONS FILENAME="%LAYER_DESC%<sub>%area%_GRID" HIDDEN=YES
                    
            LOG_MESSAGE ***** Import base %FNAME_WO_EXT% *****
            IMPORT FILENAME="%FNAME_W_DIR%" TYPE=DXF LAYER_DESC="%FNAME_WO_EXT%_IMPORT" \
                PROJ_NAME="%PROJECTION%" PROMPT_IF_TYPE_UNKNOWN=NO
        
            LOG_MESSAGE ***** Generate Elevation file %FNAME_WO_EXT%_GRID *****
            GENERATE_ELEV_GRID FILENAME="%FNAME_WO_EXT%_IMPORT" LAYER_GROUP="%LAYER_DESC%" \
                ELEV_UNITS=METERS SPATIAL_RES_METERS=0.5 LAYER_DESC="%FNAME_WO_EXT%_GRID" \
                GRID_TYPE=ELEVATION PROJ_NAME="%PROJECTION%" 
                
            LOG_MESSAGE ***** unload base %FNAME_WO_EXT%_IMPORT and show %area%_GRID *****
            UNLOAD_LAYER FILENAME="%FNAME_WO_EXT%_IMPORT" 
            
            SET_LAYER_OPTIONS FILENAME="%BOUNDSFILE%_bounds<sub>%area%_GRID" HIDDEN=NO
            
            SORT_LAYERS LAYER_GROUP="%LAYER_DESC%" MAP_ORDER="MOVE_END"
            //SORT_LAYERS FILENAME="" MAP_ORDER=LAYER_DESC_DEC
            //SORT_LAYERS LAYER_GROUP="%LAYER_DESC%" MAP_ORDER=LAYER_DESC_DEC
            
            SAVE_WORKSPACE FILENAME="%area%_VOLUMES_%month%.gmw"
            
            //FORCE_EXIT
            
            LOG_MESSAGE ***** Calculating Volumes for %BOUNDSFILE%_bounds using basefile %FNAME_WO_EXT% *****
            
            CALC_VOLUMES FILENAME="%BOUNDSFILE%_bounds" ADD_VOLUME_ATTRS=YES \
                OUTPUT_FILENAME="%BOUNDSFILE%_base.csv"
                    
            LOG_MESSAGE ***** Hide Layer group %FNAME_WO_EXT% *****
            SET_LAYER_OPTIONS FILENAME="%FNAME_WO_EXT%<sub>*_GRID" HIDDEN=YES
        END_IF
    DIR_LOOP_END
    CALC_VOLUMES FILENAME="%BOUNDSFILE%_bounds" ADD_VOLUME_ATTRS=NO \
        OUTPUT_FILENAME="bob\%BOUNDSFILE%_toe.csv"        
    
    EXPORT_VECTOR FILENAME="%BOUNDSFILE%_%month%.dxf" EXPORT_LAYER="<FEATURE_LAYER><sub>%BOUNDSFILE%_bounds" \
        TYPE=DXF EXPORT_DXF_LABELS="YES"
    
LAYER_LOOP_END
...what are we doing wrong??

We are also encountering an issue in the EXPORT_RASTER section above, but we believe we have found a way around it (ensure vector in separate file for each area, otherwise it tries to save offscreen vector data and promptly dies.)

Unrelated, and out of curiosity, is it possible to append to csv files internally? I'm putting something together to do this automatically externally, but if someone else has already done the work... :p


(Edited to add: is there a way to tag another forum user in a post so he can get notifications at the same time I do?)

Comments

  • Ellie
    Ellie Global Mapper User
    edited March 2015
    For those who may also have this issue:

    I ended up emailing the support team and got the following response:
    Thank you for that additional information, and apologies for the delay in getting back to you. I have spoken with a member of our development team about this issue. Currently, via scripting, users are only able to calculate volume between a fixed elevation and a surface, not between surfaces. I have filed a request to add support for this via scripting, since it currently can be done using the application interface. A member of our support or development teams will contact you if support is added for this.
    I hope this clarifies things. Please let me know if I may be of further assistance.

    Fingers crossed they add support for it soon as it would be a super powerful tool.
Sign In or Register to comment.