Global Mapper v25.0

Setting Projection for Script

kp50
kp50 Global Mapper User
edited September 2014 in Technical Support
I have a few thousand AutoCAD drawing files (DWG) that I need to create individual Elevation Grid files (DXF) for. Each time I load a DWG file into GM I am prompted to define the Projection. Is there a way of setting the projection semi-permanently so this Projection prompt does not come up on each import?
The script I prepared to do these conversions includes a LOAD PROJECTION command (to a defined PRJ file) but the prompt still comes up each time.

Comments

  • bmg_bob
    bmg_bob Global Mapper Programmer
    edited August 2014
    Hello kp50,

    Thank you for using Global Mapper. Have you tried using the PROJ parameter on your IMPORT command? PROJ=<full_path_to_prj> should work in your case.

    Cheers,

    Bob
  • kp50
    kp50 Global Mapper User
    edited September 2014
    Hello Bob,
    Thanks for your help. I tried that but evidently not effectively. I received a Scripting Result of-
    WARNING: Unknown command <PROJ="D:\GlobalMapper\213044Projection.prj"> ignored.
    This is my script-
    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    UNLOAD_ALL
    // Loop over all DEM files in a folder and convert them
    DIR_LOOP_START DIRECTORY="D:\GlobalMapper\Process\" FILENAME_MASKS="*.DWG" RECURSE_DIR=NO

    // Import a DWG file from above defined directory and define projection
    IMPORT FILENAME="%FNAME_W_DIR%"
    PROJ="D:\GlobalMapper\213044Projection.prj"

    // Create Elevation Grid from 3D Vector Data.
    GENERATE_ELEV_GRID vERTICAL_UNITS=FEET ELEVATION_GRID-DISTANCE_CRITERIA=20.2 \
    IGNORE_ZERO_ELEVATIONS=YES
    // Export Elevation Grid format in DXF Point file.
    EXPORT_ELEVATION TYPE="DXF_POINT" ELEV_UNITS="FEET" RESAMPLING=BICUBIC_INTERPOLATION \
    SPATIAL_RES=4.0,4.0. FILENAME="%DIR%%FNAME_WO_EXT%_4PTS.DXF" GEN_PRJ_FILE=YES
    // Unload the loaded data
    UNLOAD_ALL
    // End the loop
    DIR_LOOP_END

    I have been using Global Mapper on-line scripting support and have signed up for the Introduction to Scripting on Sept 25.
    I would like to be producing before then. If you have further direction, links or advise I would be grateful.
    Thank you,
    kp50
  • bmg_bob
    bmg_bob Global Mapper Programmer
    edited September 2014
    Hello kp50,

    PROJ= is a parameter on the IMPORT command. It looks like you have it on a separate line, and Global Mapper is interpreting it as a separate command. (Thus the "unknown command" message.) It needs to be on the same line as the IMPORT, or on a new line where the previous line ends with "\<newline>", as is the case with the EXPORT_ELEVATION command in your script.

    Try:

    IMPORT FILENAME="%FNAME_W_DIR%" PROJ="D:\GlobalMapper\213044Projection.prj"

    Cheers,

    Bob
  • kp50
    kp50 Global Mapper User
    edited September 2014
    Hello Bob,
    Thank you, that did the trick. I will apply this method to the variables of other commands.
    Karl