Follow

How can I hide a map layer in Surfer's automation?

This article contains a sample script for turning off the visibility of a map layer.

To run this script:

  1. Copy the script below, or download the attached BAS file: Visibility of Map OFF.bas.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 14\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
  6. Click Script | Run to run the script.
     

*********

'Visibility of Map OFF.bas shows how to turn off the visibility of a map layer.

'===================================

Sub Main

'Declare the variable that will reference the application
	Dim SurferApp As Object
	Set SurferApp = CreateObject("Surfer.Application")
	SurferApp.Visible = True

'Declares Plot as an object
	Dim Plot As Object
	Set Plot = SurferApp.Documents.Add

'Creates the first post map
	Set MapFrame = Plot.Shapes.AddPostMap(SurferApp.Path + "\samples\demogrid.dat")

'Declares PostMap1 as an Object and assigns the post map to variable "PostMap1"
	Dim PostLayer As Object
	Set PostLayer = MapFrame.Overlays(1)

'Changes the name of the post map to Demo and changes the symbol color.
	PostLayer.Name = "Demo"
	PostLayer.Symbol.Color = srfColorGreen

'Creates a second post map
	Set MapFrame2 = Plot.Shapes.AddPostMap(SurferApp.Path + "\samples\sample1.dat")

'Declares PostMap1 as an Object and assigns the post map to variable "PostMap1"
	Dim PostLayer2  As Object
	Set PostLayer2 = MapFrame2.Overlays(1)

'Changes the name and symbol color of the second post map
	PostLayer2.Name = "Sample"
	PostLayer2.Symbol.Color = srfColorBlue

'Overlays the two post maps
	Plot.Shapes.SelectAll
	Set Sel = Plot.Selection
	Sel.OverlayMaps
	Sel.DeselectAll
	
'Turns off the visibility of the second post map
	Plot.Shapes.Item(1).Overlays("Sample").Visible = False

End Sub

 

Updated February 14, 2017

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.