# How to compute and fill One-way field in a street shapefile according spacial position

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,

Another Example:

• 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? 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? 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? Jun 2, 2014 at 14:05
• 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"? Jun 2, 2014 at 14:48
• 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. Jun 2, 2014 at 23:13

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;

where MbrMaxY(EndPoint(geometry)) > MbrMaxY(StartPoint(geometry));