Global Mapper v25.0

Create a fixed surface elevation over entire area


Is there a way to use GENERATE_ELEV_GRID or alternative to generate a surface with a fixed elevation? I would like to create a 0m surface to be able to measure the volume of ponds within a CLIP_COLLAR_POLY. I have been using GENERATE_ELEV_GRID with a FILENAME of some known contours but I have to modify ELEV_OFFSET each time manually. Would like to try and do this without any manual intervention.



  • sjf
    sjf Global Mapper User

    Can't you just generate a grid and set the elevation to zero (Z=0) using the analysis grid calculator?

  • Hi,

    Thanks for the feedback. If i use GENERATE_ELEV_GRID i have to reference a filename such as a contour layer. I dont see the funcion name you are referring to to set an elevation to Z=0.

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    What you can do is use load the areas that you want to calculate the volumes of, then use the CALC_VOLUMES script command ( with something like the following:


    That should add volume attributes (relative to the base elevation of 0) for each area in the file.



    Global Mapper Guru

  • Thanks for the feedback. CALC_VOLUMES works for the currently loaded terrain data. So i would add the CALC_VOLUMES line after the terrain data is generated. However, i see the following error:

    WARNING: There must be at least 3 unique locations with elevation values in order to triangulate and grid the data.

    Its not seeing the terrain surface to make the calculation.

    This is my code. I am using a shp file for the filename.


    Is there a way to force it to call the terrain surface layer?

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    Do you have a terrain layer loaded at the time you call CALC_VOLUMES? And is it visible in the script (i.e. either loaded by the script or you are running the script in the context of the main map view)?

    The error sounds like an issue calculating a terrain grid from 3D vector data. It's possible there is a bug in CALC_VOLUMES that is not doing this right. Is that warning message coming from the CALC_VOLUMES command or something before it?

  • The terrain layer is generated in a previous step in the code. I added the CALC_VOLUMES after this terrain layer is generated, but it is not visible in the main map view until the full script finishes. Is it possible to get the code to pause for x time and load to that point? I did try WAIT_FOR_COMPLETE but its only command line.

    I think SJFs comment is the way to go, i just dont know how to force a grid generation to z=0. The areas i have (from contours) are elevation other than 0, I was using GENERATE_ELEV_GRID with an ELEV_OFFSET="-xx" but i have to change xx manually each time.

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    Can you post your entire script as a .zip file? If you can provide data as well that would help.

    The generated terrain layer doesn't need to draw first to be available, you should be able to reference it by layer description once created.

    Here is a script that I created using an existing terrain layer and a GMP file with an area feature (a .shp is fine too) to calculate values for. It works fine for me:

    // Load terrain data

    IMPORT FILENAME="E:\Bugs\blue_springs_4_quads.dem"

    // Load area file

    IMPORT FILENAME="volume_area.gmp"

    // Calculate volumes



  • Ok, i have been battling with this, taken my computer out the bin twice, and come to the conclusion i have either made a schoolboy error or theres a bug.

    The CALC_VOLUMES route does not seem to read the correct surface. I cant even work out how the volumes are being caluclated as they dont correspond to manual calculations, even if i export and test in a different software. The numbers are way over. As a feature suggestion it would be good to specify the layer for calculation, just like CALC_VOLUME_BETWEEN_SURFACES. As it is now, there is no control over the terrain that CALC_VOLUMES is using.

    So what works for me is the CALC_VOLUME_BETWEEN_SURFACES function but my base layer (i.e. the volume areas) are not at z=0 as they were derived from contours at z=3.7. Another feature suggestion is to allow the comparison layer (i.e. LAYER2_FILENAME) to be forced to BASE_ELEVATION="0".

    So my only way is to generate an elevation grid and manually do an ELEV_OFFSET. In this way i have the following code.


    This generates my new layer "Water Surface 0m" at z=0. I can then use this in the CALC_VOLUME_BETWEEN_SURFACES.

    Going back to the original problem. this magic 3.7m is not fixed so i have to manually edit the ELEV_OFFSET each time.

    So my question is, how can i take the generated Contour_at_3.7m layer and force all elevations to z=0 without doing a manual offset in the GENERATE_ELEV_GRID command. I tried the SET_LAYER_OPTIONS but it wont remove elevations or fix to a value.

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    What you might do to make this work on pretty much any data is use ELEV_SCALE rather than ELEV_OFFSET. Set your scale to something tiny, like ELEV_SCALE="0.000000001" which would basically make everything be extremely close to zero.

    I have created a new todo item GM-13269 for allowing the specification of which terrain layers to use as input for the CALC_VOLUMES command.

    Which version of Global Mapper are you using? It is surprising that the CALC_VOLUMES command isn't working for you like it is for me.

  • I am using v23.0.1 (b112321)

    Nice trick with the ELEV_SCALE, worked a treat. Thanks for that!! Saved me a heap of time.