2

I am trying to add elevation data to my road network to more accurately calculate walking distance to and from schools. I have figured out how to do the network with out elevation, but for the life of I can't figure out how to add in the elevation (hills etc).

I have currently have:

  • Road Network Feature Class
  • Road Infrastructure Feature Class
  • Contour Lines 1-5m Feature Class
  • TIN and DEM models produced from the contour lines
  • 2
    What software are you using? – Jakob Oct 1 '15 at 12:17
  • Ah sorry, Arc Map 10.2 – Alex Wraith-Smith Oct 1 '15 at 12:33
1

enter image description here

Run field calculator expression (Python) on numeric field type double:

def plineZ(shp):
 part=shp.getPart(0)
 n=len(part);L=0;p1=part.getObject(0)
 for i in xrange(1,n):
  p2=part.getObject(i)
  dX=p2.X-p1.X;dY=p2.Y-p1.Y;dZ=p1.Z-p2.Z
  l=dX*dX+dY*dY+dZ*dZ
  L+=pow(l,0.5)
  p1=p2
 return L


plineZ( !Shape!)

To get this:

enter image description here

  • I cant seem to get the python script to work, what application should I use? – Alex Wraith-Smith Oct 2 '15 at 7:04
  • Field calculator. Python – FelixIP Oct 2 '15 at 7:15
  • I am not that familiar with python, so I think I am doing it wrong as it keep throwing up syntax errors – Alex Wraith-Smith Oct 2 '15 at 14:41
  • 1
    You need nil knowledge of Python to make it work. Have a look at Using code blocks help.arcgis.com/EN/arcgisdesktop/10.0/help/index.html#/… . Copy 1st nine lines into first box, copy plineZ(!Shape!) into second narrow text box. Check Python, click Ok – FelixIP Oct 4 '15 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.