Convert a vector file (i.e. SHP, DXF) to a raster grid (GRD) in Surfer

In Surfer you can convert a vector file (such as SHP or DXF) containing contours to a grid file using the Grid from Contours command.  The grid file can then be used to create a contour map or any other grid based map in Surfer.  Follow the steps below to do this. The steps use SHP as an example, but the steps are the same for all vector file formats.

 

mceclip3.png

 

  1. Click Grids | New Grid | Grid from Contours.
  2. If your SHP file is plotted as a base map, select the base map layer from the Contour Source dropdown list. Otherwise, click the Browse button next to the list, select your SHP file, and click Open.
  3. In the Select Field dialog, choose the attribute containing your Z information from the dropdown list, then click OK.
  4. If you would like your grid file to contain a fault, in the Fault Source dropdown list select the base map layer containing your fault BLN file, or else click the browse button, choose the fault BLN file, and click Open.
  5. In the Output Grid Geometry section, set the desired limits for the grid file and the grid spacing/number of nodes, or Copy geometry from another grid. 
  6. In the Options section, 
    1. Check the box next to Assign NoData outside convex hull of data in order to assign NoData values to all grid nodes that fall outside of the convex hull of the data.
    2. If you chose to blank the grid outside the convex hull of the data, you can inflate or deflate the convex hull by a certain amount by entering a positive or negative value (in map units) into the Inflate convex hull by box.
    3. Enter a positive value for the Extrapolation factor if you wish to control the rate of change of z values for grid nodes with only one bounding contour (usually near the peaks and basins of your contours). The slope between the nearest two contour lines is multiplied by the Extrapolation factor to perform linear extrapolation. Values are explained in the table below.
      Value Explanation
      0 Generates a grid with flat peaks and basins
      >0 and <1 Lessens the rate of change in Z with distance from the nearest contour (generates lower peaks and shallower basins)
      1 Default
      >1 Increases the rate of change in Z with distance from the nearest contour (generates higher peaks and deeper basins)
    4. Check the box next to Close open contours in order to convert polyline contours with endings near their beginnings into polygons so they can be filled with a designated fill color.
    5. If you've chosen to close open contours, enter a distance tolerance into the Ends within box. If the starting and ending points of the contour line are the same or close enough that they are within this distance tolerance, and the contour would not cross another contour line by closing the polyline, the polyline will be converted into a polygon.
    6. Check the box next to Partial contour cleanup to improve performance around open contours that terminate in the interior of the map, especially near the edges of the map or when the contour lines indicate faulting.  
  7. In the Output Grid section, give your output grid file a name and file path. If you wish to save to a specific grid file type, click the open file icon to access more save options.
  8. Check the box next to Add grid as layerto to create a new map layer from this grid, and then choose what map to add it to from the drop-down list.
  9. If you've chosen to add the grid as a layer to a new or existing map, choose what type of map to create from the New layer type drop-down list.
  10. Click OK to create the grid file from your SHP file.


Surfer 13 and previous require XYZ data points in a supported data file format (DAT, TXT, XLS, XLSX, 3D DXF, etc) to create a grid file (GRD). SHP files usually store the XY coordinates in the SHP file and the Z coordinates in a DBF file. Surfer 13 can load the SHP file as a base map and read the Z attributes for the objects, but it cannot convert it to a grid file. However, you can export it to an XYZ data file and then grid the data using these steps:
  1. Click Map | New | Base Map, select the SHP file and click Open.
  2. Verify that the objects have a Z value attribute. You can do this by selecting one of the objects in the Base layer, and clicking the Info tab in the Property Manager. The attributes for that object are listed under the Attributes section. If there are not any Z attributes for the objects, you can add them.
  3. As long as the objects have Z values, then uncheck the axes for the map in the Object Manager so that they are invisible.
  4. Click File | Export and export to a DAT XYZ points (*.dat, *txt, *xyz) file.
  5. Click Grid | Data, select the DAT file and click Open.
  6. Set the gridding options you wish, and click OK. The grid file is created.
  7. Click Map | New | Contour Map, select the grid file and click Open. The contour map is displayed. 

 


 

In Surfer 12 or previous versions, you could not export the base layer as a DAT file. There are a few different ways you can convert the SHP to an XYZ data file (and then grid the XYZ data file to create the GRD). Our Didger and MapViewer programs both have the ability to read the Z value from the DBF file and write out ASCII XYZ. So some options include:

  1. Using Didger for the conversion. Click File | Import to import the SHP file into Didger, setting the Z value as the Primary ID. Then click File | Export to export to a DAT file.
  2. Using MapViewer for the conversion. Click File | Import to import the SHP file into MapViewer, setting the Z value as the Primary ID. Then click File | Export to export to a DAT file.
  3. Using Arcv2CAD to convert the SHP to 3D DXF, and then use Surfer to read the 3D DXF file as an XYZ data file. A 3D DXF file can be gridded or opened in the worksheet and the XYZ values for each vertex in the file is recognized, so it can be used in place of an XYZ data file.
  4. You can import the SHP as a base map in Surfer, turn off the axes, and export it to a BLN file. Open the BLN file in the Surfer worksheet, remove the BLN headers (a 1-line header with the number of data points in column A and a 1 in column B), and then add the elevation data from the DBF to column C in the worksheet, matching up the correct elevation value with each object or vertex. Depending on how many objects or vertices you have, this could be easy or could be difficult. If you can do this, you can then use File | Save As in the worksheet to save the data to a DAT file for use with gridding.

Once you have the SHP file saved in an XYZ data file format (or a 3D DXF file format), you can use the Grid | Data function in Surfer to grid the data and create a GRD file.

 

See Also: How can I convert a 3D SHP file to an XYZ or GRD file using Didger 4?

 

Updated February 13, 2019

Was this article helpful?
7 out of 14 found this helpful

Comments

0 comments

Please sign in to leave a comment.