When multiple map layers are overlaid, the map limits are automatically adjusted to show the full extents of the combined maps. As a result, the limits and scale often need to be adjusted. The script below shows how to create 3 maps, overlay them, set the new limits and adjust the map scale.
To run this script:
- Copy the script below, or download the attached BAS file: OverlayMaps.bas.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- Press Ctrl+V to paste it into Scripter.
- Click Script | Run to run the script.
*********
Sub Main Dim SurferApp, Plot, ContourMapFrame, ContourMap, _ ClassedPostMapFrame, ClassedPostMap, BaseMapFrame, BaseMap, _ Shapes As Object Set SurferApp = CreateObject ("Surfer.Application") SurferApp.Visible = True Set Plot = SurferApp.Documents.Add(srfDocPlot) Set MapFrame1 = Plot.Shapes.AddContourMap (SurferApp.Path+"/samples/demogrid.grd") Set MapFrame2 = Plot.Shapes.AddBaseMap (SurferApp.Path+"/samples/demoslice.bln") Set MapFrame3 = Plot.Shapes.AddImageMap(SurferApp.Path+"/samples/demogrid.grd") MapFrame1.Selected = True MapFrame2.Selected = True MapFrame3.Selected = True Set NewMapFrame = Plot.Selection.OverlayMaps NewMapFrame.SetLimits(4,7,3,6) NewMapFrame.xMapPerPU=0.5 NewMapFrame.yMapPerPU=0.5 End Sub
See also the attached script OverlayMaps.bas, which can also be found in the \Samples\Scripts\ folder in the Surfer installation directory.
Updated November 2021
Comments
What do the number 4,7,3,6 mean when you set the limit? I saw there are three map frame objects but four numbers?
Hello Kien,
The four parameters in SetLimits are xMin (4), xMax (7), yMin (3), and yMax (6). These settings are for a single map object (the one with the overlain map layers). You can learn about this command in the Help.
Thanks,
Leslie
Please sign in to leave a comment.