ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

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

ArcGIS Online

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

ArcGIS Desktop

完全なプロ仕様の GIS

ArcGIS Enterprise

エンタープライズ GIS

ArcGIS Developers

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

ArcGIS Solutions

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

ArcGIS Marketplace

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

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

ArcMap

  • ホーム
  • はじめに
  • マップ
  • 解析
  • データ管理
  • ツール
  • エクステンション

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

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

概要

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

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

使用法

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

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

    • ルート
    • 到達圏
    • 最寄り施設の検出
    • 配車ルート (VRP)

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

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

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

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

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

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

構文

arcpy.na.CopyTraversedSourceFeatures(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

派生した出力

名前説明データ タイプ
edge_features

ネットワーク解析で通過したネットワーク データセットのエッジを含むフィーチャクラス。

フィーチャ クラス
junction_features

ネットワーク解析で通過したネットワーク データセットのジャンクションを含むフィーチャクラス。

フィーチャ クラス
turn_table

ネットワーク解析で通過したネットワーク データセットのターンを含むテーブル。

テーブル
modified_input_network_analysis_layer

解析されたネットワーク解析レイヤー。

Network Analyst レイヤー

コードのサンプル

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 occurred on line %i" % tb.tb_lineno
    print str(e)

環境

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

ライセンス情報

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

関連トピック

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

ArcGIS Desktop

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

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

Esri について

  • 会社概要
  • 採用情報
  • Esri ブログ
  • ユーザ カンファレンス
  • デベロッパ サミット
Esri
ご意見・ご感想をお寄せください。
Copyright © 2021 Esri. | プライバシー | リーガル