Setting Projection for Script
kp50
Global Mapper User
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.
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
-
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 -
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 -
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 -
Hello Bob,
Thank you, that did the trick. I will apply this method to the variables of other commands.
Karl
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website