# Calculate the volume or area inside an irregular polygon in Surfer

To simply calculate the planar area inside an irregular polygon, please see: How can I measure the distance/length or area on a map?

If you want to calculate the volume or surface area inside a polygon, all you need are the grid file and a polygon (either drawn in a base layer, or in a vector file format).

The steps are:

1. Grid the data over the entire rectangular bounding box.  You can choose to create a map from the grid file, if desired.
2. Define the polygon for the area(s) you want to calculate the volume within. You can either:
• Add an empty base layer to the map and draw the polygon(s) you want.
• Obtain a vector file of the polygon in a vector format (e.g. DXF, SHP, BLN, KML, MIF, etc). You can choose to add this to the map as a base layer, if desired.
• Create a vector file containing the polygon. If you need help creating one, please see the article How can I create a BLN file in Surfer?.
• Click Grids | Calculate | Volume.
• In the Grid Volume dialog,
1. In the Upper Surface section, choose a grid-based map from the dropdown list, or click Browse to navigate to and select your grid file.
2. Since volume is calculated between two surfaces, in the Lower Surface section, either choose a different map layer or browse to a grid file for the lower surface, or set a constant Z value.
3. If your z units are not the same as your x and y units, enter the appropriate Z Scale Factor to convert from the z units to the x and y units.
4. In the Polygon Boundary section, choose a base map containing your polygon from the dropdown list, or click Browse to navigate to and select your vector file.
5. Toggle Volume Inside, and choose whether to calculate for all polygons on the map layer or just the selected polygon(s).
• Click OK and a Grid Volume Computations report is generated.
• Save this file if desired by clicking File | Save As in the report window.

In Surfer 13 and previous, you will need to blank the grid file outside the polygon defining the area using Grid | Blank, and then use the Grid | Volume command. The blanked areas are not included in the volume calculations and are separated out in the surface area calculations.

Step 1: Blank the Grid File to the Desired Area
The area outside the desired polygon area can be blanked using a BLN file that describes the boundary of the polygon.

1. Grid the data over the entire rectangular bounding box.
2. Create a BLN file containing the polygon you want to blank outside of. If you need help creating a BLN file, please see the article How can I create a BLN file in Surfer?.
3. Once the BLN file is created, be sure to open the BLN file in the Surfer worksheet and confirm that cell B1 shows a 0 (zero), which tells Surfer to blank outside the polygon in the BLN file. If it is a 1, change it to a 0, save and close the file.
4. Then click Grid | Blank, select the grid file and click Open.
5. Select the BLN file and click Open.
6. Save the blanked grid to a new name.

Step 2: Calculate the Volume and Area
Once the grid is blanked, so that there is only data inside the area you want (you may want to create a contour map first to confirm this):

1. Click Grid | Volume.
2. Select the grid file and click Open.
3. In the Grid Volume dialog, the grid file will be entered as the Upper Surface. The volume calculations calculate the volume between two surfaces. You can calculate between a grid file and a horiztonal surface, or between two grid files. Enter your desired input for the Upper Surface and Lower Surface and click OK.
4. The Volume Report is generated. The volume calculations will not include the areas that are blanked.

Note that the units of the volume are in X*Y*Z. If the X, Y and Z coordinates in the grid file are all in meters, then the volume is reported in m3 (and surface area is X*Y, or m2).

Updated April 8, 2020