Creating lines from XY attributes in a point feature class

2764
11
Jump to solution
01-08-2013 05:01 AM
BenKeller2
New Contributor II
I have a point feature class, and within the feature class I have two other sets of XY coordinates and I want to create a line from the main point to the other two sets of coordinates and create a point at the end of each line so I can snap it to another line. The end process here is for a network dataset connection, but this part has been bugging me. Help would be great! Thank you
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RichardFairhurst
MVP Honored Contributor
I have looked into that. The problem is for every point I have 2 sets of coordinate points (that are not displayed) within the attribute table that I want that specific point to connect to. So I have my original point data, and then I used the near tool to get coordinates of the closest rail segment, and also road segment that I want to connect to. Those two sets of coordinates are not points yet because I do not know how to display multiple attribute columns of coordinates. I feel like that is pretty elementary but I cannot find a tool to do it.

Moral of the story is each point has two other sets of coordinates in its' attribute row and I want to connect that point to those two XY coordinates.


What you have is fine.  First add two long fields.  Make one an ID field and calculate the ObjectIDs of the original points into that field.  The other field will be an Order field for your master set of points and populate it with a value of 1 for the original point (or 2 if it is supposed to be an angle point between the rail and road points).

You then just need to create some temporary layers and point feature classes (possibly export a standalone table only from the points from within the tableview you have open in your screen shot).  Use the Make XY Event Layer tool twice with the standalone table, once for the rail Long/Lat and the other for the Road Long/Lat to convert the attributes to an in memory point layer.  Next Export from the TOC (not the tableviews) each of these layers to create real point feature classes.

Now recalculate the Order field of these new point feature classes to be 2 for one of the new feature classes and 3 for the other (or 1 for the first and 3 for the other if the original points was the angle point).  Now use the Append tool to join them to the original point layer (or make a copy of the original point feature class in ArcCatalog and use the Append tool to append the new points to that feature class).  Now you can use the Points to Line tool with this data, using the ID field value as the line ID and the Order field to make your three point angled line follow the correct path.

This is the way Geoprocessing usually works.  Use lots of small tool steps that build on each other and that create temporary feature classes.  Stop looking for a single swiss army knife tool that does every step.  The one stop tool often does not exist.

I hope that helps.

View solution in original post

0 Kudos
11 Replies
BenKeller2
New Contributor II
I want to use the XY to Line tool, but that only allows a start and end location, but I want two connect three points not just two. If that clears up what I was describing.
0 Kudos
JonathanQuinn
Esri Notable Contributor
Have you looked at the Points to Line tool?  You can use the Sort_Field to determine the order of the lines that will connect the points.
0 Kudos
BenKeller2
New Contributor II
I have looked into that. The problem is for every point I have 2 sets of coordinate points (that are not displayed) within the attribute table that I want that specific point to connect to. So I have my original point data, and then I used the near tool to get coordinates of the closest rail segment, and also road segment that I want to connect to. Those two sets of coordinates are not points yet because I do not know how to display multiple attribute columns of coordinates. I feel like that is pretty elementary but I cannot find a tool to do it.

Moral of the story is each point has two other sets of coordinates in its' attribute row and I want to connect that point to those two XY coordinates.
0 Kudos
RichardFairhurst
MVP Honored Contributor
I have looked into that. The problem is for every point I have 2 sets of coordinate points (that are not displayed) within the attribute table that I want that specific point to connect to. So I have my original point data, and then I used the near tool to get coordinates of the closest rail segment, and also road segment that I want to connect to. Those two sets of coordinates are not points yet because I do not know how to display multiple attribute columns of coordinates. I feel like that is pretty elementary but I cannot find a tool to do it.

Moral of the story is each point has two other sets of coordinates in its' attribute row and I want to connect that point to those two XY coordinates.


What you have is fine.  First add two long fields.  Make one an ID field and calculate the ObjectIDs of the original points into that field.  The other field will be an Order field for your master set of points and populate it with a value of 1 for the original point (or 2 if it is supposed to be an angle point between the rail and road points).

You then just need to create some temporary layers and point feature classes (possibly export a standalone table only from the points from within the tableview you have open in your screen shot).  Use the Make XY Event Layer tool twice with the standalone table, once for the rail Long/Lat and the other for the Road Long/Lat to convert the attributes to an in memory point layer.  Next Export from the TOC (not the tableviews) each of these layers to create real point feature classes.

Now recalculate the Order field of these new point feature classes to be 2 for one of the new feature classes and 3 for the other (or 1 for the first and 3 for the other if the original points was the angle point).  Now use the Append tool to join them to the original point layer (or make a copy of the original point feature class in ArcCatalog and use the Append tool to append the new points to that feature class).  Now you can use the Points to Line tool with this data, using the ID field value as the line ID and the Order field to make your three point angled line follow the correct path.

