views:

260

answers:

1

Hi,

I'm trying to use the MakeRouteEventLayer tool but can't seem to get the different pre-conditions met. The routes are hosted on an SDE database. So far, I am setting the workspace by making a connection to the database server but I don't know how to get the arguments needed by MakeRouteEventLayer's constructor. I can't seem to find how i'm supposed to get the Feature Layer to pass as the Input Route Features. Also, I don't understand how to create an event table properly. I can't seem to find any exemple relating to what I am trying to accomplish aside from this one which I don't understand since it isn't documented/commented very much and the datatypes are not mentionned.

For your information, the tool I am working on is written in C#.

Thanks to you all !

A: 

It may be useful to read the help file for the desktop application, as it explains it a little better: ESRI WebHelp for ArcGIS 9.3.1.

I had to deal with similar problems in the past working with personal geodatabases. So in essence, this is what you need to do:

  1. Set your workspace to the database (after you create a connection to it). Use the C# equivalent of gp.Workspace = "connection here"
  2. First argument (required) is the route feature layer name, in reference to your workspace (if workspace is dbName and inside is a routeFL, then the layer name would be only routeFL).
  3. Second argument (required) is the identifier for each unique route. It could be a RouteID you defined, or the unique identifier for each feature in your route layer.
  4. Third argument (required) is the table with the events you want to locate on the routes.
  5. Fourth argument (required) is the type of events, either POINT or LINE. It is composed by the routeID that the event is located on (a field in the Events table that identifies the route you should be on), the type of event (POINT or LINE) and then the From and To measure fields. If you are using point, then the from is only used one and is called measure field.
  6. Fifth argument (required) is your output layer. Note this is an IN-MEMORY layer, so it does not accept a path, and will not be permanently stored. You can run a command on it afterwards to store it.
  7. The rest of the arguments are optional and include: (a) an offset field in your events file, (b) an error field to be added and populated with possible errors, (c) an angle filed to be added to indicate angle between route and Point event - doesn't work with line events as they are ON the route), (d) an angle type, either perpendicular or tangent, (e) whether to record the compliment angle (only if you enable angle measurement in the first place), (f) offset direction left/right of route, only if you enable the offset earlier, and finally (g) the type of point you have (Multipoint or point).

Hopefully this enables you to understand the fields a little better to complete your task. A Python example may help you a little bit:

gp.workspace = "myDB.mdb"
# Route file to use
routeFC = "myRoutes"
# The identifier for each route
routeID = "rID"
# Where my events are stored
eventTable = "accidents"
# My events use a routeID to identify route they are on, are POINTS and their measure field is called "mile"
eventProperties = "routeID POINT mile"
# Temporary layer to save everything to
outputLayer = "accidentEvents"
# Have no offset
offset = "#"
# Need to add the errors for verification purposes
error = "ERROR_FIELD"
# Need to store angles
angles = "ANGLE_FIELD"
# Need perpendicular angle
angleType = "NORMAL"
# Run the command now to create the layer
gp.MakeRouteEventLayer(routeFC, routeID, eventTable, eventProperties, outputLayer, offset, error, angles, angleType)

The above code allows you to create the Route Event layer in a temporary, in-memory layer. To save the layer, simply run the SaveToLayerFile(inLayer, outLayer) command and you are done.

Michalis Avraam