<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I have a Polyline Feature class that I wish to maintain in 3D Editing in Public Transit Questions</title>
    <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725892#M83</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Personally I would be more interested in knowing the elevation difference in the entire trajectory then only at the start and end positions, especially in cases like the one below:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/108411_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;However, I you want to extract start and end height, determine the difference between them and divide it by the length to obtain the slope, this could be scripted with some Python code. This is much faster than editing in ArcScene in a 3D environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may also want to consider editing in ArcGIS Pro (if you have access to it) since it has enhanced performance for 3D editing workflows. &lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/guidelines-for-editing-features-with-base-height-properties-in-3d.htm" title="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/guidelines-for-editing-features-with-base-height-properties-in-3d.htm"&gt;Guidelines for editing features with base height properties in 3D—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/about-setting-feature-heights-z-s-for-3d-editing.htm" title="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/about-setting-feature-heights-z-s-for-3d-editing.htm"&gt;http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/about-setting-feature-heights-z-s-for-3d-e…&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jun 2015 03:26:20 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2015-06-10T03:26:20Z</dc:date>
    <item>
      <title>I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725889#M80</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm looking for guidance or a miracle..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a Polyline feature class that is Z aware&amp;nbsp; when first built but to adjust and add new features to it. It seems I can only create another Feature class with the updated Z aware Polyline features. and generally having to delete and replace data in the database to maintain the static dataset.&lt;/P&gt;&lt;P&gt;I have tried ArcScene to edit in 3d with very limited success, ie it takes about 10 minutes to digitize a line of 15 vertices 250 metres long (display performance is slow). And then often it will not populate the Z attribute of the vertices along the line, I have only been successful once. (I have tried different&amp;nbsp; Elevation Sources from Raster to TIN and a few others TIF etc).&lt;/P&gt;&lt;P&gt;If I restart the same session and reload the ArcScene document the next day and add a new feature it again takes 10 minutes and has lost the z awareness,&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/108402_Capture.PNG" style="width: 620px; height: 396px;" /&gt;&lt;/P&gt;&lt;P&gt;The Polyline Layer knows the Elevations are derived from the 3D Surface but it will not populate the Z value.&lt;/P&gt;&lt;P&gt;I would actually prefer to edit the Z aware features in ArcMap as it is linked to another relational database so if I split a polyline in half&amp;nbsp; it's ID also needs to be updated in the relational database with appropriate new records added.&lt;/P&gt;&lt;P&gt;The 3D line itself only really needs it's Start point and Finish point Z values to be known as I am trying to calculate Gradient of the line over the surface.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To me this sounds like basic 3D editing but I am surprised that I cannot do it easily or quickly. as all I am wanting is the Z value interpolated from the surface to be stored with the Polyline itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why change Polyline features you ask?&amp;nbsp; Well it is all about decision processes of determining Gradient and keeping the gradient within&amp;nbsp; physical constraints such as 12% slope between end points. If you shift the polyline up or down the surface in XY, the Z value has to change also, so I need to reflect this in as near as possible to real time during the editing process, whilst maintaining the links to the relational database.&lt;/P&gt;&lt;P&gt;I am just at a loss as to how to achieve this easily. The modifications could encompass 50 -100 alterations in any one session, and one gradient change affects the next polyline gradient in the network of line features.&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Mat Boonen , Hikurangi . NZ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 01:09:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725889#M80</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-10T01:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725890#M81</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you know the "&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00q900000016000000"&gt;Add Surface Information (3D Analyst)&lt;/A&gt;" tool? It will add this information to a polyline based on a surface. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For a polyline it will add:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;3D distance of the line along the surface.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Minimum, maximum, and mean elevation and slope of the line along the surface.&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 01:18:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725890#M81</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-10T01:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725891#M82</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Xander,&lt;/P&gt;&lt;P&gt;But Sadly that only finds Max and Min plus Mean Z it will not interpolate the Z at the beginning and end of the Polyline which is what i need. generally the Max and Min are not always at the start or finish of each line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have got a little further with using ArcScene in that if I have a very small surface model (250 hectares in size) it seems to be a lot more stable in that environment. Strictly speaking I dont even wish to render the surface model in 3d anyway . a 2D view to digitize is fine, I just want the extract Z heights as above.&lt;/P&gt;&lt;P&gt;I could break my surface model into hundred of tiles but that also seems a bit of a compromise. especially when trying to associate the Polyline with the correct surface model under it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 03:05:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725891#M82</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-10T03:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725892#M83</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Personally I would be more interested in knowing the elevation difference in the entire trajectory then only at the start and end positions, especially in cases like the one below:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/108411_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;However, I you want to extract start and end height, determine the difference between them and divide it by the length to obtain the slope, this could be scripted with some Python code. This is much faster than editing in ArcScene in a 3D environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may also want to consider editing in ArcGIS Pro (if you have access to it) since it has enhanced performance for 3D editing workflows. &lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/guidelines-for-editing-features-with-base-height-properties-in-3d.htm" title="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/guidelines-for-editing-features-with-base-height-properties-in-3d.htm"&gt;Guidelines for editing features with base height properties in 3D—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/about-setting-feature-heights-z-s-for-3d-editing.htm" title="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/about-setting-feature-heights-z-s-for-3d-editing.htm"&gt;http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/about-setting-feature-heights-z-s-for-3d-e…&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 03:26:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725892#M83</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-10T03:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725893#M84</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know what you mean, the truth is engineers place the line at strategic locations to minimize the possibility of creating the variance that you describe, and generally these sections represent the start and finish height of each section of road. to create an overall gradient between the two locations, the peice in the middle is just the effort amount to get to the finished requirement, but we first need to know that the gradient is not too steep overall, the balancing (or lack thereof)of cuts and fills is really the nuts and bolts of getting the grade from one point to the next right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have Arc Pro, but need to come up to speed with that too As 3D editing is not so obvious as yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used the&amp;nbsp; &lt;A href="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/guidelines-for-editing-features-with-base-height-properties-in-3d.htm" title="http://desktop.arcgis.com/en/desktop/latest/guide-books/extensions/3d-analyst/guidelines-for-editing-features-with-base-height-properties-in-3d.htm"&gt;Guidelines for editing features with base height properties in 3D—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;And yet still am up against it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 03:46:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725893#M84</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-10T03:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725894#M85</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds logical what you are explaining. Maybe a field calculator script that reads out the start and end point, reads the elevation from a defined source for those points and calculates the slope between start and end point could be a solution. I will look into that and let you know what I find.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For ArcGIS Pro there is a post by &lt;A href="https://community.esri.com/migrated-users/54893"&gt;David Reeves&lt;/A&gt;&amp;nbsp; with lots of useful resources here: &lt;A href="https://community.esri.com/docs/DOC-3027"&gt;Introduction to ArcGIS Pro for GIS Professionals (1.1) Class Resources&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 11:32:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725894#M85</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-10T11:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725895#M86</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In case you want to use the FieldCalculator you could do this:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/108633_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Select Python as parser&lt;/LI&gt;&lt;LI&gt;Activate the option "Show Codeblock"&lt;/LI&gt;&lt;LI&gt;Paste the code below in the codeblock&lt;/LI&gt;&lt;LI&gt;change the path to your DEM (see line 3 of the code below)&lt;/LI&gt;&lt;LI&gt;Specify "getSlope( !SHAPE! )" to assign to your output field (in my case the field " test")&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code block:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
