ArcGIS for Desktop

  • ドキュメント
  • 価格
  • サポート

  • My Profile
  • ヘルプ
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

組織のマッピング プラットフォーム

ArcGIS for Desktop

完全なプロ仕様の GIS

ArcGIS for Server

エンタープライズ GIS

ArcGIS for Developers

位置情報利用アプリの開発ツール

ArcGIS Solutions

各種業界向けの無料のテンプレート マップおよびテンプレート アプリケーション

ArcGIS Marketplace

組織で使えるアプリとデータを取得

  • ドキュメント
  • 価格
  • サポート
Esri
  • サイン イン
user
  • マイ プロフィール
  • サイン アウト

ヘルプ

  • ホーム
  • はじめに
  • マップ
  • 解析
  • データ管理
  • ツール
  • その他...

通過したソース フィーチャのコピー (Copy Traversed Source Features)

Network Analyst のライセンスで利用可能。

  • サマリ
  • 使用法
  • 構文
  • コードのサンプル
  • 環境
  • ライセンス情報

サマリ

2 つのフィーチャクラスと 1 つのテーブルを作成し、それらをすべて使用して、ネットワーク解析レイヤーの解析中に通過したエッジ、ジャンクション、およびターンに関する情報を格納します。

通過したソース フィーチャのコピーからの出力の詳細

使用法

  • このツールは入力ネットワーク解析レイヤーがまだ解析されていない場合は、その解析を実行します。解析レイヤーは、最後の解析の後に入力が変更された場合には、再解析されます。

  • 通過したソース フィーチャは、次のネットワーク解析レイヤーに対して生成できます。

    • ルート
    • 到達圏
    • 最寄り施設
    • 配車ルート

    通過したソース フィーチャは、次のレイヤーに対しては生成できません。

    • OD コスト マトリックス
    • ロケーション-アロケーション

  • 出力ジャンクション フィーチャクラスは、通過したネットワーク ジャックションを表すポイントだけでなく、次の場所を表すポイントも含みます。

    • 通過したポイント バリア
    • 通過したラインおよびポリゴン バリアの開始ポイントと終了ポイント
    • ルート解析の訪問ストップ
    • 到達圏解析における訪問施設と休憩の終了
    • 最寄り施設解析における訪問施設とインシデント
    • 配車ルートにおける訪問先、拠点、休憩

    通過したソース フィーチャのコピーからの出力の詳細

  • 出力フィーチャクラスの座標系を制御するには、出力座標系環境設定を指定するか、出力場所パラメーターの値としてジオデータベースのフィーチャ データセットを指定します。出力座標系環境設定が指定されず、出力場所パラメーターがフィーチャ データセットではない場合、出力フィーチャクラスの座標系は入力ネットワーク解析レイヤーの座標系と同じになります。

構文

CopyTraversedSourceFeatures_na (input_network_analysis_layer, output_location, edge_feature_class_name, junction_feature_class_name, turn_table_name)
パラメータ説明データ タイプ
input_network_analysis_layer

通過したソース フィーチャのコピー元になるネットワーク解析レイヤー。ネットワーク解析レイヤーに有効な結果がない場合は、結果を得るためにレイヤーが解析されます。

Network Analyst Layer
output_location

出力テーブルと 2 つのフィーチャクラスが保存されるワークスペース。

Workspace; Feature Dataset
edge_feature_class_name

通過したエッジ ソース フィーチャに関する情報が入るフィーチャクラスの名前。解析されたネットワーク解析レイヤーがエッジ フィーチャを通過しない場合は、空のフィーチャクラスが作成されます。

String
junction_feature_class_name

通過したジャンクション ソース フィーチャに関する情報が入るフィーチャクラスの名前。これには、システム ジャンクションと、入力ネットワーク解析レイヤーからの関連ポイントが含まれます。解析されたネットワーク解析レイヤーがジャンクションを通過しない場合は、空のフィーチャクラスが作成されます。

String
turn_table_name

基本エッジのコストを増減する、通過したグローバル ターンおよびターン フィーチャに関する情報が入るテーブルの名前。解析されたネットワーク解析レイヤーがターンを通過しない場合は、空のテーブルが作成されます。規制ターンは通過されないため、出力に含まれることはありません。

String

コードのサンプル

CopyTraversedSourceFeatures (通過したソース フィーチャのコピー) の例 1 (Python ウィンドウ)

次の Python ウィンドウ スクリプトは、CopyTraversedSourceFeatures (通過したソース フィーチャのコピー) ツールを使用して通過したエッジ、ジャンクション、およびターンをルート ネットワーク解析レイヤーから、メモリ内ワークスペースのフィーチャクラスとテーブルに書き込む方法を示しています。

arcpy.na.CopyTraversedSourceFeatures("Route", "C:/Data/Output.gdb",
                                     "TraversedEdges",
                                     "TraversedJunctions",
                                     "TraversedTurns")
CopyTraversedSourceFeatures (通過したソース フィーチャのコピー) の例 2 (ワークフロー)

次のスタンドアロン Python スクリプトは、CopyTraversedSourceFeatures (通過したソース フィーチャのコピー) を使用して、国勢調査地区の重心から最寄りの消防署までのルートに共通する道路を見つける方法を示しています。これらの結果は、どの道路が最も頻繁に使用される緊急時の経路かを示すために役立ちます。

