-1

I have a set of data (see the table below) which has an origin lat and long and destination lat and long with speed. I just want to plot lines between the origin and destination, and color code them according to speed in ArcGIS.

This sounds so simple but I am not able to do this. When I plot with ArcGIS XY to Line feature I get the graph below. These lines are NOT ON THE ROAD!

I am trying to get them onto the road using Network Analyst but that ArcGIS extension has been pretty much useless. I just want the points to connect from origin to destination and be color coded. How can i do this in ArcGIS?

If this is not possible in ArcGIS, is there any other software where I can do this and get the segments on the road?

I have read a lot of questions, forums, etc. but can't seem to find an answer to a task which should be so easy to do.

Also the matching to the graph or snapping to road hasn't worked for me. Can some one please help me with this? With step by step detail in ArcGIS would be great.

table of data that i have

enter image description here

  • I'm unclear on exactly what you want to do. You mention origin/destination which would be a network analysis where you'd need to convert your coordinate pairs to points and use the two (different) sets of points as inputs to one of the network solvers. But you also talk about snapping to roads, and your data sort of looks like a GPS tracklog, in which case you're trying to create lines out of GPS points and the proper term for getting them aligned to roads is map-matching (see tag for related questions) and has nothing to do with network analysis. How was your example created? – Chris W Aug 24 '15 at 16:56
  • Hi Chris thankyou for your response. Have you ever seen google traffic maps ? I just want that from my data that i have. when i plot these points they are on roads but when the line that is joined it isnt between roads. It should be a poly line and not a straight line between two points. Ive read about map matching but dont really understand how to go about doing this ... – Ammar Khurshid Aug 25 '15 at 8:46
  • something like those traffic maps in the link that you see... I am using speed as a factor to show congestion between points .... I hope what i am trying to say is clear now... For the question that you asked my example was created with XY to line tool between points in ARCGiS i added the table and just clicked xy to line to make it like this and color coded according to the speed. – Ammar Khurshid Aug 25 '15 at 9:02
3

The XY to Line tool:

Creates a new feature class containing geodetic line features... ...A geodetic line is a curve on the surface of the earth. However, a geodetic line feature is not stored as a parametric (true) curve in the output, but as a densified polyline representing the path of the geodetic line. If the length of a geodetic line is relatively short, it may be represented by a straight line in the output. As the length of the line increases, more vertices are used to represent the path.

So in short, it doesn't pay any attention to your existing lines or network. It simply draws a line from the start to the end. Even if you were to snap the points generated from your coordinate pairs to the network (because if GPS points it's unlikely they are - that's map-matching), the resulting lines won't necessarily follow those roads.


Network Analyst Approach

Lines between two points on a network (at least in Network Analyst) are called routes. In order to generate a route, you need three things - a network (the lines/edges/roads and junctions), origin points, and destination points. Creating a clean network for analysis can be time consuming if you don't already have one. From there you run a solver that generates the routes based on network criteria (speed limits, time to travel, length, etc.).

In your case each record of your data is a matched start and end point. They'd have to be split and converted to actual point features to be used as inputs. Then you'd have to run a solver to create the route lines, and because you have specifically matching points there's only two ways to do this (that I know of):

  • Iteratively, using the simple route solver and running it over and over again for each start and end point sharing a common ID.
  • All at once with the closest facility solver, which will generate routes from every start point to every end point (not one to one match; ten of each will generate 100 routes), which you then have to filter down by selecting only routes whose start and end point ID match. Note that the Origin Destination Cost Matrix solver does not generate lines that follow the network.

There are questions here that have more detailed answers to both approaches. With the routes generated, you could join them to your original table to get the speed attribute transferred and then symbolize on that.


Map-matching Approach(es)

Right now you have a bunch of points that may or may not fall right on the road network lines. You could snap them to the network first in hopes of improving the lines generated from them, or you could just generate the lines as you have and snap those to the network lines. And by snap I mean the Snap GP tool. Another option is the Align to Shape tool. Unfortunately I don't see many ArcGIS questions specific to map-matching.

If you're having trouble "matching to the graph or snapping to road", I would suggest a new question specifically focused on that topic, and explain in detail what steps you have tried, tools you have used, and what did or didn't work.

You could also use your start/end points to cut up your network lines, but you're looking at a lot of dissolving and merging and cleanup probably to get that to work. You could also look at using a Spatial Join between your lines and roads. Another method to consider would be linear referencing.


Summary

As a quick summary, sometimes things that sound simple up front are actually relatively complex problems. I don't know exactly how Google does it under the hood, but it's a network based display of data. By which I mean they start with the network lines, and then either using the existing edges of the network (which may be split at strategic points to create pseudo-nodes or just run from junction to junction) or linear referencing, they can assign current speeds to those segments from traffic sensors/data.

Based on the data you have and the progress you've been able to make so far, I think the simplest solution will be to explore snapping or matching up the line segments you've created to the road network data. Essentially you've done what you needed, you just need to clean the resulting linework up to match the roads.

A couple of related/similar questions where aligning lines/tracks to a network is a component of the question/solution (and be sure to explore the Linked or Related questions on the right side of the page when you look at a question):

  • thanks chris for the excellent response ! I will try your approach of matching up the line segments over the upcoming few weeks and see how it goes – Ammar Khurshid Sep 1 '15 at 8:43
  • @AmmarKhurshid Upon further reflection I think the first thing I would try would be spatial joining your road network lines to the route lines you've already created. In your example image there are some problem lines (like the two angled orange segments in the upper right) where other roads might be closer than the one the line is supposed to follow, but the spatial join is probably the first method I would explore. There are similar/related questions if you search for "spatial join roads" that cover that approach. – Chris W Sep 1 '15 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.