Disponible con licencia de Location Referencing.
Resumen
Appends event records from a table, layer, or feature class to an existing ArcGIS Location Referencing event feature class.
Nota:
When the target layer is a feature service layer, the validation results for this tool are written to a file in the ArcGIS Server directory. By default, this file will be automatically cleaned up after 10 minutes, which may not be enough time to process all of the validations and write them to your workstation that is running ArcGIS Pro. For larger data loads, it is recommended that you adjust the maximum file age to at least one hour. You can edit a server directory in Manager to adjust this setting.
Uso
An LRS dataset is required to run this tool. To create an LRS dataset, add the calibration point, centerline, and redline layers to a feature dataset; then run the Modify LRS tool with the geodatabase as the input.
The Input Event can be a table, layer, or feature class.
Learn more about fields required by the ArcGIS Pipeline Referencing events data model
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 Location Referencing.
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.
When conflict prevention is enabled, the following are supported:
- The events that need to be appended will automatically acquire event locks if available. If the locks cannot be acquired, the tool will return an error and provide the text file of offending locks.
- While working in the default version, the locks acquired will be released automatically upon completion of the tool.
- While working in a child version, the locks acquired will remain in post status on completion of the tool. You must post or delete the version to release the locks.
- While working in a child version, if the execution of the tool is cancelled by interruption, the locks are acquired and will remain in releasable status.
Route calibration on physically gapped routes affects appended events in the following ways:
- If the route calibration difference across the gap is not zero, appended events will be split at gaps.
- If the route calibration difference across the gap is zero, appended events will be multipart events.
Sintaxis
AppendEvents(in_dataset, in_target_event, field_mapping, {load_type}, {generate_event_ids}, {generate_shapes})
Parámetro | Explicación | Tipo de datos |
in_dataset | The source event records to append. | Table View |
in_target_event | The Location Referencing event layer or feature class into 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 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 (Opcional) | 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 (Opcional) | 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 (Opcional) | 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 |
Salida derivada
Nombre | Explicación | Tipo de datos |
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 |
Muestra de código
Demonstrates how to use the AppendEvents tool in the Python window to append event records into an existing event feature class. .
# Name: AppendEvents_ex1_pro.py
# Description: Append event records into an existing Location Referencing event feature class.
# Requires: ArcGIS Location Referencing
# Import arcpy module
import arcpy
# Check out license
arcpy.CheckOutExtension("LocationReferencing")
# Set current workspace
arcpy.env.workspace= r"C:\Pipeline.gdb"
# Set tool variables
# Source Event Table in fgdb
in_dataset = "PTMS_Add"
# Target Event Feature Class in fgdb
in_target_event = "LRSE_PTMS"
#Map fields between target and source
field_mapping = r'AADT "AADT" true true false 4 Long 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,AADT,-1,-1;YEAR_ "YEAR_" true true false 2 Short 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,YEAR_,-1,-1;Cosite "Cosite" true true false 6 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,Cosite,0,6;Classd "Classd" true true false 3 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,Classd,0,3;SECTION_ "SECTION_" true true false 8 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,SECTION_,0,8;COMM "COMM" true true false 254 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,COMM,0,254;Active "Active" true true false 1 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,Active,0,1;Sitetype "Sitetype" true true false 11 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,Sitetype,0,11;KFCTR "KFCTR" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,KFCTR,-1,-1;DFCTR "DFCTR" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,DFCTR,-1,-1;TFCTR "TFCTR" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,TFCTR,-1,-1;LOCATION "LOCATION" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,LOCATION,-1,-1;FromDate "FromDate" true true false 8 Date 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,FromDate,-1,-1;ToDate "ToDate" true true false 8 Date 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,ToDate,-1,-1;EventID "EventID" true true false 50 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,EventID,0,50'
load_type = "Add"
generate_event_ids = "NO_GENERATE_EVENT_IDS"
generate_shapes = "GENERATE_SHAPES"
# Execute the tool
arcpy.locref.AppendEvents(in_dataset, in_target_event, field_mapping, load_type, generate_event_ids, generate_shapes)
# Check in license
arcpy.CheckInExtension('LocationReferencing')
Demonstrates how to use the AppendEvents tool in a stand-alone Python script to append event records into an existing event feature class.
# Name: AppendEvents_StandAlonePython_Example.py
# Description: Append event records into an existing event feature class.
# Requires: ArcGIS Location Referencing
# Import arcpy module
import arcpy
# Check out license
arcpy.CheckOutExtension("LocationReferencing")
# Set tool variables
# Source Event Table in fgdb
in_dataset = r"C:\Pipeline.gdb\LRS\PTMS_Add"
# Target Event Feature Class in fgdb
in_target_event = r"C:\Pipeline.gdb\LRS\LRSE_PTMS"
#Map fields b/w target and source
field_mapping = r"AADT \"AADT\" true true false 4 Long 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,AADT,-1,-1;YEAR_ \"YEAR_\" true true false 2 Short 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,YEAR_,-1,-1;Cosite \"Cosite\" true true false 6 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,Cosite,0,6;Classd \"Classd\" true true false 3 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,Classd,0,3;SECTION_ \"SECTION_\" true true false 8 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,SECTION_,0,8;COMM \"COMM\" true true false 254 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,COMM,0,254;Active \"Active\" true true false 1 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,Active,0,1;Sitetype \"Sitetype\" true true false 11 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,Sitetype,0,11;KFCTR \"KFCTR\" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,KFCTR,-1,-1;DFCTR \"DFCTR\" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,DFCTR,-1,-1;TFCTR \"TFCTR\" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,TFCTR,-1,-1;LOCATION \"LOCATION\" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,LOCATION,-1,-1;FromDate \"FromDate\" true true false 8 Date 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,FromDate,-1,-1;ToDate \"ToDate\" true true false 8 Date 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,ToDate,-1,-1;EventID \"EventID\" true true false 50 Text 0 0,First,#,C:\Pipeline.gdb\LRS\PTMS_Add,EventID,0,50"
load_type = "REPLACE_BY_EVENT_ID"
generate_event_ids = "NO_GENERATE_EVENT_IDS"
generate_shapes = "GENERATE_SHAPES"
# Execute the tool
arcpy.locref.AppendEvents(in_dataset, in_target_event, field_mapping, load_type, generate_event_ids, generate_shapes)
# Check in license
arcpy.CheckInExtension('LocationReferencing')
Demonstrates how to use the AppendEvents tool in a stand-alone Python script to append event records into a feature service.
# Name: AppendEvents_Pro_Ex3.py
# Description: Append events using a feature service. It is recommended to work in a version and post to the default version.
# Requires: ArcGIS Location Referencing
# Import arcpy module
import arcpy
# Check out license
arcpy.CheckOutExtension("LocationReferencing")
# Set tool variables
sourceevent = r"C:\LocationReferencing\LR.gdb\LRS\LineEvent"
field_mapping = r'FROMDATE "From Date" true true false 8 Date 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\LineEvent,FROMDATE,-1,-1;TODATE "To Date" true true false 8 Date 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\LineEvent,TODATE,-1,-1;EVENTID "Event ID" true true false 50 Text 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\LineEvent,EVENTID,0,50;ROUTEID "Route ID" true true false 255 Text 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\LineEvent,ROUTEID,0,255;FROMMEASURE "From Measure" true true false 0 Double 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\LineEvent,FROMMEASURE,-1,-1;TOMEASURE "To Measure" true true false 0 Double 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\LineEvent,TOMEASURE,-1,-1'
load_type = "ADD"
generate_event_ids = "NO_GENERATE_EVENT_IDS"
generate_shapes = "GENERATE_SHAPES"
# Target event is in a feature service. Sign in to portal is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')
# Map the target event from the feature service. In the feature service, 34 corresponds to the target event.
targetevent = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/34"
# Execute the tool
arcpy.locref.AppendEvents(sourceevent, targetevent, field_mapping, load_type, generate_event_ids, generate_shapes)
# Check in license
arcpy.CheckInExtension('LocationReferencing')
Entornos
Información de licenciamiento
- Basic: Requiere ArcGIS Location Referencing
- Standard: Requiere ArcGIS Location Referencing
- Advanced: Requiere ArcGIS Location Referencing