DWG to SHP batch - don't ask user for projection
jamiefinney
Global Mapper User
Hi i'm trying to write a script to batch a folder of DWG's to SHP's
The script works with the exception that it asks the user to set the projection of the export.
How can i automate this step so there is no user intervention required.
thanks in advance
this is what i have so far - i couldn't see how to put this into a code block so here's hoping it does this automatically.
*********************
GLOBAL_MAPPER_SCRIPT VERSION=1.00
/Define Projection
DEFINE_PROJ PROJ_NAME="BRIT_GRD_OSGB36_BEST_TRANSFORM"
Projection GREATBRITAIN_GRID
Datum OSGB_1936
Zunits NO
Units METERS
Xshift 0.000000
Yshift 0.000000
Parameters
END_DEFINE_PROJ
/Setup directory to loop
DIR_LOOP_START DIRECTORY="G:\DWG To SHP\" FILENAME_MASKS="*.dwg" RECURSE_DIR=NO PROJ_NAME="BRIT_GRD_OSGB36_BEST_TRANSFORM"
/Wildcard to keep file names
IMPORT FILENAME="%FNAME_W_DIR%"
/LOAD_PROJECTION PROJ_NAME="BRIT_GRD_OSGB36_BEST_TRANSFORM"
LOAD_PROJECTION PROJ="BRIT_GRD_OSGB36_BEST_TRANSFORM"
/Export Vector to SHP
EXPORT_VECTOR FILENAME="G:\DWG To SHP\SHP\%FNAME_WO_EXT%.shp" TYPE=SHAPEFILE GEN_PRJ_FILE=YES
/Unload all files
UNLOAD_ALL
/Finish loop and end script
DIR_LOOP_END
The script works with the exception that it asks the user to set the projection of the export.
How can i automate this step so there is no user intervention required.
thanks in advance
this is what i have so far - i couldn't see how to put this into a code block so here's hoping it does this automatically.
*********************
GLOBAL_MAPPER_SCRIPT VERSION=1.00
/Define Projection
DEFINE_PROJ PROJ_NAME="BRIT_GRD_OSGB36_BEST_TRANSFORM"
Projection GREATBRITAIN_GRID
Datum OSGB_1936
Zunits NO
Units METERS
Xshift 0.000000
Yshift 0.000000
Parameters
END_DEFINE_PROJ
/Setup directory to loop
DIR_LOOP_START DIRECTORY="G:\DWG To SHP\" FILENAME_MASKS="*.dwg" RECURSE_DIR=NO PROJ_NAME="BRIT_GRD_OSGB36_BEST_TRANSFORM"
/Wildcard to keep file names
IMPORT FILENAME="%FNAME_W_DIR%"
/LOAD_PROJECTION PROJ_NAME="BRIT_GRD_OSGB36_BEST_TRANSFORM"
LOAD_PROJECTION PROJ="BRIT_GRD_OSGB36_BEST_TRANSFORM"
/Export Vector to SHP
EXPORT_VECTOR FILENAME="G:\DWG To SHP\SHP\%FNAME_WO_EXT%.shp" TYPE=SHAPEFILE GEN_PRJ_FILE=YES
/Unload all files
UNLOAD_ALL
/Finish loop and end script
DIR_LOOP_END
Comments
-
Hi,
What version of Global Mapper are you using? To wrap your script in a code block, use the # button in the editor.
I see a couple of things:
1) the DIR_LOOP_START command does not have a PROJ_NAME parameter.
2) When you split a command over multiple lines, each line (except the last one) must end with "\<newline>". I don't see those in your script, but that might be due to the fact that you didn't use a code block.
Can you tell which command is prompting for the projection?
Cheers,
Bob
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