构建网络 (Network Analyst)

许可等级:BasicStandardAdvanced

摘要

重新构建网络数据集的网络连通性和属性信息。对参与源要素类中的属性或要素进行编辑后,需要重新构建网络数据集。如果编辑的是源要素,该工具将仅对执行了编辑操作的区域建立网络连通性以便加快构建过程;但如果编辑的是网络属性,将会重新构建整个范围的网络数据集。对于大型网络数据集来说,这个操作可能会花费很长时间。

用法

语法

BuildNetwork_na (in_network_dataset)
参数说明数据类型
in_network_dataset

要构建的网络数据集。

Network Dataset Layer

代码实例

构建网络 (BuildNetwork) 示例 1(Python 窗口)

使用所有参数执行此工具。

import arcpy
arcpy.env.workspace = "C:/ArcTutor/Network Analyst/Tutorial/Paris.gdb"
arcpy.na.BuildNetwork("Transportation/ParisMultimodal_ND")
构建网络 (BuildNetwork) 示例 2(独立 Python 脚本)

以下 Python 脚本演示了如何在独立脚本中使用构建网络 (BuildNetwork) 工具。

# Name: BuildNetwork_ex02.py
# Description: Build a network dataset.
# Requirements: Network Analyst Extension 

#Import system modules
import sys
import os
import shutil
import arcpy
from arcpy import env

#Check out the Network Analyst extension license
arcpy.CheckOutExtension("Network")

#Set environment settings
env.workspace = "C:/data/SanFrancisco.gdb"

#Set local variables
inNetworkDataset = "Transportation/Streets_ND"

#Build the network dataset
arcpy.na.BuildNetwork(inNetworkDataset)

#If there are any build errors, they are recorded in a BuildErrors.txt file
#present in the system temp directory. So copy this file to the directory
#containing this script

#First get the path to the system temp directory
tempDir = os.environ.get("TEMP")
if tempDir:
    shutil.copy2(os.path.join(tempDir,"BuildErrors.txt"),sys.path[0])

print "Script completed successfully."

环境

相关主题

许可信息

ArcGIS for Desktop Basic:需要 Network Analyst
ArcGIS for Desktop Standard:需要 Network Analyst
ArcGIS for Desktop Advanced:需要 Network Analyst
9/15/2013