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

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

ルート案内 (Directions)

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

概要

ルートに基づいて、ネットワーク解析レイヤーから詳細なルート案内を生成します。ルート案内は、テキスト形式、XML 形式、または HTML 形式のファイルに書き込むことができます。適切なスタイルシートを用意すれば、ルート案内は他の任意のファイル形式に書き込むことができます。

使用法

  • このツールは、ネットワーク解析レイヤーに有効な結果がなければその解析を実行するため、ルート案内を生成する前にネットワーク解析レイヤーを解析する必要はありません。

構文

arcpy.na.Directions(in_network_analysis_layer, file_type, out_directions_file, report_units, {report_time}, {time_attribute}, {language}, {style_name}, {stylesheet})
パラメーター説明データ タイプ
in_network_analysis_layer

ルート案内を生成するネットワーク解析レイヤー。ルート案内は、ルート、最寄り施設、および配車ルート ネットワーク解析レイヤーに対してのみ生成することができます。

Network Analyst Layer
file_type

出力されるルート案内ファイルの形式。スタイルシート パラメーターが値を持つ場合、このパラメーターは無視されます。

  • XML —出力のルート案内ファイルは XML ファイルとして生成されます。ファイルにはルート案内用文字列およびルートの距離、時間の情報とは別に、移動方向タイプおよび各方向のターン角度に関する情報も含まれます。
  • TEXT —出力のルート案内ファイルはルート案内用文字列、ルートの距離、時間 (オプション) の情報を含む単純な TXT ファイルとして生成されます。
  • HTML —出力のルート案内ファイルはルート案内用文字列、ルートの距離、時間 (オプション) の情報を含む HTML ファイルとして生成されます。
String
out_directions_file

stylesheet パラメーターにスタイルシートを指定する場合は、out_directions_file のファイル接尾辞が、スタイルシートが生成するファイル タイプに一致することを確認してください。

File
report_units

ルート案内ファイルで距離の情報を出力する際の距離単位を指定します。たとえば、インピーダンスがメートル単位の場合でも、ルート案内をマイル単位で表示することができます。

  • Feet —フィート
  • Yards —ヤード
  • Miles —マイル
  • Meters —メートル
  • Kilometers —キロメートル
  • NauticalMiles —海里
String
report_time
(オプション)
  • NO_REPORT_TIME —ルート案内ファイルに移動時間を出力しません。
  • REPORT_TIME —ルート案内ファイルに移動時間を出力します。これがデフォルトです。
Boolean
time_attribute
(オプション)

ルート案内の移動時間を提供する時間ベースのコスト属性。入力ネットワーク解析レイヤーで使用されるネットワーク データセットには、コスト属性が必ず存在する必要があります。

String
language
(オプション)

ルート案内を生成するときの言語を選択します。ドロップダウン リストに表示される言語は、コンピューターにインストールされている ArcGIS 言語パックに依存します。

このツールをサービスの一部として別のサーバー上で公開する予定の場合、ツールが正しく機能するためには、選択する言語に対応する ArcGIS 言語パックがそのサーバー上にインストールされている必要があります。また、言語パックがコンピューター上にインストールされていない場合、その言語はドロップダウン リストに表示されませんが、選択する代わりに言語コードを入力することができます。

String
style_name
(オプション)

ルート案内の書式スタイルの名前を選択します。

  • NA Desktop —印刷可能な詳細なルート案内
  • NA Navigation —車載ナビゲーション デバイス用に設計された詳細なルート案内
  • NA Campus —歩行者ルート用に設計された詳細な歩行ルート案内
String
stylesheet
(オプション)

書式設定された出力ファイル タイプ (PDF、Word、または HTML ファイルなど) を生成するためのスタイルシート。[出力ルート案内ファイル] パラメーターのファイル接尾辞は、スタイルシートが生成するファイル タイプに一致している必要があります。このパラメーターが値を持つ場合、[ルート案内 (Directions)] ツールは [出力ルート案内ファイル] パラメーターをオーバーライドします。

ヒント:

