2

I want to get elevation profile in ArcScene using arcpy. Specifically, I want to create tool used as follows: click tool button, draw line interactively and output a graph presenting elevation profile.

My idea is to use arcpy addin tool and arcpy.StackProfile_3d() like this:

class DrawTool(object):
    def __init__(self):
        self.enabled = True
        self.shape = "Line"
    def onLine(self, line_geometry):
        rasters = arcpy.ListRasters()
        table = arcpy.CreateUniqueName('profile_table', 'in_memory')
        graphName = 'Sample graph'
        arcpy.StackProfile_3d(line_geometry, rasters, table, graphName)

Unfortunately, line_geometry seem to be the problem here (a result of above code is just empty graph). I tried supplying a line shape in place of line_geometry and it works fine:

def onLine(self, line_geometry):
    ...
    line = r"line.shp"
    arcpy.StackProfile_3d(line, rasters, table, graphName)

Is it possible to convert line_geometry somehow so that it fits into StackProfile_3d()?

  • I managed to achieve what I wanted using C# ArcObjects' API - it appears way more powerful than Python's API. – dimril Jun 27 '15 at 11:55

Your Answer

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

Browse other questions tagged or ask your own question.