Assign new symbology to a directory of files

George Chandeep Corea
George Chandeep Corea Global Mapper UserTrusted User
edited December 2015 in Vector Data
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)
GM_TYPE=Contour
LINE_WIDTH=2
LINE_COLOR=RGB(128,64,0)
LINE_STYLE=Solid

How do I select by attribute? how do I then set the above for each attribute type?

Answers

  • bmg_bob
    bmg_bob Global Mapper Programmer
    Answer ✓
    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.
  • George Chandeep Corea
    George Chandeep Corea Global Mapper User Trusted User
    edited December 2015
    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
  • bmg_bob
    bmg_bob Global Mapper Programmer
    Answer ✓
    Projection issues being discussed here.