Append Events (Location Referencing)

Title  Append Events (Location Referencing)

Summary

Appends event records from a table, layer, or feature class into an existing ArcGIS Location Referencing event feature class.

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. To adjust this setting, see Edit a server directory in Manager.


Usage


Syntax

Parameter Explanation
in_dataset

The source event records to append.

in_target_event

The Location Referencing event layer or feature class into which the source event records append.

field_mapping

Controls how the attribute information in the fields of the Input Event is transferred to the Target Event.

Because the data of the Input Event 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.

load_type (Optional)

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.

  • Add—Appends the Input Event records to the Target Event. No changes are made to Target Event records.
  • Retire overlaps—Appends the Input Event records to the Target Event and retires any records in the Target Event with measure or temporality overlaps as the appended events. If the appended event eclipses the Target Event, the Target Event will be deleted. This option should only be used for linear events.
  • Retire by event ID—Appends the Input Event records to the Target Event and retires any records in the Target Event with the same Event ID and temporality overlaps as the appended events. If the appended event eclipses a Target Event with the same Event ID, the Target Event will be deleted.
  • Replace by event ID—Appends the Input Event records to the Target Event and deletes any records in the Target Event with the same Event ID as the appended events.
generate_event_ids (Optional)

Specifies whether event IDs will be generated for Input Event records being appended. Generation of event IDs will only be applied to Input Event records with a Null value for the Event ID field.

  • Checked—Generates event IDs for theInput Event records being appended.
  • Unchecked—Does not generate event IDs for the Input Event records being appended. This is the default.
generate_shapes (Optional)

Specifies whether the shapes of the records being appended will be regenerated. This parameter is only active when the Input Event is a feature layer or feature class.

  • Checked—The shapes of the input event features will be regenerated. This is the default.
  • Unchecked—The shapes of the input event features will not be regenerated.

Code Samples

AppendEvents example 1 (Python window)

Demonstrates how to use the AppendEvents tool in the Python window.


# Name: AppendEvents_InlinePython_Example.py
# Description: Append event records into an existing Pipeline Referencing event feature class.
# Requires: ArcGIS Pipeline Referencing


# set current workspace
arcpy.env.workspace= r"C:\Pipeline.gdb"

# Setting tool variables
# Source Event Table in fgdb
in_dataset = "PTMS_Add"

# Target Event Feature Class in fgdb
in_target_event = "LRSE_PTMS"

#Mapping fields b/w target and source
field_mapping = r'AADT "AADT" true true false 4 Long 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,AADT,-1,-1;YEAR_ "YEAR_" true true false 2 Short 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,YEAR_,-1,-1;Cosite "Cosite" true true false 6 Text 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,Cosite,0,6;Classd "Classd" true true false 3 Text 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,Classd,0,3;SECTION_ "SECTION_" true true false 8 Text 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,SECTION_,0,8;COMM "COMM" true true false 254 Text 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,COMM,0,254;Active "Active" true true false 1 Text 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,Active,0,1;Sitetype "Sitetype" true true false 11 Text 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,Sitetype,0,11;KFCTR "KFCTR" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,KFCTR,-1,-1;DFCTR "DFCTR" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,DFCTR,-1,-1;TFCTR "TFCTR" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,TFCTR,-1,-1;LOCATION "LOCATION" true true false 8 Double 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,LOCATION,-1,-1;FromDate "FromDate" true true false 8 Date 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,FromDate,-1,-1;ToDate "ToDate" true true false 8 Date 0 0,First,#,C:\Pipeline.gdb\PTMS_Add,ToDate,-1,-1;EventID "EventID" true true false 50 Text 0 0,First,#,C:\Pipeline.gdb\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)

                    

AppendEvents example 2 (stand-alone script)

Demonstrates how to use the AppendEvents tool as a stand-alone Python script.


