使用“MakeRouteEventLayer” 在 ArcGIS 中

发布于 2024-08-02 03:50:51 字数 638 浏览 6 评论 0原文

我正在尝试使用 MakeRouteEventLayer 工具,但似乎无法满足不同的先决条件。 这些路线托管在 SDE 数据库上。 到目前为止,我通过连接到数据库服务器来设置工作区,但我不知道如何获取 MakeRouteEventLayer 的 构造函数。 我似乎找不到如何让要素图层作为输入路线要素传递。 另外,我不明白如何正确创建事件表。 除了 这个我不明白,因为它没有太多记录/评论,并且没有提及数据类型。

供您参考,我正在开发的工具是用 C# 编写的。

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#.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

却一份温柔 2024-08-09 03:50:51

阅读桌面应用程序的帮助文件可能会很有用,因为它解释得更好一些:ESRI WebHelp for ArcGIS 9.3.1

在过去使用个人地理数据库时,我不得不处理类似的问题。 因此,本质上,这就是您需要做的:

  1. 将工作区设置为数据库(在创建与数据库的连接之后)。 使用 gp.Workspace = "connection here" 的 C# 等效
  2. 项 第一个参数(必需)是路径要素图层名称,参考您的工作空间(如果工作空间是 dbName 并且内部是routeFL,则图层名称将仅为routeFL) 。
  3. 第二个参数(必需)是每个唯一路由的标识符。 它可以是您定义的 RouteID,也可以是路径图层中每个要素的唯一标识符。
  4. 第三个参数(必需)是包含您要在路线上查找的事件的表。
  5. 第四个参数(必需)是事件的类型,可以是 POINT 或 LINE。 它由事件所在的路线 ID(事件表中的一个字段,用于标识您应该所在的路线)、事件类型(点或线)以及“起始”和“结束”测量字段组成。 如果您使用点,则仅使用一个起始点,称为测量字段。
  6. 第五个参数(必需)是您的输出层。 请注意,这是内存中层,因此它不接受路径,并且不会永久存储。 之后您可以对其运行命令来存储它。
  7. 其余参数是可选的,包括:(a) 事件文件中的偏移字段,(b) 要添加并填充可能错误的错误字段,(c) 要添加的角度字段以指示路线之间的角度和点事件 - 不适用于线事件,因为它们位于路线上),(d) 角度类型,垂直或相切,(e) 是否记录补角(仅当您在第一个事件中启用角度测量时) (f) 路线左/右偏移方向(仅当您较早启用偏移时),最后 (g) 您拥有的点类型(多点或点)。

希望这能让您更好地理解这些领域来完成您的任务。 一个 Python 示例可能会对您有一点帮助:

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)

上面的代码允许您在临时的内存层中创建 Route Event 层。 要保存图层,只需运行 SaveToLayerFile(inLayer, outLayer) 命令即可完成。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文