Global Mapper Pro Coming Soon

How to export vector files with polygons filled with certain color - using scripts?

OddBobOddBob Global Mapper UserPosts: 13Trusted User
edited June 2012 in Technical Support
Hi,

First: Thank you for providing Global Mapper! A really brilliant application! I'm using GM 13.2.

I have a lot of MapInfo MIF/MID-files containing polygons. I need to save these off in the same format – but where the polygons should be filled with a certain color and the polygon line should not be displayed.

I guess the script should go like this – but I cannot figure out how to use the EDIT_VECTOR command for this:
IMPORT FILENAME="D:\Folder\input.mif" TYPE=MAPINFO
EDIT_VECTOR
EXPORT_VECTOR FILENAME=" D:\Folder\output.mif" TYPE=MAPINFO
I can perform this in the GM GUI as follows:
  • Load file
  • Overlay Control Center – Options – Area Styles – Use same style for all features
  • Fill Pattern: Solid, RGB(255,130,0)
  • Border style: NULL
  • Apply
  • Export Vector Format – MapInfo MIF/MID - OK

Is there any support for this in the scripts?

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2012
    Yes you can do that via script. To see how load your file, setup the style as you want, then save a workspace. Look at that workspace in a text editor to see how to set the area style. Here is an example:

    /************ DEFINE LAYER STYLE *************/
    DEFINE_LAYER_STYLE NAME="AREA_STYLE" TYPE="AREA"
    LayerStyle=1
    Type=0
    AreaStyleForAll=4286709825,0,81,2097152,0.0
    FontForAll=~0~534799372~0.000~0~0
    END_DEFINE_LAYER_STYLE

    IMPORT FILENAME="D:\Folder\input.mif" TYPE=MAPINFO AREA_STYLE_NAME="AREA_STYLE"

    You don't need the EDIT_VECTOR for this operation, the style is set with the IMPORT command.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • OddBobOddBob Global Mapper User Posts: 13Trusted User
    edited June 2012
    Hi, this did not seem to help.

    I've got the script as below. Could it be that I need to set that the layer features should be included during the export? Like you do in the GUI by setting MapInfo Option - Add Feature Type (LAYER) Attribute to Exported Files(s)?

    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    UNLOAD_ALL

    /************ DEFINE LAYER STYLE *************/
    DEFINE_LAYER_STYLE NAME="AREA_STYLE" TYPE="AREA"
    LayerStyle=2
    Type=0
    InterpolateNumeric=0
    AttrVal=*
    AttrAreaStyle=4286709889,0,209,0,0.0
    AttrFont=~0~534799372~0.000~0~0
    END_DEFINE_LAYER_STYLE

    IMPORT FILENAME="input.mif" TYPE=MAPINFO
    EXPORT_VECTOR FILENAME="output.mif" TYPE=MAPINFO
    UNLOAD_ALL

    FORCE_EXIT
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2012
    You missed part of it, add AREA_STYLE_NAME="AREA_STYLE" to your IMPORT command in your script so the defined area style is added to the file on import.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • OddBobOddBob Global Mapper User Posts: 13Trusted User
    edited June 2012
    Aha!

    Yes, now it works!

    Thank you so much for the help!

    The tip regarding exploring the workspace file waas nice. Maybe you need to add more info in the script guide reagarding this.
Sign In or Register to comment.