This is the way Geoprocessing usually works.  Use lots of small tool steps that build on each other and that create temporary feature classes.  Stop looking for a single swiss army knife tool that does every step.  The one stop tool often does not exist.

I hope that helps.
0 Kudos
HollyGolvach
New Contributor
I have a question about this.

I'm doing something similar, but the difference is that I'm connecting airline flights across different time blocks (600-700, 700-800, etc)

I've already made Polylines for each time block, but I want to connect separate flight paths (ie, Dallas to Houston connects in Houston for a new flight path Houston to Amarillo, etc) but I don't know how to retain the time block and connect the Polylines into a single flight route for the entire day. Any suggestions?
0 Kudos
RichardFairhurst
MVP Honored Contributor
I have a question about this.

I'm doing something similar, but the difference is that I'm connecting airline flights across different time blocks (600-700, 700-800, etc)

I've already made Polylines for each time block, but I want to connect separate flight paths (ie, Dallas to Houston connects in Houston for a new flight path Houston to Amarillo, etc) but I don't know how to retain the time block and connect the Polylines into a single flight route for the entire day. Any suggestions?


From the sound of it, you have multiple segments that make up a complete flight path that are divided at each time block.  You want a single line that connects all of these segments. 

You will have to drop or generalize the timeblock information in the single line full flight path.  A Min/Max summary could retain the end values of the time blocks or you could create a comma separated complete list in a single field, but either way you lose some of the details of the separate line segments.

Therefore, you really need to maintain two separate feature classes to fully represent the data you are working with.  You can create a relate between the two feature classes to move back and forth between the two representations.

As far as connecting the line segments, create a Linear Referencing Route from the segments based on Flight ID and use a summary value for the Time Blocks (Min?Max).  Make sure all of your time block lines are drawn to point toward the end time block position.  Calculate the Time Block ranges into two fields (a From Time and a To Time) and use these fields as the From Measure and To Measure values for the Create Route tool to correctly order the segments and assign mesures to the Route that will be based on time.  Some adjustment to the time blocks will be needed if two flight segment connect across the midnight barrier to ensure that the path on the preceeding day connects to the path on the next day.  Make sure to override the Environmental Settings options for the Create Route tool to set the M Range, M Resolution and M Tolerance to hold fractional values (by default the Create Route will use only integer measure values, which is rarely useful, but only the Environmental Settings give you a consistent way to override that behavior).

With this route you can create an event table to show segments along the flight paths covering any time range you want that fits within the flight times.  For example you could get a segment for 625 to 750 with no problem and no need to create new feature geometry, only a row in a table or spreadsheet with the Flight ID and the From and To time interval you want.

If you are connecting several Flight IDs together, you would need to create a new field to hold a Total Day Flight ID that you would have to create.  As long as the segments that make up that set of flights do not have overlapping time block values on any segment, the Create Route tool should be able to combine them all.  Of course you will again lose some detail with this line that is preserved in the separate Flight ID paths and the time block paths, so this should probably be a modeled derivative of the more detailed data and you should perform maintenance on the finest level of detail that makes sense.

If you are looking to solve route optimization problems, then you need to use Network Analyst once you have a working network of flights.

I hope this helps.
0 Kudos
HollyGolvach
New Contributor
Hi there,

Thanks so much for the in-depth response, it's really appreciated!

Essentially (in broader strokes):

- Create a working network of flights starting with the Linear Referencing Route tool using the Route_ID (which is really a line between Departure & Arrival)

- Use the Start Time (min) and the End Time (max) for each segment as the From-Measure and the To-Measure and set in units of Time

- Use the Create Route tool and designate Time as the field that will govern the sequence of the routes

- Modify the Environmental Settings of the Create Route tool so that "M" values are Fractional (instead of Integer)

- Once the Route is created, then each flight will have a corresponding Route_ID and Departure time and Arrival time associated to it as a measurement

NEXT (the 2nd feature layer) is an EVENT table derived from the Linear Referencing Route tool?

- I'm confused here about how to pull the arriving flight at any given time and match it to the correct departing flight? (Or. has this already been achieved by sequencing the segments based on Time during the Create Route step?)


You suggest:
"this should probably be a modeled derivative of the more detailed data and you should perform maintenance on the finest level of detail that makes sense."


- Can you give me an example of what I need to derive as the "Total Day" field if I were to connect the Flight IDs together using the Create Route tool? (Ex, Total Day = ??? units? what value? )

- FINALLY, once the Network is built and is functional, then I can move into the Routing problem and optimization territory...

But, I'm still a little unclear on the specifics I've listed above that are necessary to make the network functional.

Thank you SO much for your help, thus far. I appreciate any other insight you can impart.

Sincerely,
Holly G.
0 Kudos
RichardFairhurst
MVP Honored Contributor
Hi there,

Thanks so much for the in-depth response, it's really appreciated!

Essentially (in broader strokes):