# change the path to your DEM
dem = "D:/Xander/GeoNet/Pasture/ned10m34101g3.tiff"

def createExtentForPoint(pnt, cellsize):
&amp;nbsp;&amp;nbsp;&amp;nbsp; return arcpy.Extent(pnt.X - cellsize, pnt.Y - cellsize, pnt.X + cellsize, pnt.Y + cellsize)

def getRowColExtentFromXY(ext, pnt, cellsize):
&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; col = int(((pnt.X - ext.XMin) - ((pnt.X - ext.XMin) % cellsize)) / cellsize)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = int(((ext.YMax - pnt.Y) - ((ext.YMax - pnt.Y) % cellsize)) / cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return row, col

def createNumpyArrayUsingExtent(raster, ext, cellsize):
&amp;nbsp;&amp;nbsp;&amp;nbsp; lowerLeft = arcpy.Point(ext.XMin, ext.YMin)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ncols = int(ext.width / cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; nrows = int(ext.height / cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return arcpy.RasterToNumPyArray(raster, lowerLeft, ncols, nrows)

def adaptExtentUsingRaster(ext, raster, cellsize):
&amp;nbsp;&amp;nbsp;&amp;nbsp; ras_ext = arcpy.Describe(raster).extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmin = ext.XMin - ((ext.XMin - ras_ext.XMin) % cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ymin = ext.YMin - ((ext.YMin - ras_ext.YMin) % cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmax = ext.XMax + ((ras_ext.XMax - ext.XMax) % cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ymax = ext.YMax + ((ras_ext.YMax - ext.YMax) % cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return arcpy.Extent(xmin, ymin, xmax, ymax)

def getRasterCellSize(raster):
&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(raster)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return (desc.meanCellHeight + desc.meanCellWidth) / 2

def getSlope(polyline):
&amp;nbsp;&amp;nbsp;&amp;nbsp; cellsize = getRasterCellSize(dem)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts = [polyline.firstPoint, polyline.lastPoint]
&amp;nbsp;&amp;nbsp;&amp;nbsp; elevs = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for pnt in pnts:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext1 = createExtentForPoint(pnt, cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext2 = adaptExtentUsingRaster(ext1, dem, cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; np = createNumpyArrayUsingExtent(dem, ext2, cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row, col = getRowColExtentFromXY(ext2, pnt, cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z = np.item(row,col)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elevs.append(z)
&amp;nbsp;&amp;nbsp;&amp;nbsp; zdif = elevs[1] - elevs[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; slope = float(zdif / polyline.length)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return slope&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This was the result on my test set:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/108634_pastedImage_3.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;You can use the numeric format of the field to represent the calculated fraction as percentage.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:02:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725895#M86</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T07:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725896#M87</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great Stuff @Xander Bakker&lt;/P&gt;&lt;P&gt;I must get into the nut and bolts of geometry using Python myself, it will save me plenty of heartache. &lt;/P&gt;&lt;P&gt;Populating the 18000 records the first time took a bit but looks to be plain sailing running the code on small subsets. as will be the case hourly from now on. So for that, awesome effort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was also thinking if I should differentiate between up and down slope (-/+ ve) gradients mainly because I just am lazy and don't want to make a symbol set with both negative and positive values that looks the same color range in both directions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I might also just populate the Z values of the start and finish point plus (maybe) consider the 3d Length of the line between the start and finish point as it may impact the overall gradient a little . I am not sure reading what you have done thinks in a 3d sense or planimetric sense for the distance between start and finish points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also may need to do some error trapping if the polyline falls outside the extent of the DEM. (No such thing as a perfect world especially if it is displayed as incomplete data as is the case here for me.).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 21:36:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725896#M87</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-10T21:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725897#M88</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp; I'm glad it works for you. You are right, there is no error checking at all in the code I provided. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The slope is calculated by dividing the height difference (end elevation - start elevation) by the length (2D) of the polyline. If you would use the 3D length of the polyline, this would affect the slope in a incorrect way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the symbology you can also add another column and calculate the absolute slope and use that for symbology to avoid creating two ranges up- and downhill unless you want to use the symbology to distinguish between up- and downhill. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 22:09:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725897#M88</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-10T22:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725898#M89</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes Thanks Again &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;I realise the 3D length will not provide the "right" result but the difference in altitude of the first point vs. the last point in each segment will have a true length between them i.e. not in a flat 2D sense length. I was thinking of just applying basic trig as follows: (But only If I can be sure that the Z has not been accounted for already in this way?)&lt;/P&gt;&lt;H6&gt;i.e.&lt;/H6&gt;&lt;P&gt;A&lt;SPAN style="font-family: 'MS Reference Sans Serif','sans-serif';"&gt;²&lt;/SPAN&gt;+ B&lt;SPAN style="font-family: 'MS Reference Sans Serif','sans-serif'; color: black; background: white;"&gt;²&amp;nbsp; = &lt;SPAN style="font-size: 11.0pt; font-family: 'MS Reference Sans Serif','sans-serif';"&gt;√&lt;/SPAN&gt;&lt;/SPAN&gt;C&lt;/P&gt;&lt;H6&gt;or&lt;/H6&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;(zdif * zdif ) + (&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;polyline.length * &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;polyline.length)&lt;/SPAN&gt;&lt;/SPAN&gt; = (Squareroot 3dlength)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Re your&amp;nbsp; Absolute Slope, Thats a great approach, I was going to take the easy way, Reselect all Gradient less than zero and then multiply selected values&amp;nbsp; by negative 1 &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/blush.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And as for the lines outside of the DEM I have a similar selection process as above... I have a bounding polygon extent of the DEM,&amp;nbsp; so I perform a select by location of Road features that are completely contained by the&amp;nbsp; bounding polygons, then only perform the calculation on those records...&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 22:43:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725898#M89</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-10T22:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725899#M90</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The polyline length in the script is 2D, not 3D. So you can determine the 3D length (assuming gradual increase/decrease of elevation) using the Pythagoras theorem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 03:18:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725899#M90</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-11T03:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725900#M91</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are trying to add Z values to the vertices between the beginning and ending point, then I don't have any suggestions.&amp;nbsp; However, if you have already assigned Z values to your lines based on your surface and want to calculate M values that will provide the 3D length of your line and allow you to determine the 3D length at any vertice or interpolate the 3D length between any vertices of your line you can &lt;A _jive_internal="true" href="https://community.esri.com/message/357714#357714"&gt;download the Add-In I wrote from this post&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 03:43:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725900#M91</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-06-11T03:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725901#M92</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks @Richard Fairhurst that is another approach to getting the 3D length updated which is great if you shift lines, be good to look at how you did this so I could potentially use the same method to update start and finish point Z values&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 04:07:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725901#M92</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-11T04:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725902#M93</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Xander Bakker&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes because I only really need to know the 3Dlength of height variation, &lt;SPAN style="line-height: 1.5;"&gt; the assumption is that if the line is going from it's start point to it's finish point with a gradual continuous slope along the same line xy vertices to vertices ie as though the surface beneath the road is a continuous angled slope then I would need to apportion the variation in Z from vertices to vertices proportionately based on their xy location. This may be where the other Add surface information calculate functions come back into play, as mentioned in one of your first posts. Basically I am making a new surface from the height of the start point to the height of the finish point and then working out the 3D length of the same line on top of that new surface..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;IE cutting it into a hill or filling a valley as appropriate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If see where I am getting to? I will explain, I will want to eventually compare one surface to the next and determine these cuts and fills as surface volume of difference.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 04:26:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725902#M93</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-11T04:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725903#M94</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The tool is written in VB.Net and I have not published the code, just the add-in.&amp;nbsp; I will be working out a process to add Z values to vertices of pipelines soon.&amp;nbsp; A GIS tech is plotting the pipelines and adding a starting Z and ending Z from our improvement plans into two double fields.&amp;nbsp; She is not editing the actual Z values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will write a tool to add those Z values to the start and end points and interpolate the Z values for any vertices between using a constant rate of ascent or descent based on the 2D lengths between vertices.&amp;nbsp; For pipelines this should be fine since they do not follow any surface model and are only meant to change vertical direction where elevations are given.&amp;nbsp; Generally the pipelines are being broken where significant changes of direction occur, but only if an elevation is indicated.&amp;nbsp; True curves are being used for pipes that turn corners, so for those I usually only have to apply the start and end Z values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, I was waiting for a significant number of pipes to be plotted before developing the tool, but I think that point has been reached.&amp;nbsp; I have to develop my tools in .Net, because we use true curves, which python geometry methods do not support and would corrupt.&amp;nbsp; My tools also have to support both versioned and non-versioned SDE editing and non-SDE editing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 05:24:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725903#M94</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-06-11T05:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725904#M95</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, I understand. To change a copy of your DEM to the new road might be a little more complex. With some small changes to the code, you can create a point featureclass with point using a defined interval on the line and extract the interpolated elevation of the road the the current DEM elevation and symbolize the difference (cut/fill). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would be interesting...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 16:31:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725904#M95</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-11T16:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725905#M96</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds great, keep me informed if you don't mind I am always looking at ways to improve these processes. I hadn't taken the similarity to pipelines as to what I am trying to achieve but their is certainly a lot of "shared fabric" in a 3D sense.&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;P&gt;Mat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 20:11:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725905#M96</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-11T20:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725906#M97</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander&lt;/P&gt;&lt;P&gt;Both to symbolize and to quantify cuts and fills into volume in cubic meters would be the ultimate goal. Again sort of goal, because potentially I could then start optimizing the volume variation to try to minimize the volume of soil moved. &lt;/P&gt;&lt;P&gt;As this is a green fields plan that seems to spawn from one need to the next. People are starting to realize the capability of GIS in the planning and civil / survey engineering sense. Allowing early decision models to be built on what if scenarios. In this case during the planning phase of new Harvest roads, and where they are being positioned for the least disturbance to the environment and possibly/probably the maximum return on capital spent. Doing so in a package that is not a CAD or civil road engineering design package seems logical to me too. As it will at minimum fill the gap between engineering design of every forest road section and peg layout in the field&amp;nbsp; without much more than dead reckoning.&lt;/P&gt;&lt;P&gt;Anyway back on Subject I welcome all input into this topic as it can and does spawn ideas that can be taken further in a wide range of 3D modelling scenarios.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Mat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 20:27:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725906#M97</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-11T20:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725907#M98</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Continuing a bit on this cut fill part of the problem, I created a script based on the previous code (or actually based on this post &lt;A href="https://community.esri.com/docs/DOC-2954" target="_blank"&gt;Extract Raster Values using Numpy&lt;/A&gt;​) that will create a point featureclass with the elevation of the projected road, the difference between elevation of the road and the DEM and an indication of Cut or Fill.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you visualize the result it may look like this:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/110520_pastedImage_35.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;This is a 3D view of the road (black, draped over the DEM) and the points represent the projected road with the gradual elevation. The points on the road indicate cut (blue) or fill (red) and the amount (elevation difference between projected road and DEM).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code used for this is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.overwriteOutput = True

&amp;nbsp;&amp;nbsp;&amp;nbsp; # inputs
&amp;nbsp;&amp;nbsp;&amp;nbsp; dem = r"D:\Xander\GeoNet\RoadSlope\gdb\test.gdb\DEM03"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = r"D:\Xander\GeoNet\AcresMultiSDE\roads.gdb\roads"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_out = r"D:\Xander\GeoNet\RoadSlope\gdb\test.gdb\points_v03"

&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_objid = "RoadObjectID"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_slope = "Slope"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_demZ = "ElevationDEM"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_roadZ = "ElevationRoad"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_difz = "ElevationDif"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_cutfill = "CutOrFill"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # describe input
&amp;nbsp;&amp;nbsp;&amp;nbsp; sr = arcpy.Describe(fc).spatialReference

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create output fc
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_ws, fc_name = os.path.split(fc_out)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureclass_management(out_path=fc_ws, out_name=fc_name,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometry_type="POINT", has_m="ENABLED",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; has_z="ENABLED", spatial_reference=sr)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # add fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; AddField(fc_out, fld_objid, "LONG")
&amp;nbsp;&amp;nbsp;&amp;nbsp; AddField(fc_out, fld_slope, "DOUBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; AddField(fc_out, fld_demZ, "DOUBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; AddField(fc_out, fld_roadZ, "DOUBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; AddField(fc_out, fld_difz, "DOUBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; AddField(fc_out, fld_cutfill, "TEXT", 12)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # get polyline and extract a part
&amp;nbsp;&amp;nbsp;&amp;nbsp; cellsize = getRasterCellSize(dem)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # start insert cursor output points
&amp;nbsp;&amp;nbsp;&amp;nbsp; flds_out = ("SHAPE@", fld_objid, fld_slope, fld_demZ, fld_roadZ, fld_difz, fld_cutfill)
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.InsertCursor(fc_out, flds_out) as curs_out:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flds = ("SHAPE@", "OID@")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(fc, flds) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oid = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts = [polyline.firstPoint, polyline.lastPoint]

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # slope of projected road
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elevs = []
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for pnt in pnts:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # get extent from point and adapt extent to raster
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext1 = createExtentForPoint(pnt, cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext2 = adaptExtentUsingRaster(ext1, dem, cellsize)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create numpy array
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; np = createNumpyArrayUsingExtent(dem, ext2, cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r, c = getRowColExtentFromXY(ext2, pnt, cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z = np.item(r, c)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elevs.append(z)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zdif = elevs[1] - elevs[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; slope = float(zdif / polyline.length)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # get extent of line
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext1 = getExtentFromPolyline(polyline)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext2 = adaptExtentUsingRaster(ext1, dem, cellsize)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create numpy array
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; np = createNumpyArrayUsingExtent(dem, ext2, cellsize)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # loop through points and extract values from raster
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts = getListOfPointsFromPolyline(polyline, cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l = polyline.length
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for pnt in pnts:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r, c = getRowColExtentFromXY(ext2, pnt, cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z = np.item(r, c)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; frac = float(d) / float(l)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z_pnt = zdif * frac + elevs[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dif_road_dem = z_pnt - z
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if dif_road_dem &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cutfill = "Fill"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif dif_road_dem &amp;lt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cutfill = "Cut"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cutfill = "-"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z = None
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; frac = float(d) / float(l)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z_pnt = zdif * frac + elevs[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dif_road_dem = None
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cutfill = "Error"

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # write to output
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2 = arcpy.Point(pnt.X, pnt.Y, z_pnt, d)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt_geo = arcpy.PointGeometry(pnt2, sr, True, True)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row_out = ((pnt_geo, oid, slope, z, z_pnt, dif_road_dem, cutfill, ))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs_out.insertRow(row_out)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d += cellsize


def AddField(fc, fld_name, fld_type, fld_length=25):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(arcpy.ListFields(dataset=fc, wild_card=fld_name)) == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if fld_type == "TEXT":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(in_table=fc, field_name=fld_name,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field_type=fld_type, field_length=fld_length)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, fld_name, fld_type)

def createExtentForPoint(pnt, cellsize):
&amp;nbsp;&amp;nbsp;&amp;nbsp; return arcpy.Extent(pnt.X - cellsize, pnt.Y - cellsize, pnt.X + cellsize, pnt.Y + cellsize)

def getRowColExtentFromXY(ext, pnt, cellsize):
&amp;nbsp;&amp;nbsp;&amp;nbsp; # r, c start at 0 from upper left
&amp;nbsp;&amp;nbsp;&amp;nbsp; col = int(((pnt.X - ext.XMin) - ((pnt.X - ext.XMin) % cellsize)) / cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = int(((ext.YMax - pnt.Y) - ((ext.YMax - pnt.Y) % cellsize)) / cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return row, col

def createNumpyArrayUsingExtent(raster, ext, cellsize):
&amp;nbsp;&amp;nbsp;&amp;nbsp; lowerLeft = arcpy.Point(ext.XMin, ext.YMin)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ncols = int(ext.width / cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; nrows = int(ext.height / cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return arcpy.RasterToNumPyArray(raster, lowerLeft, ncols, nrows)

def adaptExtentUsingRaster(ext, raster, cellsize):
&amp;nbsp;&amp;nbsp;&amp;nbsp; ras_ext = arcpy.Describe(raster).extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmin = ext.XMin - ((ext.XMin - ras_ext.XMin) % cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ymin = ext.YMin - ((ext.YMin - ras_ext.YMin) % cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmax = ext.XMax + ((ras_ext.XMax - ext.XMax) % cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ymax = ext.YMax + ((ras_ext.YMax - ext.YMax) % cellsize)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return arcpy.Extent(xmin, ymin, xmax, ymax)

def getRasterCellSize(raster):
&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(raster)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return (desc.meanCellHeight + desc.meanCellWidth) / 2

def getListOfPointsFromPolyline(line, interval):
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; d = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; max_len = line.length
&amp;nbsp;&amp;nbsp;&amp;nbsp; while d &amp;lt; max_len:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = line.positionAlongLine(d, False)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts.append(pnt.firstPoint)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d += interval
&amp;nbsp;&amp;nbsp;&amp;nbsp; # pnts.append(line.lastPoint)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return pnts

def getExtentFromPolyline(line):
&amp;nbsp;&amp;nbsp;&amp;nbsp; return line.extent

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usage:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;line 8: reference to DEM&lt;/LI&gt;&lt;LI&gt;line 9: reference to 2D roads&lt;/LI&gt;&lt;LI&gt;line 10: output point featureclass (will be created)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Please note that code and the previous code will only work correct if the cellsize is round number.&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:02:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725907#M98</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T07:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: I have a Polyline Feature class that I wish to maintain in 3D Editing</title>
      <link>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725908#M99</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very clever, now to give the same points width ie make the road 7 metres total width and to quantify the volume cut or filled from the 3d surface and the new 3d Road surface, I suppose I could get a property of the road direction or buffer these points by a 3.5 metre wide buy half the distance to the next or previous point and make that a rectangle and also place this rectangle on the same gradient. i.e. two from corners are half the height difference to the previous entity, and the two to corners are half the height difference to the next two corners (this may not work too well in a bend sense, maybe I have to buffer with the round function so as each polygon at least sort of meets up.&lt;/P&gt;&lt;P&gt;Realistically I was going to generate a new surface at a set width from the road centreline and be able to use this surface as a slice line to quantify volume above or below the original surface.&lt;/P&gt;&lt;P&gt;I know I dont want much, if too hard I understand, as you lost me in how you got to where we are a while back, all I know is it does work to visualise the result So I thank you for that.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Now I want to quantify it in terms of volume differences between the surfaces. and in so doing built a "pseudo road engineering package" out of GIS. Which is so cool I think Thanks &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 00:11:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/i-have-a-polyline-feature-class-that-i-wish-to/m-p/725908#M99</guid>
      <dc:creator>MathieuBoonen</dc:creator>
      <dc:date>2015-06-17T00:11:57Z</dc:date>
    </item>
  </channel>
</rss>

