Remove all points outside a polygon in a Surfer Post map or Base map

There are a couple of options to remove points in a post or base map outside a polygon boundary in Surfer:

Method 1: Manually remove the points from the data file

This method is good if there are just a few points outside the boundary. After tiling the plot document and the worksheet window, you would enable Track Cursor and click on points in the post map or base map from a data file. Those points are then highlighted in the worksheet, so you can then delete them. When you're all done, save the file and reload the data. Those points will then be removed from the map.

The steps are:

  1. Create the post map or base map in the plot window (Home | New Map | Post | Post or Home | New Map | Base | Base from Data, select the data file, and click Open).
  2. Select the post/base map and click Home | Add to Map| Layer | Base, select your BLN file and click Open. Now your polygon is on top of the posted points.
  3. Click to File | Open, select the data file again, click Open, and the data file opens in the worksheet window.
  4. In the worksheet window, if your X and Y data columns are not columns A and B, click Data | Data | Assign XYZ Columns to assign the correct columns to your X and Y data.
  5. Click View | Windows | Tile Vertical to arrange the windows next to each other.
  6. Enable cursor tracking by clicking Map Tools | Layer Tools | Track Cursor.
  7. Click in the plot window near one of the points outside the boundary, and that point is highlighted in the worksheet window.
  8. Click in the worksheet window and edit or delete the point from the worksheet.
  9. Repeat steps 7 and 8 until you're done removing points.
  10. Click File | Save As from the worksheet window to save the changes to a new data file.
  11. Select the Post layer or the Base(vector) layer in the Contents window.
  12. On the General page in the Properties window, click the Open File button.
  13. Select the new data file and click Open.

 

Method 2: Assign NoData to the grid outside the boundary, and identify the points that fall in the blanked areas with Grid Residuals

This method is good if there are a large number of data points outside the boundary, or if you are using Surfer 8 or previous. You will need to grid your data and add a map layer from the grid to your map to do this. It involves using Residuals on a grid with NoData values to create a new data file. The data points that lie in the NoData regions (i.e. outside the polygon) are easy to identify in the new data file.

The steps are:

  1. Click Home | Grid Data | Grid Data.
  2. In the Grid Data - Select Data dialog,
    1. Click Browse, choose your data file, and click Open.
    2. Set the X, Y, and Z columns.
    3. Choose your desired Gridding Method from the list on the left.
    4. Click Skip to End.
  3. In the Grid Data - <Gridding Method> - Output dialog,
    1. Click Browse in the NoData Polygon Boundary section, select the grid file, and click Open.
    2. Give the grid a name.
    3. Click Save.
  4. Click Grids | Calculate | Residuals.
  5. In the Grid Residuals dialog,
    1. Click Browse in the Input Grid section, select the NoData grid file, and click Open.
    2. In the XYZ Data section, select the post/base layer from the list, or click Browse, select the data file, and click Open.
    3. Assign the correct XYZ data columns for the data file.
      Note: that a numeric value must be present for every X, Y, and Z point location in the worksheet.
    4. Specify a residual column.
    5. Click OK.
  6. A worksheet window is opened containing the modified data file. Highlight all the data columns and click Data | Data | Sort.
  7. Select Residuals from the Sort First By list, toggle Ascending, and click OK.
  8. Now all the data points that are within the boundary are listed at the top of the worksheet with actual data in the Residuals column.
  9. Select the first row that does not have data in the Residuals column, scroll down to the last row, press SHIFT and select it.
  10. Press DELETE to delete all selected rows (which do not have data in the Residuals column).
  11. Click File | Save As and save this to a new data file. This new data file only has the data points within the boundary.
  12. Create the post/base map (step 1 above) from this new data file, or load the new data into an existing post/base map (steps 11-13 above).

 

 

Method 3: Manually remove the points from the map (base layer only)

This method is good for any number of points, as long as the edges of the boundary are mostly straight in the horizontal and vertical directions. It is only applicable for base maps though. You'll enter the base layer, mass-select the points to remove, and then delete them.

The steps are:

  1. Create the base map in the plot window (Home | New Map | Base | Base from Data, select the data file, and click Open).
  2. Select the base map and click Home | Add to Map| Layer | Base, select your BLN file and click Open. Now your polygon is on top of the points.
  3. Select the base layer.
  4. Click and drag your mouse around groups of points in the base layer, and press DELETE to delete them.
  5. If desired, uncheck your axes and use the File | Export command to export your updated map to a new DAT file.
 
If you would like to add your vote to our suggestion file for an automatic way to select all data points outside of a boundary, please let us know!

 

See also: 

 

Updated November 10, 2021

Was this article helpful?
0 out of 2 found this helpful

Comments

0 comments

Please sign in to leave a comment.