# Name: CopyTraversedSourceFeatures_ex02.py
# Description: The scenario shows how to find the streets that are common to the
#              routes between the closest fire station and the census tract
#              centroids. These streets can be used to identify critical points
#              in case of an emergency. 
# Requirements: Network Analyst Extension 

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

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

    #Set environment settings
    env.workspace = "C:/data/SanFrancisco.gdb"
    env.overwriteOutput = True
    
    #Set local variables
    inNetworkDataset = "Transportation/Streets_ND"
    outNALayerName = "EmergencyRoutes"
    impedanceAttribute = "TravelTime"
    inFacilities = "Analysis/FireStations"
    inIncidents = "Analysis/TractCentroids"
    edgeFrequency = "in_memory/EdgeFrequency"
    outLayerFile = "C:/data/output" + "/" + outNALayerName + ".lyr"
    outFeatures = "CriticalStreets"
    
    #Create a new closest facility analysis layer. For this scenario, the default 
    #value for all the remaining parameters statisfies the analysis requirements
    outNALayer = arcpy.na.MakeClosestFacilityLayer(inNetworkDataset, outNALayerName,
                                                   impedanceAttribute, "TRAVEL_FROM")
    
    #Get the layer object from the result object. The closest facility layer can 
    #now be referenced using the layer object.
    outNALayer = outNALayer.getOutput(0)
    
    #Get the names of all the sublayers within the closest facility layer.
    subLayerNames = arcpy.na.GetNAClassNames(outNALayer)
    #Stores the layer names that we will use later
    facilitiesLayerName = subLayerNames["Facilities"]
    incidentsLayerName = subLayerNames["Incidents"]
    
    #Load fire station features as facilities and ensure that they are not
    #located on restricted portions of the network. Use default field mappings
    #and search tolerance
    arcpy.na.AddLocations(outNALayer,facilitiesLayerName,inFacilities,"", "",
                          exclude_restricted_elements = "EXCLUDE")
    
    #Load tract centroids as incidents and ensure that they are not located on
    #restricted portions of the network. Map the ID field from Tract Centroids
    #as the name for incidents using field mappings
    fieldMappings = arcpy.na.NAClassFieldMappings(outNALayer, incidentsLayerName)
    fieldMappings['Name'].mappedFieldName = "ID"
    arcpy.na.AddLocations(outNALayer,incidentsLayerName, inIncidents,
                          fieldMappings,"", exclude_restricted_elements = "EXCLUDE")
    
    #Solve the closest facility layer and copy the travered source features to a
    #temporary in-memory workspace. Use default names for the output feature
    #classes and table. Get only the first output which are the edges traversed.
    traversedEdges = arcpy.na.CopyTraversedSourceFeatures(outNALayer,
                                                          "in_memory").getOutput(0)
    
    #Calculate the frequency of SourceOID in the traversed edges
    arcpy.analysis.Frequency(traversedEdges, edgeFrequency,
                             ["SourceOID", "SourceName"])
    
    #Get the full path to the streets feature class by describing the network
    #dataset referenced by the network analysis layer. 
    network = arcpy.Describe(outNALayer.dataSource)
    edgeSources = network.edgeSources
    for es in edgeSources:
        if es.name.lower() == "streets":
            streetsSource = os.path.join(os.path.dirname(network.catalogPath),
                                         es.name)
            break
    else:
        raise Exception("Failed to detrmine the path for the streets feature class")
    
    #Join the frequency field to the streets feature class. In order to speed up
    #the join select the streets that share a line segment with traversed streets.
    streetsLayer = "StreetsLayer"
    arcpy.management.MakeFeatureLayer(streetsSource,streetsLayer)
    arcpy.management.SelectLayerByLocation(streetsLayer, "SHARE_A_LINE_SEGMENT_WITH",
                                           traversedEdges)
    arcpy.management.JoinField(streetsLayer, "ObjectID", edgeFrequency,
                               "SourceOID", "FREQUENCY")
    
    #Copy the streets that have a frequency value to a new feature class.
    arcpy.management.SelectLayerByAttribute(streetsLayer, "SUBSET_SELECTION",
                                            "FREQUENCY IS NOT NULL")
    arcpy.management.CopyFeatures(streetsLayer,outFeatures)
    
    #Delete the Frequency field from the streets feature class
    arcpy.management.DeleteField(streetsLayer, "FREQUENCY")

    #Save the solved na layer as a layer file on disk with relative paths
    arcpy.management.SaveToLayerFile(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)

環境

  • 現在のワークスペース
  • 出力データの座標系

ライセンス情報

  • ArcGIS for Desktop Basic: 次のものが必要 Network Analyst
  • ArcGIS for Desktop Standard: 次のものが必要 Network Analyst
  • ArcGIS for Desktop Advanced: 次のものが必要 Network Analyst

関連トピック

  • 通過したソース フィーチャのコピーからの出力
このトピックへのフィードバック

ArcGIS for Desktop

  • ホーム
  • ドキュメント
  • 価格
  • サポート

ArcGIS プラットフォーム

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

Esri について

  • 会社概要
  • 採用情報
  • スタッフ ブログ
  • ユーザ カンファレンス
  • デベロッパ サミット
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | プライバシー | リーガル