适用于 Location Referencing 许可。
描述
Appends event records from a table, layer, or feature class to an existing Esri Roads and Highways event feature class.
使用
An LRS dataset is required to run this tool.
The Input Event can be a table, layer, or feature class.
Learn more about fields required by the Roads and Highways events data model
The Target Event should be a layer or feature class registered with Roads and Highways.
This tool supports point and polyline features. The feature type in the input and target event parameters should match.
If the Generate Event ID GUIDs for loaded events parameter is checked and you want GUIDs generated, either do not map the EventID field in the field mapping section or be sure to 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 Event ID GUIDs for loaded events parameter is checked, the value in the source event record EventID field will be loaded into the target event.
语法
arcpy.locref.AppendEvents(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 into which the source event records will be appended. | Feature Layer |
field_mapping | Controls how the attribute information in fields of the in_dataset is transferred to the in_target_event. Because the data of in_dataset is appended into 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 will be loaded into the event feature class.
| String |
generate_event_ids (可选) | Specifies whether event IDs will be generated for in_dataset records being appended. Generation of event IDs will only be applied to in_dataset records with a Null value for the Event ID field.
| Boolean |
generate_shapes (可选) | Specifies whether the shapes of the records being appended will be regenerated. This parameter is only enabled when the in_dataset is a feature layer or feature class.
| Boolean |
派生输出
名称 | 说明 | 数据类型 |
out_target_event | The event layer or feature class to which the source event records have been appended. | Feature Layer |
out_details_file | A text file that details changes made by the tool. | Text File |
代码示例
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.
# 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.
# 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")
环境
许可信息
- Basic: 需要 Roads and Highways
- Standard: 需要 Roads and Highways
- Advanced: 需要 Roads and Highways