LineDensity(in_polyline_features, population_field, {cell_size}, {search_radius}, {area_unit_scale_factor})
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outLDens = LineDensity("roads.shp", "LENGTH", 45, 1000, "SQUARE_MILES")
outLDens.save("C:/sapyexamples/output/ldensout")
# Name: LineDensity_Ex_02.py
# Description: Calculates a magnitude per unit area from polyline features
# that fall within a radius around each cell.
# Requirements: Spatial Analyst Extension
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inPolylineFeatures = "roads.shp"
populationField = "length"
cellSize = 120
searchRadius = 1500
# Execute LineDensity
outLineDensity = LineDensity(inPolylineFeatures, populationField, cellSize,
searchRadius, "SQUARE_MILES")
# Save the output
outLineDensity.save("C:/sapyexamples/output/linedensity")