解析レイヤの属性パラメータの更新(Update Analysis Layer Attribute Parameter) (Network Analyst)
サマリ
ネットワーク解析レイヤのネットワーク属性パラメータ値を更新します。このツールは、[解析の実行(Solve)] ツールで解析を実行する前に、ネットワーク解析レイヤの属性パラメータの値を更新するために使用する必要があります。これにより、解析操作において指定した属性パラメータの値が確実に使用され、適切な結果を得ることができます。
使用法
-
パラメータ化されたネットワーク属性は、リアルタイムに変化する属性値をモデリングするために使用されます。たとえば、12 フィートの車高規制があるトンネルをパラメータを使用してモデリングできます。この場合、車両の高さ(フィート)をパラメータ値として指定する必要があります。この規制は車両の高さが 12 フィートを超える場合に true に評価されます。同様に、橋は重量規制を指定するパラメータを保持することができます。
-
このツールは、定義されたパラメータが設定されたネットワーク属性を持つネットワーク解析レイヤのみに使用される必要があります。
-
このツールは、ネットワーク解析レイヤで解析を実行する前に、繰り返し既存のパラメータの値を変更するのに使用できます。
-
カタログ ウィンドウまたは ArcCatalog のネットワーク データセット プロパティ ダイアログ ボックスで、新しい属性パラメータを作成することができます。
構文
| パラメータ | 説明 | データ タイプ |
in_network_analysis_layer |
属性パラメータが更新されるネットワーク解析レイヤ。 | Network Analyst Layer |
parameterized_attribute |
属性パラメータが更新されるネットワーク属性。 | String |
attribute_parameter_name |
更新されるネットワーク属性のパラメータ。このツールでは、Object タイプのパラメータは更新できません。 | String |
attribute_parameter_value (オプション) |
属性パラメータに設定される値。文字列、数値、日付、またはブール値(True、False)のいずれかになります。値が指定されていない場合、属性パラメータ値は NULL に設定されます。 ヒント: パラメータ値に複数の値を指定する場合は、現在設定されている区切り文字を使用して、各値を区切ってください。たとえばアメリカ合衆国では、項目の区切り文字としてカンマをよく使用します。3 つの数字を「5,10,15」のように表します。 | String |
コードのサンプル
すべてのパラメータを使用してツールを実行します。
import arcpy
arcpy.UpdateAnalysisLayerAttributeParameter_na("Route","HeightRestriction",
"MaxHeight",12.0)
次のスタンドアロン Python スクリプトは、UpdateAnalysisLayerAttributeParameter(解析レイヤの属性パラメータの更新)ツールを使用して、車両に対する高さ制限が低い高架またはトンネルを避ける最適ルートを検索する方法を示しています。
# Name: UpdateAnalysisLayerAttributeParameter_Workflow.py
# Description: Find the best route that avoids low clearance overpasses or
# tunnels for certain vehicles and save results to a layer file.
# 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"
outNALayer = "BestTruckRoute"
impedanceAttribute = "TravelTime"
accumulateAttribute = ['Length']
parameterizedAttribute = "HeightRestriction"
restrictions = ["Oneway", parameterizedAttribute, "TurnRestriction"]
searchTolerance = "2000 Meters"
parameterName = "VehicleHeight"
truckHeight = 15
inStops = "Analysis/DeliveryLocations"
outLayerFile = "C:/data/output" + "/" + outNALayer + ".lyr"
#Make a new route layer. Along with the total travel time, we also want to
#find out the total distance. So we accumulate "Length" attribute. We want
#to obey the oneway, turn restrictions and since we are routing trucks that
#need a particular clearence, we want to use Height restriction.
arcpy.MakeRouteLayer_na(inNetworkDataset, outNALayer, impedanceAttribute,
"", "", "", accumulateAttribute,"NO_UTURNS",
restrictions)
#Load the Delivery locations as stops using default field map
arcpy.AddLocations_na(outNALayer, "Stops", inStops, "", searchTolerance)
#As we wish to route trucks which require a clearance of 15 meters,
#we will set the VehicleHeight parameter on HeightRestriction attribute.
#This would mean that all streets which have a clearance of less than 15
#meters will be restricted.
arcpy.UpdateAnalysisLayerAttributeParameter_na(outNALayer,
parameterizedAttribute,
parameterName, truckHeight)
#Solve the route layer
arcpy.Solve_na(outNALayer)
#Save the solved route layer as a layer file on disk using relative paths
arcpy.SaveToLayerFile_management(outNALayer,outLayerFile,"RELATIVE")
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)
