When overlaying base maps in a Surfer script how do you assign a name to each map?

There are two steps to naming your maps in Surfer Scripter:
  1. Name the  Map "frame" that holds the layers and axes (e.g. called Map in the user interface)
  2. Name the "overlays", which are the actual map layers (e.g. called Contours or Base in the user interface)


Use the .Name property of the Shape object to rename a layer or map object. For an example of renaming a map or the component layers, see below.


To run this script:

  1. Copy the script below, or download the attached BAS file: AssignName.BAS
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 16.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. Press Ctrl+V to paste the script into Scripter.
  6. Click Script | Run to run the script.


Sub Main
    Dim SurferApp, Plot, MapFrame1, ContourLayer, MapFrame2, PostLayer As Object
    Set SurferApp = CreateObject("Surfer.Application")
    SurferApp.Visible = True

    'Set path

    Set Plot = SurferApp.Documents.Add

    'Creates a contour map
    Set MapFrame1 = Plot.Shapes.AddContourMap(GridFileName:=Path+"demogrid.grd")
    Set ContourLayer = MapFrame1.Overlays(1)

    'Name the contour layer
    ContourLayer.Name = "This is My Contour Layer"

    'Creates a post map
    Set MapFrame2 = Plot.Shapes.AddPostMap(DataFileName:=Path+"demogrid.dat")
    Set PostLayer = MapFrame2.Overlays(1)

    'Name the post layer
    PostLayer.Name = "This is My Post Layer"

    'Select and overlays the map objects
    MapFrame1.Selected = True
    MapFrame2.Selected = True
    Set NewMapFrame = Plot.Selection.OverlayMaps

    'Name the map frame
    NewMapFrame.Name = "Demogrid Map"

End Sub


Updated November 12, 2018

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


Please sign in to leave a comment.