Thursday, January 14, 2010

Edit Global Mapper's workspace file with a text editor

Global Mapper can use workspace files (with .gmw extension) to store map displays, projection, raster data layers, elevation data layers, as well as vector layers. If you create any new point, line or polygon vector features with the digitizing tools, the digitized data layers e.g. lakes (as shown in the screenshot below) are also stored in the workspace file.

If you open up the workspace file in a text editor e.g. Notepad, you would find that it is actually a text file containing a series of Global Mapper scripting commands, as shown below.

The workspace file is really a text script file that you can edit to add in your own scripting commands. What you can do is up to your imagination.

For example, you can put in the EXPORT_VECTOR script command to export out the digitized vector data layers as ESRI shape files. You can even write some sophisticated script automate the process to run for many workspace files at one go.

In the screenshot below, the line:
 is appended to the workspace file to export out the digitized lakes layer into the shape file C:\temp\lakes.shp.

Note: The edited workspace file should be renamed as a Global Mapper script file with a .gms extension e.g. workspace.gms.

You can either double click the renamed file in the Windows Explorer window or you can open up a Command Prompt window and run the global_mapper11.exe executable with the Global Mapper script file name as the argument, as shown below.

C:\> "\Program Files\GlobalMapper11\global_mapper11" workspace.gms

After running the script file, the shape files are created from the digitized data layers in the workspace.

No comments:

Related Posts with Thumbnails