# Name: AppendEvents_StandAlonePython_Example.py
# Description: Append event records into an existing Pipeline Referencing event feature class.
# Requires: ArcGIS Pipeline Referencing

# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("LocationReferencing")

# Setting tool variables
# Source Event Table in fgdb
in_dataset = r"C:\Pipeline.gdb\PTMS_Add"

# Target Event Feature Class in fgdb
in_target_event = r"C:\Pipeline.gdb\LRSE_PTMS"

#Mapping fields b/w target and source
field_mapping = "AADT \"AADT\" true true false 4 Long 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,AADT,-1,-1;YEAR_ \"YEAR_\" true true false 2 Short 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,YEAR_,-1,-1;Cosite \"Cosite\" true true false 6 Text 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,Cosite,0,6;Classd \"Classd\" true true false 3 Text 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,Classd,0,3;SECTION_ \"SECTION_\" true true false 8 Text 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,SECTION_,0,8;COMM \"COMM\" true true false 254 Text 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,COMM,0,254;Active \"Active\" true true false 1 Text 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,Active,0,1;Sitetype \"Sitetype\" true true false 11 Text 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,Sitetype,0,11;KFCTR \"KFCTR\" true true false 8 Double 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,KFCTR,-1,-1;DFCTR \"DFCTR\" true true false 8 Double 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,DFCTR,-1,-1;TFCTR \"TFCTR\" true true false 8 Double 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,TFCTR,-1,-1;LOCATION \"LOCATION\" true true false 8 Double 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,LOCATION,-1,-1;FromDate \"FromDate\" true true false 8 Date 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,FromDate,-1,-1;ToDate \"ToDate\" true true false 8 Date 0 0,First,#,C:\\Pipeline.gdb\\PTMS_Add,ToDate,-1,-1;EventID \"EventID\" true true false 50 Text 0 0,First,#,C:\\Pipeline.gdb\\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)

                    

AppendEvents example 3 (stand-alone script)

Demonstrates how to use the AppendEvents tool as a stand-alone Python script in a feature service.


# Name: AppendEvents_Pro_Ex3.py
# Description: This script demonstrates how to use append events in stand alone mode using a feature service. It is recommended to work in a version and post it into the default version.
# Requires: Location Referencing license

# Import arcpy module.
import arcpy

# Check out any necessary licenses.
arcpy.CheckOutExtension("LocationReferencing")


# Setting tool variables.

sourceevent = "C:\\LocationReferencing\\LR.gdb\\LineEvent"
field_mapping = r'FROMDATE "From Date" true true false 8 Date 0 0,First,#,C:\\LocationReferencing\\LR.gdb\\LineEvent,FROMDATE,-1,-1;TODATE "To Date" true true false 8 Date 0 0,First,#,C:\\LocationReferencing\\LR.gdb\\LineEvent,TODATE,-1,-1;EVENTID "Event ID" true true false 50 Text 0 0,First,#,C:\\LocationReferencing\\LR.gdb\\LineEvent,EVENTID,0,50;ROUTEID "Route ID" true true false 255 Text 0 0,First,#,C:\\LocationReferencing\\LR.gdb\\LineEvent,ROUTEID,0,255;FROMMEASURE "From Measure" true true false 0 Double 0 0,First,#,C:\\LocationReferencing\\LR.gdb\\LineEvent,FROMMEASURE,-1,-1;TOMEASURE "To Measure" true true false 0 Double 0 0,First,#,C:\\LocationReferencing\\LR.gdb\\LineEvent,TOMEASURE,-1,-1'
load_type = "ADD"
generate_event_ids = "NO_GENERATE_EVENT_IDS"
generate_shapes = "GENERATE_SHAPES"


## Target event  is in feature service. Signing in 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"


# Process: Append Events.
arcpy.locref.AppendEvents(sourceevent, targetevent, field_mapping , load_type, generate_event_ids, generate_shapes)


                    

Tags

Credits

Use limitations