独自のテキストおよび HTML スタイルシートの作成をスムーズに開始したい場合は、Network Analyst が使用するスタイルシートをコピーして編集します。これらは、以下のディレクトリにあります。<ArcGIS installation directory>\ArcGIS\Desktop10.2.1\NetworkAnalyst\Directions\Styles スタイルシートは Dir2PHTML.xsl、テキスト スタイルシートは Dir2PlainText.xsl です。

File

派生した出力

名前説明データ タイプ
output_layer

ルートに基づいて更新されたネットワーク解析レイヤー。

Network Analyst レイヤー

コードのサンプル

Directions (ルート案内) の例 1 (Python ウィンドウ)

すべてのパラメーターを付与して、Directions (ルート案内) ツールを実行します。

arcpy.na.Directions("Route", "TEXT", "C:/Data/Route_Directions.txt", "Miles",
                    "REPORT_TIME", "Minutes")
Directions (ルート案内) の例 2 (ワークフロー)

次のスタンドアロン Python スクリプトは、Directions (ルート案内) ツールを使用してルートの道順案内を HTML ファイルで生成する方法を示しています。

# Name: Directions_Workflow.py
# Description: Generate driving directions in a html file for a route that 
#              visits the store locations in the best sequence that minimizes 
#              the total travel time
# 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/SanFrancisco.gdb"
    env.overwriteOutput = True
    
    #Set local variables
    inNetworkDataset = "Transportation/Streets_ND"
    outNALayerName = "StoreRoute"
    impedanceAttribute = "TravelTime"
    startLocation = "Analysis/DistributionCenter"
    storeLocations = "Analysis/Stores"
    #fieldMappings = "Name Name #; Attr_TravelTime ServiceTime #"
    outDirectionsFile = "C:/data/output" + "/" + outNALayerName + "Directions.html"
    outLayerFile = "C:/data/output" + "/" + outNALayerName + ".lyr"
    
    #Create a new route layer. The route starts at the distribution center and 
    #takes the best sequence to visit the store locations.
    outNALayer = arcpy.na.MakeRouteLayer(inNetworkDataset, outNALayerName,
                                         impedanceAttribute, "FIND_BEST_ORDER",
                                         "PRESERVE_FIRST","",['Meters'],
                                         "NO_UTURNS",start_date_time="8 AM")
    
    #Get the layer object from the result object. The route layer can 
    #now be referenced using the layer object.
    outNALayer = outNALayer.getOutput(0)
    
    #Get the names of all the sublayers within the route layer.
    subLayerNames = arcpy.na.GetNAClassNames(outNALayer)
    #Stores the layer names that we will use later
    stopsLayerName = subLayerNames["Stops"]
    
    #Load the distribution center as the start location using default field 
    #mappings and search tolerance
    arcpy.na.AddLocations(outNALayer,stopsLayerName,startLocation,"","",
                          exclude_restricted_elements = "EXCLUDE")
    
    #Load the store locations as stops. Make sure the store locations are 
    #appended to the Stops sublayer which already contains the distribution 
    #center location. Map the Attr_TravelTime property from the ServiceTime 
    #field so that the total travel time for the route will also contain the 
    #service time using the field mappings
    fieldMappings = arcpy.na.NAClassFieldMappings(outNALayer, stopsLayerName)
    fieldMappings["Name"].mappedFieldName = "Name"
    fieldMappings["Attr_" + impedanceAttribute].mappedFieldName = "ServiceTime"
    arcpy.na.AddLocations(outNALayer, stopsLayerName, storeLocations,
                          fieldMappings, "", append="APPEND",
                          exclude_restricted_elements = "EXCLUDE")
    
    #Generate driving directions in a HTML file
    arcpy.na.Directions(outNALayer,"HTML",outDirectionsFile,"Miles",
                        "REPORT_TIME",impedanceAttribute)
    
    #Save the solved na 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 occurred on line %i" % tb.tb_lineno
    print str(e)

環境

  • 現在のワークスペース

ライセンス情報

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

関連トピック

  • 解析ツールセットの概要

ArcGIS Desktop

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

ArcGIS

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

Esri について

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