Global Mapper Pro

Way to automate "apply elevations from terrain"?

kryos
kryos Global Mapper User
edited March 2014 in GM Script Language
Hi everybody!

I am (still) using Globalmapper v12 and I am wondering if there is a way to batch-process some GPX-files of mine.

More in detail:
I have got a bunch of GPX-files and I have got a DEM with high resolution elevation data. What I am looking for is a way to automate the digitizer-function "Appy elevations from terrain layer to selected features". I know that i could mark all tracks at once and assign all values with only one click, but doing so I lose the ability to export every GPX into a separate file…they all get thrown into one "cumulative" GPX.

So I am wondering if you could create a Script that opens a GPX from a specific folder, assigns the new elevation data to the track and afterwards exports everything as a new GPX?

Thanks for your ideas and help!

Comments

  • global_mapper
    global_mapper Administrator
    edited January 2014
    If you script export to a 3D format, like perhaps a Shapefile with the GEN_3D_FEATURES=YES parameter added to the EXPORT_VECTOR command you can get per-vertex elevations added from the terrain. You can then load the Shapefile back in and export out to GPX.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • kryos
    kryos Global Mapper User
    edited January 2014
    Hi Mike,

    thanks for the reply. I already tried your suggestion but I get stuck at a crucial part:

    According to the scripting reference (Global Mapper Scripting Reference - Aerial View Of Address - Aerial House View) the option GEN_3D_FEATURES acts in the following manner:
    The elevation stored for each vertex/point will be the first of the following that is available:
    • The elevation associated with the vertex/point in question.
    • The elevation associated with the entire area/line/point being exported. For example, the elevation of a contour line or spot elevation.
    • The first elevation obtained by searching the loaded elevation layers at the position of the vertex/point.

    For my particular situation this means that the elevation is directly taken from the original GPX-File and NOT updated from terrain what I manually achieve by hitting "Appy elevations from terrain layer to selected features". I didn't find a way to delete the contained elevation info in the original GPX neither.

    Any more ideas how to accomplish this?

    Thanks!
  • global_mapper
    global_mapper Administrator
    edited January 2014
    Ah I see. If you export once with GEN_3D_FEATURES=NO that will strip the elevations from the file. You could then re-import that file, unload the GPX, then export again with GEN_3D_FEATURES=YES to get the elevations from the terrain.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • geonome
    geonome Global Mapper User
    edited March 2014
    Hi Mike,

    I'm looking to delete elevation as well however despite deleting the elevation field and disabling 3d features on export my new shapefile still contains the elevation field. I'm on GM v13.2. What am I doing wrong?

    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    UNLOAD_ALL

    IMPORT FILENAME="E:\_TRANSFER\2014\Forestry_Tasks\3D_From_TIN\Shape\Plots.shp"
    IMPORT FILENAME="E:\_TRANSFER\2014\Forestry_Tasks\3D_From_TIN\Tin\TIN1.asc"
    EXPORT_VECTOR FILENAME="E:\_TRANSFER\2014\Forestry_Tasks\3D_From_TIN\Shape\TIN1.shp" TYPE="SHAPEFILE" SHAPE_TYPE="POINTS" GEN_PRJ_FILE="YES" GEN_3D_FEATURES="YES"
    UNLOAD_ALL
    IMPORT FILENAME="E:\_TRANSFER\2014\Forestry_Tasks\3D_From_TIN\Shape\TIN1.shp"
    EDIT_VECTOR FILENAME="E:\_TRANSFER\2014\Forestry_Tasks\3D_From_TIN\Shape\TIN1.shp" ATTR_TO_RENAME="ELEVATION=TIN1"
    EDIT_VECTOR FILENAME="E:\_TRANSFER\2014\Forestry_Tasks\3D_From_TIN\Shape\TIN1.shp" ATTR_TO_DELETE="ELEVATION"
    EXPORT_VECTOR FILENAME="E:\_TRANSFER\2014\Forestry_Tasks\3D_From_TIN\Shape\TIN1_no_elev.shp" TYPE="SHAPEFILE" SHAPE_TYPE="POINTS" GEN_PRJ_FILE="YES" GEN_3D_FEATURES="NO"

    UNLOAD_ALL




    Ah I see. If you export once with GEN_3D_FEATURES=NO that will strip the elevations from the file. You could then re-import that file, unload the GPX, then export again with GEN_3D_FEATURES=YES to get the elevations from the terrain.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • global_mapper
    global_mapper Administrator
    edited March 2014
    Can you try the latest v15 trial from Global Mapper Downloads and see if that works? I recall a quirk with 3D points from Shapefiles in older versions that you couldn't delete the ELEVATION attribute.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • geonome
    geonome Global Mapper User
    edited March 2014
    Works on the most recent build. I'll have to see about getting the upgrade.

    Thanks Mike,
    Can you try the latest v15 trial from Global Mapper Downloads and see if that works? I recall a quirk with 3D points from Shapefiles in older versions that you couldn't delete the ELEVATION attribute.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
Sign In or Register to comment.