Select to view content in your preferred language

Sight lines and intervisibility in Python script

905
0
03-28-2018 07:03 AM
GabrieleFilomena
New Contributor

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"

arcpy.CheckOutExtension("3D")

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

# 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)

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

0 Kudos
0 Replies