Assign new symbology to a directory of files
George Chandeep Corea
Global Mapper UserTrusted User
I haven't used GMS in over an year and I just need to do the following
Cycle through directory for tab files (mapinfo)
assign the symbology (for example)
Cycle through directory for tab files (mapinfo)
assign the symbology (for example)
GM_TYPE=Contour LINE_WIDTH=2 LINE_COLOR=RGB(128,64,0) LINE_STYLE=SolidHow do I select by attribute? how do I then set the above for each attribute type?
Answers
-
You can use DIR_LOOP_START and DIR_LOOP_END to cycle through your directory. For each file in the directory, you will need to IMPORT it, then run EDIT_VECTOR and EXPORT commands to produce the updated file. On your EDIT_VECTOR command, use the COMPARE_STR parameter to select by attribute, and ATTR_VAL and STYLE_ATTR parameters to set your style attributes.
The scripting reference is here. -
Thanks. The symbology works fine but I am getting projection issues. The output data does not open in the same space as the original when the files are opened in mapinfo. It is fine in GM when I define the projection on opening the files. Is something in my code creating this issue. It is fine when I manually update the style and export the file.
Also how do I delete the extra GM_Layer field that's created?GLOBAL_MAPPER_SCRIPT VERSION=1.00 / Creative Commons 3.0 by George Corea (coreagc@gmail.com) / Created for Mangoesmapping DEFINE_PROJ PROJ_NAME="UTM_ZONE-55_GDA_94_AUSTRALIAN_GEODETIC_1994" Projection UTM Datum GDA94 Zunits NO Units METERS Zone -55 Xshift 0.000000 Yshift 0.000000 Parameters END_DEFINE_PROJ LOAD_PROJECTION PROJ_NAME="UTM_ZONE-55_GDA_94_AUSTRALIAN_GEODETIC_1994" /DIR_LOOP_START DIRECTORY=f:\ FILENAME_MASKS="*.tab" /IMPORT FILENAME="%FNAME_W_DIR%" IMPORT FILENAME="pt000332_contour.tab" EDIT_VECTOR COMPARE_STR="Contour_Type!=minor" STYLE_ATTR="LINE_STYLE=SOLID" STYLE_ATTR="LINE_WIDTH=2" STYLE_ATTR="LINE_COLOR=RGB(255,192,0)" EDIT_VECTOR COMPARE_STR="Contour_Type=minor" STYLE_ATTR="LINE_STYLE=SOLID" STYLE_ATTR="LINE_WIDTH=1" STYLE_ATTR="LINE_COLOR=RGB(255,192,0)"
/EXPORT_VECTOR FILENAME="f:\%FNAME_WO_EXT%.tab"EXPORT_VECTOR FILENAME="pt000332_contour2.tab" TYPE=Mapinfo INC_LAYER_ATTR=NO INC_ELEV_ATTR=YES UNLOAD_ALL
/DIR_LOOP_END
Categories
- 13K All Categories
- 5.8K Features Discussion
- 350 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 652 GM Script Language
- 56 User Scripts
- 115 GPS Features
- 421 Projection Questions
- 835 Raster Data
- 1.4K Vector Data
- 6.7K Support
- 181 Announcement and News
- 939 Bug Report
- 562 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 579 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 244 How I use Global Mapper
- 110 Global Mapper Forum Website

