I think it is something complicate, but I hope someone could bring up any idea about.

I'm using ArcGIS10, and I have a "One-way roads" shapefile with a One-way field with Y/N. But I need to create a new Field for this layer containing F or T if:

  • F : The final point of the line is Northern and Western than the origin of the line.
  • T : The final point of the line is Southern and Eastern than the origin of the line.

An example,Example

Another Example:


Thanks for your time,

  • Can you clarify, the end point of the green line is more Northern and more Eastern, why it is F? What if it were in the lower right corner (more Southern, more Eastern) True or False?
    – user30184
    Jun 2, 2014 at 12:42
  • @user30184 A line with two points, like the green one, its first point its named 1, then the final point (2), as it is Northern and Western than "1", the line should be coded as "F". The same with the red.It starts in 1 and end in 2, so as it southern and western, then I should code it as "T". Is it more clear now?
    – juasmilla
    Jun 2, 2014 at 13:52
  • Not really. I consider that the green "2" is to the North and to the East from the green "1". Let's assume that we have four vectors and each of those have the start point in the centre of a box. End points are in four different corners a) top-left b) top-right c) bottom-left d) bottom-right. What should be the True/False values for these four vectors?
    – user30184
    Jun 2, 2014 at 14:05
  • 1
    Can it be put as "If the north coordinate of the end point is greater than the north coordinate of the start point, the value of the new field is F as in From, otherwise it is T as in To"?
    – user30184
    Jun 2, 2014 at 14:48
  • 1
    As I commented in the other question gis.stackexchange.com/questions/99650/… , you are trying to perform two operations here. First you want to change the manner in which 'one-way' is defined. Second, for an unknown reason you want to ensure that all lines are drawn in the same direction. Based your description in the three questions thusfar, you simply need to change all Yes to T's. Flipping the roads to change some to F's is a different operation.
    – Chris W
    Jun 2, 2014 at 23:13

1 Answer 1


I apologize that I can't answer how to do it with arcgis but I made a successful test with Spatialite-gui. I created first a new Spatialite database and imported some road data from a shapefile. Then I executed these three SQL commands:

alter table roads add column from_or_to;

update roads set from_or_to='F'
where MbrMaxY(EndPoint(geometry)) > MbrMaxY(StartPoint(geometry));

update roads set from_or_to='T'
where MbrMaxY(EndPoint(geometry)) < MbrMaxY(StartPoint(geometry));

Finally I exported the table with a new and populated "from_or_to column" into a new shapefile.

  • It sounds sooo easy, but I don`t use this software :( I'll try to see something about ArcPy for that, but I'm not too familiarized. Thanks @user30184
    – juasmilla
    Jun 2, 2014 at 15:13
  • 1
    You would learn faster to use spatialite-gui than ArcPy but it is your choice. I hope you got some ideas from my answer.
    – user30184
    Jun 2, 2014 at 15:17
  • Of course yes, but I have to implement for large datasets and always with arcgis technologie :( Thanks for your help!
    – juasmilla
    Jun 2, 2014 at 15:22
  • 1
    Calculating this is arcpy would be similar, but more lines of code. With cursors and the data access module, it can be easily done.
    – Paul
    Jun 2, 2014 at 15:51
  • 1
    I measured how long it took to update the "from_or_to" field for the German OpenStreetMap data with 6.835.902 linestrings. Timing was 9 minutes and 40 seconds with a good laptop and the 6 GB database file hold on an USB2 external hard disk.
    – user30184
    Jun 2, 2014 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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