0

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:

Example2

Thanks for your time,

juasmilla
  • 479
  • 5
  • 16
  • 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 02 '14 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 02 '14 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 02 '14 at 14:05
  • @user30184 "T" is not for True, "T" is for To. And "F" for From.Is it right now clear? – juasmilla Jun 02 '14 at 14:38
  • 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 02 '14 at 14:48
  • Exact as you said @user30184 , but how? – juasmilla Jun 02 '14 at 14:50
  • 1
    As I commented in the other question http://gis.stackexchange.com/questions/99650/how-to-convert-direction-of-travel-osm-vectors-from-a-system-to-another , 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 02 '14 at 23:13
  • After further consideration I have a new understanding of what you are trying to do, and if you intend to use Network Analyst it will not work. In your first example, those should both be T. If you wanted the green line to be F you need to flip the line. If you do not, you will break the To/From convention and potentially introduce a lot of confusion and software error. You are attempting to tie To/From to a cardinal direction rather than the line direction as the software/convention expects. At the very least you would want to consider changing your values to N (F) and S (T). – Chris W Jun 03 '14 at 04:26

1 Answers1

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.

user30184
  • 65,331
  • 4
  • 65
  • 118
  • 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 02 '14 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 02 '14 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 02 '14 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 02 '14 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 02 '14 at 15:57