Working with Data from External Sources
Step 1: Importing Shapefile Data
Network Building Using External Data
Method Description Advantages Disadvantages
Database Connection
Create connections to import and export model data using common database and spreadsheet formats.
Extremely versatile. Allows exchange of most any model data with a wide variety of applications (ODBC). A topographic representation of the network can be created by using node coordinates and assigning to and from nodes to pipes. Once a connection is established, it can be saved for later use, and multiple
connections can be created and synchronized simultaneously.
Pipes will be depicted as straight lines connecting the to and from nodes, so pipe bends will not be transferred.
Shapefile Connection
Create connections to import and export model data in ESRI shapefile format.
Advantages are similar to those of Database Connections, except the topographic data exchange is automatic and pipe bends are accounted for.
More proprietary. You have to have
software that supports ESRI shapefiles in order to utilize the data. format into pipes and other network elements.
Enables you to use legacy CAD drawings to build your network.
You can set up tolerances to allow for drawing imperfections, and preferences for how nodes will be created.
Elements are assigned default labels as they are created. Only
In this part of the lesson, you will import ESRI shapefiles to construct the distribution network in Bentley WaterGEMS V8i from existing GIS data. If you have ArcView, ArcInfo, or other application that can open a shapefile, then you can, if you choose, view the files externally prior to importing them. However, you will still be able to perform the workshop problem even if you don’t have one of these applications. This lesson uses the network from Water Quality Analysis on page 2-97.
The ESRI shapefile actually consists of three separate files that combine to define the spatial and non-spatial attributes of a map feature. The three required files are as follows:
• Main File—The main file is a binary file with an extension of .SHP. It contains the spatial attributes associated with the map features. For example, a polyline record contains a series of points, and a point record contains x and y coordinates.
• Index File—The index file is a binary file with an extension of .SHX. It contains the byte position of each record in the main file.
• Database File—The database file is a dBase III file with an extension of .DBF. It contains the non-spatial data associated with the map features.
All three files must have the same file name with the exception of the extension, and be located in the same directory.
Listed below are the files you will be importing. Only the main files are listed;
however, corresponding .SHX and .DBF are present as well.
• PresJunc.shp
If you have a program such as ArcView or ArcGIS that allows you to view shapefiles, begin by setting up a view with all of the shapefiles (themes) listed above turned on. If you completed the Water Quality Analysis lesson, you should recognize the layout from that lesson. You can look at the data table for each of the themes to see what you will be importing. When you have finished reviewing the shapefiles, close the applica-tion.
This lesson has instructions for use with the WaterGEMS V8i interface and the AutoCAD interface.
In the WaterGEMS V8i interface:
1. Double-click the Bentley WaterGEMS V8i desktop icon to start Bentley Water-GEMS V8i WaterWater-GEMS V8i. If the Welcome to Bentley WaterWater-GEMS V8i dialog box opens, click the Close button.
2. Click Tools > Options and select the Global Options tab.
3. Since you will be working in SI units, click the Unit System selection box, and select System International. Click OK.
4. Select File > New. Click No when prompted to save the current project.
5. In the Create Project File As dialog box, double-click the Lesson folder, enter the file name GISPROB.wtg for your project, and click Save. The Project Setup Wizard opens.
6. In the Project Setup Wizard, title the project Lesson 7, Part 1 - Importing GIS Data. Click Next. Click the Next button again to leave this dialog box set to its default values.
7. In this dialog box, set up the drawing as Scaled, with a horizontal scale of 1:5000 and a vertical scale of 1:500.
8. Change the three Annotation Multipliers (Symbol Size, Text Height and Annota-tion Height) to 2.8.
9. Click Next, leave the Prototypes set to their default values, and click Finished.
10. Before importing the shapefiles, we must import the pump definition that is refer-enced by the pump shapefile. To do this, open the Pump Definition Manager by clicking the Analysis > Pump Definitions.
11. In the Pump Definition Manager, click the Import button. Browse to your Bentley/WaterGEMS/Lesson directory and select Lesson7.txt. Click Open. The Lesson7 pump definition should appear in the list pane of the Pump Definition Manager.
In the AutoCAD interface:
1. Double-click the Bentley WaterGEMS V8i desktop icon to start WaterGEMS for AutoCAD. Select Tools > Options and choose the Global tab.
2. Since you will be working in SI units, click the Unit System selection box, and select System International. Click OK.
3. Click File > New and select No when prompted to save the existing drawing.
4. Only if the Create New Drawing dialog box does not open: Press the Esc key.
Then, type filedia at the command prompt and press Enter. Type the value 1 and press Enter. Then, choose File > New, and do not save changes to the existing drawing. Note that the filedia variable controls whether some AutoCAD commands appear as dialog boxes or simply at the command prompt.
5. When the Create New Drawing dialog box opens, make sure Metric is selected, and click OK.
6. Click Yes when prompted to set up the project. In the Project Setup Wizard, title the project Lesson 7, Part 1 - Importing GIS Data, and click Next.
7. Click Next again to accept the defaults on the second screen.
8. In this dialog box, set up the drawing as Scaled, with a horizontal scale of 1:5000 and a vertical scale of 1:500.
9. Change the three Annotation Multipliers (Symbol Size, Text Height and Annota-tion Height) to 2.8. Click Next, leave the Prototypes set to their default values, and click Finished.
In both the AutoCAD and WaterGEMS V8i interfaces:
10. Select File > Synchronize > Shapefile Connections.
If you have not defined any shapefile connections in Bentley WaterGEMS V8i yet, you are prompted to create a shapefile connection; select Yes to start the Shapefile Connection Wizard. Or, if you have already defined shapefile connec-tions in any other Bentley WaterGEMS V8i project, start the Shapefile Connec-tion Wizard by clicking Add in the Shapefile ConnecConnec-tion Manager that opens.
Type the Connection Label Lesson 7, Part 1 for this connection, and click the Next button.
11. Now, you need to select the check boxes for the types of elements you will be importing. For this connection, select these check boxes: Pressure Junction, Pressure Pipe, PRV, Pump, Reservoir, and Tank.
12. Click Next.
13. Leave the Shapefile Unit set to m, and select the check box to establish missing connectivity data from spatial data, and click Next.
14. Click the Ellipsis (…) button next to the Shapefile field. Browse and select the file PRESJUNC.SHP from the \Bentley\wtg\Lesson directory; click Open.
15. Set the Key/Label field to LABEL. This item designates the field that Bentley WaterGEMS V8i matches with its own element labels, so that data will be assigned to the correct place.
16. Using the Field Links table, match the data types available in Bentley Water-GEMS V8i to the data types you will be bringing in from the shapefile.
17. In row 1, select Elevation from the WaterGEMS column and ELEV from the Database column. Set the Unit to m to set the coordinate from the shapefile to meters. If the units in your shapefile were different than the units set up in Bentley WaterGEMS V8i , then Bentley WaterGEMS V8i would automatically do the necessary unit conversions.
18. Fill in the next row, so that your entries correspond to the table below. Click Next when you are finished.
19. Set up the Pressure Pipe connections. Continue by entering the information below for the Pressure Pipe and clicking Next to proceed to the next dialog box. The shapefile for each type of element will be located in the \Bentley\wtg\Lesson directory (for example, select the PRESPIPE.SHP file for the pressure pipe connection), and the entry for the Key\Label field will always be LABEL. Your Field Links tables should look like the tables that follow.
Pressure Junction Shapefile Connection Bentley
WaterGEMS V8i
Database Unit
Elevation ELEV m
Base Flow DEMAND l/min
Pressure Pipe Shapefile Connection
20. When you are finished setting up the shapefile connections, click Next to proceed.
The Synchronize Now? dialog box will open.
21. Make sure the Synchronize Shapefile Connection and In check boxes are selected because you will be reading data from the shapefiles.
22. Click Finished and Yes when prompted if you want to proceed.
23. A Status Log is generated showing the elements as data that is read into the model.
After the import is complete, you should get a yellow light in this window, indi-Tank Shapefile Connection
Bentley WaterGEMS V8i
Database Unit
Tank Diameter TANK_D m
Base Elevation BASE_ELEV m
Minimum Elevation
MIN_ELEV
m
Initial HGL INITIAL_HGL m
Maximum Elevation
MAX_ELEV
m
were no warnings you would get a green light and, if there were errors, a red light.
In this case, the warnings are due to the fact that you set Bentley WaterGEMS V8i to generate our network connectivity from the GIS spatial data. The log indicates where connectivity is being established, which is fine.
24. Close the Status Log and click OK to return to the drawing pane.
25. Now, examine the network that you imported. Notice that it looks like the network from Water Quality Analysis on page 2-97, and many of the pipes have bends and curves in them. Since you have topographic information stored in the shapefile, these bends can be imported. Because you created a scaled drawing, the pipe lengths will be read from the layout.
Also notice that the default scenario, Base, is currently displayed as the current scenario. Whenever data is brought in through a database or shapefile connection, it is automatically written into the alternatives referenced by the current scenario.
Similarly, whenever data is exported, the data associated with the current scenario will be used.
26. To run the model, click the Compute button in the toolbar, and then click
Compute in the dialog box. Now that you have calculated data, you could export the new data to your GIS database by going into the database and creating a new label for it. In “Part 2—Importing Data from a Database” on page 2-108, you will use an almost identical procedure to export pressures using database connections.
27. After you are finished, close the Scenario Editor. Continue with “Part 2—