摘要
Appends event records from a table, layer, or feature class to an existing Esri Roads and Highways event feature class.
用法
The Input Event parameter can be a table, layer, or feature class.
The Target Event parameter should be a layer or feature class registered with Roads and Highways.
This tool supports both point and polyline features. The feature type in the input and target event parameters should match.
For more information about the fields required in Roads and Highways event feature classes, see the Events data model.
If the Generate EventID GUIDs for loaded events option is checked and you want GUIDs generated, you should either not map the EventID field in the field mapping section or have Null records in the EventID column in the source event data. If the EventID field in a source event record is populated and the Generate EventID GUIDs for loaded events option is checked, the value in the source event record EventID field will be loaded into the target event.
语法
AppendEvents_locref (in_dataset, in_target_event, field_mapping, {load_type}, {generate_event_ids}, {generate_shapes})
参数 | 说明 | 数据类型 |
in_dataset | The source event records to append. | Table View |
in_target_event | The Roads and Highways event layer or feature class to which the source event records will be appended. | Feature Layer |
field_mapping | Controls how the attribute information in the fields of the in_dataset is transferred to the in_target_event. Because the data of the in_dataset is appended to an existing event that has a predefined schema (field definitions), fields cannot be added or removed from the target dataset. While you can set merge rules for each output field, the tool ignores those rules. The ArcPy FieldMappings class can be used to define this parameter. | Field Mappings |
load_type (可选) | Specifies how appended events with measure or temporality overlaps with identical Event IDs as Target Event records are appended to the event feature class.
| String |
generate_event_ids (可选) | Specifies whether to generate Event IDs for in_dataset records being appended. Generation of Events IDs will only be applied to in_dataset records with a Null value for the Event ID field.
| Boolean |
generate_shapes (可选) | Specifies whether to regenerate the shapes for the records being appended. This parameter is only enabled when the in_dataset is a feature layer or feature class.
| Boolean |
代码示例
AppendEvents example 1 (Python window)
Demonstrates how to use the AppendEvents tool in the Python window.
# Name: AppendEvents_Inline_Example.py
# Description: Append event records into an existing Roads and Highways event feature class.
# Requires: Esri Roads and Highways
# set current workspace
arcpy.env.workspace = r"C:\NY_Data.gdb"
# tool variables
in_dataset = "AADT_Add"
in_event_featureclass = "AADT"
field_mapping = 'YEAR_ "YEAR_" true true false 2 Short 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,YEAR_,-1,-1;DISTRICT "DISTRICT" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DISTRICT,-1,-1;COSITE "COSITE" true true false 6 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,COSITE,-1,-1;ROADWAY "ROADWAY" true true false 8 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,ROADWAY,-1,-1;DESC_FRM "DESC_FRM" true true false 30 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DESC_FRM,-1,-1;DESC_TO "DESC_TO" true true false 30 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DESC_TO,-1,-1;AADT "AADT" true true false 4 Long 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,AADT,-1,-1;AADTFLG "AADTFLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,AADTFLG,-1,-1;KFLG "KFLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,KFLG,-1,-1;K100FLG "K100FLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,K100FLG,-1,-1;DFLG "DFLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DFLG,-1,-1;TFLG "TFLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,TFLG,-1,-1;BEGIN_POST "BEGIN_POST" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,BEGIN_POST,-1,-1;END_POST "END_POST" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,END_POST,-1,-1;KFCTR "KFCTR" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,KFCTR,-1,-1;K100FCTR "K100FCTR" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,K100FCTR,-1,-1;DFCTR "DFCTR" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DFCTR,-1,-1;TFCTR "TFCTR" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,TFCTR,-1,-1;FromDate "FromDate" true true false 8 Date 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,FromDate,-1,-1;ToDate "ToDate" true true false 8 Date 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,ToDate,-1,-1;EventID "EventID" true true false 50 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,EventID,-1,-1'
load_type = "RETIRE_OVERLAPS"
event_ids = "GENERATE_EVENT_IDS"
generate_shapes = "NO_SHAPES"
# execute the tool
arcpy.AppendEvents_locref(in_dataset, in_event_featureclass, field_mapping, load_type, event_ids, generate_shapes)
AppendEvents example 2 (stand-alone script)
Demonstrates how to use the AppendEvents tool as a stand-alone Python script.
# Name: AppendEvents.py
# Description: Append records into an existing Roads and Highways event feature class.
# Requires: Esri Roads and Highways
# Import arcpy module
import arcpy
# Check out any necessary licenses
arcpy.CheckOutExtension("Highways")
# Local variables:
in_dataset = "C:/NY_Data.gdb/AADT_Add"
in_target_event = "C:/NY_Data.gdb/LRSE_AADT"
field_mapping ='YEAR_ "YEAR_" true true false 2 Short 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,YEAR_,-1,-1;DISTRICT "DISTRICT" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DISTRICT,-1,-1;COSITE "COSITE" true true false 6 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,COSITE,-1,-1;ROADWAY "ROADWAY" true true false 8 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,ROADWAY,-1,-1;DESC_FRM "DESC_FRM" true true false 30 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DESC_FRM,-1,-1;DESC_TO "DESC_TO" true true false 30 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DESC_TO,-1,-1;AADT "AADT" true true false 4 Long 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,AADT,-1,-1;AADTFLG "AADTFLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,AADTFLG,-1,-1;KFLG "KFLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,KFLG,-1,-1;K100FLG "K100FLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,K100FLG,-1,-1;DFLG "DFLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DFLG,-1,-1;TFLG "TFLG" true true false 1 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,TFLG,-1,-1;BEGIN_POST "BEGIN_POST" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,BEGIN_POST,-1,-1;END_POST "END_POST" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,END_POST,-1,-1;KFCTR "KFCTR" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,KFCTR,-1,-1;K100FCTR "K100FCTR" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,K100FCTR,-1,-1;DFCTR "DFCTR" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,DFCTR,-1,-1;TFCTR "TFCTR" true true false 8 Double 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,TFCTR,-1,-1;FromDate "FromDate" true true false 8 Date 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,FromDate,-1,-1;ToDate "ToDate" true true false 8 Date 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,ToDate,-1,-1;EventID "EventID" true true false 50 Text 0 0 ,First,#,C:\NY_Data.gdb\AADT_Add,EventID,-1,-1'
# Process: Append Events
arcpy.AppendEvents_locref(in_dataset, in_target_event, field_mapping, "ADD", "NO_GENERATE_EVENT_IDS", "GENERATE_SHAPES")
环境
许可信息
- ArcGIS Desktop Basic: 需要 Roads and Highways
- ArcGIS Desktop Standard: 需要 Roads and Highways
- ArcGIS Desktop Advanced: 需要 Roads and Highways