- Create a working network of flights starting with the Linear Referencing Route tool using the Route_ID (which is really a line between Departure & Arrival)

- Use the Start Time (min) and the End Time (max) for each segment as the From-Measure and the To-Measure and set in units of Time

- Use the Create Route tool and designate Time as the field that will govern the sequence of the routes

- Modify the Environmental Settings of the Create Route tool so that "M" values are Fractional (instead of Integer)

- Once the Route is created, then each flight will have a corresponding Route_ID and Departure time and Arrival time associated to it as a measurement


Correct so far.

NEXT (the 2nd feature layer) is an EVENT table derived from the Linear Referencing Route tool?


Not necessarily.

- I'm confused here about how to pull the arriving flight at any given time and match it to the correct departing flight? (Or. has this already been achieved by sequencing the segments based on Time during the Create Route step?)


The sequence should help, but since departure and arrival are in separate fields it is difficult to automate.  At the very least you can create a DEPARTURE and ARRIVAL field for each route and calculate them with the Python expressions:  !SHAPE.FIRSTPOINT.M! and !SHAPE.LASTPOINT.M!  I would have to look at the table output you have to consider the options for creating chained routes (not a Road Network issue)  Basically you need to deal with the Many to Many relationship based on all arrivals at a location with all departures at the location that are greater than the arrival time.  Such relationships are hard to automate, since choices have to be made.  For example, all of the matches are potential flight choices for any given person unless they have another destination objective that makes the choice for them.  I don't deal with flight scheduling, so I am not really sure of the rules that govern your model and that would be critical to know to automate any choices.

I also need to know if you are trying to solve a problem for a single person making each connection, such as a pilot, or are you trying to trace all possible flight connections that could be made based on arrival and departure matches.  The single pilot arriving at the airport can only choose one departing flight and only one that is later than his arrival time.  Once the choice is made all other flight possibilities are eliminated.  That is a very different problem from trying to trace the entire set of passenger and crew connecting flight opportunities associated with an airport.

The later problem could be handled something like a road intersection with each arriving flight being a one way road in and all departing flights leaving being departing roads out.  As Long as I can extract all of the To Points and associate them with all of the overlapping From points at an airport tha share the same the location (like roads leading to and from an intersection) and the names that can be given and ordered.  An example might be the intersection: 

Airport 1 Arrival 0700 Flight 102 & Airport 1 Departure 0800 Flight 33 & Airport 1 Departure 0900 Flight 404 & Airport 1 Departure 950 Flight 501 & Airport 1 Departure 1400 Flight 689

This intersection is like a roundabout connecting a 1 way road network.  The above list would indicate the complete opportunities you may have during a given day for a specific arriving flight with the only the first listed "Road" being required to enter the roundabout (one-way road in), but all other intersecting "Roads" can be used to exit the roundabout intersection (one way roads out).  The time helps define the total set of connections and their order in the list.  The "Road Names" could be shortened, but one connecting flight ID representing two lines that can be combined could be:

Airport 1 Arrival 0700 Flight 102 & Airport 1 Departure 0800 Flight 33

Each half of that pair can be joined to the original lines on one half of that description with a arrival description or departure description

I know of ways to create such intersection points from the end points of lines.  The Make Query Table tool could also be used to solve the problem by extracting the end points of the lines.

You suggest:
"this should probably be a modeled derivative of the more detailed data and you should perform maintenance on the finest level of detail that makes sense."


That is just a principle of data in general.  Always keep the least aggregated source data you can and create data that connects to it


- Can you give me an example of what I need to derive as the "Total Day" field if I were to connect the Flight IDs together using the Create Route tool? (Ex, Total Day = ??? units? what value? )

- FINALLY, once the Network is built and is functional, then I can move into the Routing problem and optimization territory...

But, I'm still a little unclear on the specifics I've listed above that are necessary to make the network functional.


Unfortunately I also am unclear on where you are heading with your problem, but as you can see I can conceive of several possible approaches that could be used to solve different connecting flight choices.

Thank you SO much for your help, thus far. I appreciate any other insight you can impart.

Sincerely,
Holly G.


Your welcome.  Interesting problem and different from traffic analysis due to the constraint of access in and out of an intersection based on time.
0 Kudos
RichardFairhurst
MVP Honored Contributor
Actually I think this could be done with Network Analyst, possibly on your original network.  You would have to define all of the flight lines as one-way roads.  The only issue is that I don't know how Network Analyst would deal with the time restriction affecting departure opportunities, but it better designed to handle actual traces along connected network lines.  You could create a set of points as events at 5 minutes into each flight to function as barriers for different runs.  Alternatively manipulating a field on the flights could act as a barrier for a given set of traces.  It is on the boundary of what Network Analyst is optimized to do, but probably possible.  Look into that extension to see if it seems to fit the problem you are ultimately to solve.
0 Kudos