mimiller

MakeRouteEventLayer, any ideas on why variable for in event properties no work?

Discussion created by mimiller on Aug 24, 2012
Latest reply on Mar 7, 2017 by danielri
I using the below code snippet to create a route event and will eventually set it up to accept input parameters for the route ID, begin MP and End MP. So I was thinking I test setting it up to "build" the in event properties input using string formatting. But the string I have assigned to the props variable does not seem to work.  Any ideas out there of what I am missing?

import arcpy
import os
arcpy.env.overwriteOutput = 1
arcpy.env.workspace = r"\\itdhq1apt50\GIS_Data\NeedsTracking\Scratch.gdb"
gdb_loc = arcpy.env.workspace
scratch = arcpy.env.scratchWorkspace
scratch_gdb = os.path.join(scratch, 'scratch.gdb')
print "starting this darn task"
arcpy.AddMessage("starting this darn task")

in_line = "Database Connections\CONNECTION SDE 4 MAPPING.sde\sdeProd.SDE.StateHighwayUpdateFile" #sde statehwy data used to create route file
rteID = "RD_NAME" # using this a route ID to create routes base on road number rather than segment no
#rteID = "UNIQUE_ID" # this will create routes based on segment no
outRoute = "StateHwyRouteFile"
outEvent = "lineTemp"
fc = "LineSelection"
#fc_prj = "PointsTestingWM"
fc_prj = os.path.join(scratch,'LineSelectionWM')
csWM = r"Coordinate Systems\Projected Coordinate Systems\World\WGS 1984 Web Mercator (Auxiliary Sphere).prj"
#table = arcpy.GetParameter(0)
table = gdb_loc + os.sep + "locateRoute"

inRoute = "routeID"
inBMP = "BMP"
inEMP = "EMP"
props = '"%s %s %s %s"' % (inRoute, 'LINE', inBMP, inEMP)
arcpy.MakeRouteEventLayer_lr(outRoute, rteID, table, props, outEvent, "#", "ERROR_FIELD")
#arcpy.MakeRouteEventLayer_lr(outRoute, rteID, table, "routeID LINE BMP EMP", outEvent, "#", "ERROR_FIELD")


Thanks

Outcomes