Beauty and Scripting in Global Mapper

I’ve always been a bit of a computer novice when it came to anything related to computer programming or scripting. I remember having to take a Pascal programming course in college and quickly realizing I was over my head. 

Then I found Global Mapper. I had previously heard a lot about this great GIS program that worked it’s magic with orthophotos quads and other imagery. No one ever mentioned it’s powerful ability to manipulate vector data in the most efficient and elegant ways. Even more surprising, no one ever mentioned it’s powerful scripting capabilities.

When looking at and using Global Mapper scripting, you quickly understand the rational and sense behind the scripting functions. Global Mapper scripting seamlessly allows you to traverse directories, searching for wild cards, apportioning datums and projections, copying and replacing attributes and splitting by attributes or polygons into separate and organized directories all while handling huge amounts of data across multiple data sets. It is amazingly simple to use and incredibly useful when dealing with multiple data sets. It is very sexy.

The scripting commands are laid out with full explanations (for a full list, you can review them here – http://www.bluemarblegeo.com/knowledgebase/global-mapper/ScriptReference.html). Most commands are easy to understand and many have examples. If you still don’t get it, their support is phenomenal.

Below is a simple Global Mapper script I put together. Can you figure out what I am trying to do?

GLOBAL_MAPPER_SCRIPT VERSION=1.00
UNLOAD_ALL

DIR_LOOP_START DIRECTORY=”C:\LANDGRID\STATE\SHAPE\NAD83\OH_STATE_GRID_SHAPE\” FILENAME_MASKS=”*.shp” RECURSE_DIR=YES

IMPORT FILENAME=”%FNAME_W_DIR%”

EDIT_VECTOR COMPARE_STR=”<Feature Type>=Grid Line” DELETE_FEATURES=YES
EDIT_VECTOR COMPARE_STR=”<Feature Name>=*°*” DELETE_FEATURES=YES
EDIT_VECTOR ATTR_TO_DELETE=”GM_LAYER”
EDIT_VECTOR ATTR_TO_DELETE=”GM_TYPE”
EDIT_VECTOR ATTR_TO_DELETE=”ISLAND_ARE”
EDIT_VECTOR ATTR_TO_DELETE=”SHAPE_LE_1″

EXPORT_VECTOR INC_ELEV_ATTR=NO SAVE_GRID_LINES=NO INC_LAYER_ATTR=NO SHAPE_TYPE=AREAS FILENAME=”%FNAME_W_DIR%” TYPE=SHAPEFILE GEN_PRJ_FILE=YES

UNLOAD_ALL
DIR_LOOP_END

One challenge I found was when my script was wrong. The script either runs and fails, or doesn’t start at all. You have to find the bug in your script. Sometimes, if you don’t have your wits about you, it can take a long time to find what you did wrong. Depending on brain space, something as simple as not including a “ can take twenty minutes to catch and find in a complex script.

The bottom line is that Global Mapper scripting will save some users days and weeks when it comes to processing data. In many cases, it can process data (easily and simply) that is very complex in other products that focus processing data. It is also a free inclusion (that has always been there) to the famous Global Mapper you probably already own.

Be the first to comment on "Beauty and Scripting in Global Mapper"

Leave a comment

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.