In order to add the appropriate z value as impedance, you will have to first transfer the Z value from the shape field to a regular field (most likely of type double) in your streets shapefile. Then in your network dataset, you can create a network cost attribute based on this field.
There are multiple ways to transfer the Z value from shape field to an attribute. Before suggesting them, I would want to know
- What ArcGIS version you are using?
- Do you also have a license for 3D Analyst Extension?
- Does your lines have the same Z value for all vertices that make up a line? If not, then do you want to store mean Z, or max Z or min Z for each line?
Deelesh
Dim meanZ as Double Dim totalZ as Double Dim pointCount as Double Dim pLine as IPointCollection Dim pPoint as IPoint Dim i as Integer Set pLine = [Shape] pointCount = pLine.PointCount For i = 0 to pointCount -1 set pPoint = pLine.Point(i) totalZ = totalZ + pPoint.Z Next meanZ = totalZ / pointCount
Here are the steps to add the average Z value for each street as an attribute. You will have to unzip the MeanZ.zip file to get the MeanZ.cal field calculator expression file.The script is getting the Z values from each vertex that make up a line and then calculating the average z value.
- Add a new field called "AverageZ" of type Double to your line shapefile
- Right-Click the field and select "Calculate Values"
- In the Field Calculator dialog, Click the Load button and browse to the MeanZ.cal expression file.
- This will load the VBA script that does the calculations to determine average Z. Click OK to run the script.
The script's VBA codeDim meanZ as Double Dim totalZ as Double Dim pointCount as Double Dim pLine as IPointCollection Dim pPoint as IPoint Dim i as Integer Set pLine = [Shape] pointCount = pLine.PointCount For i = 0 to pointCount -1 set pPoint = pLine.Point(i) totalZ = totalZ + pPoint.Z Next meanZ = totalZ / pointCount
For others that might come across this thread, Field Calculator at ArcGIS 10 no longer supports the ability to run VBA scripts. So this same workflow can be achieved by writing a python script or by using the Add Z information geoprocessing tool available with 3D Analyst Extension.
Deelesh