AnsweredAssumed Answered

Sight lines and intervisibility in Python script

Question asked by gabrif7 on Mar 28, 2018

I am trying to run several tools in a stand-alone Python script. The steps that I want to implement are the follow:

- load a point (observer points) and a building (target) shapefiles.

- construct sight lines from each observer-point to each building, considering the height of the buildings

- extrude the buildings based on their max height

- use the same buildings, extruded, to check whether each sight lines ha actually visibility or whether is obstructed (intervisibility analysis). 


I don't have issues in constructing the sight lines. However, even though the following intervisibility method, applied to those lines, is successful, each line results visible. Do you have any suggestion? It looks like at the end the buildings are not extruded at all. I know that I may implement these steps manually, but I do prefer to have everything running from a stand-alone scripts.


this is my code:


import arcpy
arcpy.env.workspace = "../Outputs/tmp"



observer_points = "nodes_copy.shp"
buildings = "buildingsBase.shp"
sightlines_file ="sightlines.shp"
height_observer = "height" 
heigth_buildings = "height"
join_field = None
sampling = 10


# transforming shapefile in layer, extrude it and save it as 3d feature class

buildings_layer = arcpy.MakeFeatureLayer_management(buildings, "as_layer").getOutput(0)
buildings_layer.extrusion("BASE_HEIGHT", "height")
arcpy.Layer3DToFeatureClass_3d(buildings_layer, "buildings_extruded")


#sight lines
arcpy.ddd.ConstructSightLines(observer_points, buildings, sightlines_file,
height_observer, heigth_buildings, join_field, sampling, direction)


arcpy.ddd.Intervisibility(sightlines_file, obstructions= "buildings_extruded.shp", visible_field="Visibility")