ネットワークのアップグレード(Upgrade Network) (Network Analyst)

サマリ

ネットワーク データセットのスキーマをアップグレードします。ネットワーク データセットをアップグレードすると、ネットワーク データセットは現在のソフトウェア リリースで使用可能な新しい機能を使用できるようになります。

使用法

構文

UpgradeNetwork_na (in_network_dataset)
パラメータ説明データ タイプ
in_network_dataset

アップグレードするネットワーク データセット。ネットワーク データセットは、ジオデータベースベースのネットワーク データセットである必要があります。

Network Dataset Layer

コードのサンプル

UpgradeNetwork(ネットワークのアップグレード)の例 1(Python ウィンドウ)

すべてのパラメータを使用してツールを実行します。

import arcpy
arcpy.env.workspace = "C:/Data/Socal.gdb"
arcpy.UpgradeNetwork_na("Transportation/Streets_ND")
UpgradeNetwork(ネットワークのアップグレード)の例 2(ワークフロー)

次のスタンドアロン Python スクリプトは、UpgradeNetwork(ネットワークのアップグレード)ツールを使用してネットワーク データセットのスキーマをアップグレードする方法を示しています。

# Name: UpgradeNetwork_Workflow.py
# Description: Upgrades the schema of a network dataset by first upgrading the 
#              geodatabase containing the network dataset and then upgrading the
#              network dataset. The network dataset is also built so that it can
#              be used to perform network analyses.
# Requirements: Network Analyst Extension 

#Import system modules
import arcpy
from arcpy import env

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

    #Set environment settings
    env.workspace = "C:/data/RhodeIsland.gdb"
    env.overwriteOutput = True
    
    #Set local variables
    #inNetworkDataset = "Transportation/Streets_ND"
    inNetworkDataset = "RhodeIsland/RhodeIsland_ND"
    
    #Before upgrading the network dataset, upgrade the file GDB that contains
    #the network dataset
    arcpy.UpgradeGDB_management(env.workspace)
    
    #Upgrade the network dataset
    arcpy.UpgradeNetwork_na(inNetworkDataset)
    
    #The upgraded network dataset is not built. So build the network dataset
    arcpy.BuildNetwork_na(inNetworkDataset)
    
    print "Script completed successfully"

except Exception as e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "An error occured on line %i" % tb.tb_lineno
    print str(e)

環境


7/10/2012