Import Shapefile Dialog Box

The Import Shapefile dialog box is used to import Shapefiles into GoPhast.  To display the Import Shapefile dialog box, select File|Import|Shapefile...

The Shapefile format (Environmental Systems Research Institute, Inc, 1998) is a commonly used file format in Geographic Information Systems.  The Shapefile will be imported as a series of objects on the top view of the model.  These objects will set the values of data sets as specified by the user.  The names of the imported objects will be based on the name of the file from which the objects are imported.  The “Select Objects by Name Dialog Box” (p. 58) can be used to select all these objects at a later time.  

After selecting the Shapefile to import, the attributes of the shapes are displayed in the Import Shapefile dialog box.  The user chooses which attributes to import by checking the check box next to the name of the attribute.  The user can then decide whether to create a new data set for each attribute that is imported or to assign values to existing, compatible data sets.  Only data sets with an orientation of "2D Top" can be used for the imported shapes.  If a new data set will be used, the user can choose an interpolation method for the new data set.   (See “Interpolation Methods” on p. 22.)  The user also decides whether to evaluate the objects at element or nodes and whether to set the values of enclosed elements or nodes, intersected elements or nodes, or to set values or elements or nodes by interpolation.  

Some Shapefiles store the coordinates of points as latitudes and longitudes.  On the coordinate conversion tab, the user can choose to convert those coordinates to Universal Transverse Mercator (UTM) coordinates.  If all the points in the Shapefile belong in the same UTM zone, that zone will be picked automatically.  Otherwise, the user must specify the appropriate zone number in an edit box.  The user also must specify the ellipsoid used as a basis for the conversion.  Normally, the default ellipsoid is appropriate.  More information about coordinate conversions and map projections can be found in Snyder (1987).

Shapes in Shapefiles can contain holes inside polygons.  GoPhast does not have a method of representing holes so such shapes are skipped when importing into GoPhast.

In some cases, the user may not wish to import all the shapes in a Shapefile.  The Import criterion can be used to determine which shapes are imported.  The user can enter a formula which will be evaluated for each shape.  Only those shapes for which the formula evaluates to True will be imported.  The user can click the Edit F()… button to edit the formula for the import criterion using the Formula Editor (p. 42).  The following example shows how coordinate conversions and the Import criterion can be used to advantage.  

In this example, only the shapes from Oklahoma will be imported from a Shapefile containing shapes for rivers throughout the United States.  Oklahoma was selected for this example because example 4 from the PHAST documentation is set in Oklahoma.

  1. The National Atlas of the United States (http://nationalatlas.gov/atlasftp.html#hydrogm) has a Shapefile that represents the major streams and water bodies in the United States.  Download the Shapefile version of that data (hydrogm020.tar.gz) and extract its contents.  
  2. In GoPhast, select File|Import|Shapefile… and then select hydrogl020.shp which was extracted from hydrogm020.tar.gz.
  3. After the Shape geometry file has been read, the Import Shapefile dialog box will be displayed.  Go to the Coordinate Conversion tab and check the check box labeled Convert coordinates from decimal degrees to UTM.  Change the UTM zone number to 14.  This is the appropriate UTM zone for Oklahoma.
  4. Go to the Data tab and change the Import criterion to “Pos("OK", UpperCase(STATE)) > 0”.  STATE is one of the attributes of the Shapefile.  It holds abbreviations for the state or states in which each water body is present.  This formula evaluates to true if the water body is in the state of Oklahoma (abbreviation = “OK”).  Select any of the attributes you wish to import in the dialog box at the top of the Data tab and click the OK button.  For an explanation of the attributes in the Shapefile, see the file hydrogm020.txt that came with the Shapefile.  
  5. After the shapes have finished being imported, select View|Go To… and select the first imported shape.  Then zoom out to see all the imported water bodies.  Only shapes that are at least partially in Oklahoma will have been imported and their coordinates will have been converted to UTM coordinates (fig. 22).
Oklahoma Rivers
Figure 22. Imported Oklahoma rivers.